query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Post is post message to slack
func (s *Slack) Post(msg Message) (err error) { b, err := json.Marshal(msg) if err != nil { return err } buf := bytes.NewBuffer(b) req, err := http.NewRequest("POST", s.URL, buf) if err != nil { return errors.Wrap(err, "Can't make new request") } req.Header.Set("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5") req.Header.Set("Content-Type", "application/json") req.Header.Set("Accept", "application/json") if s.Verbose { if curl, err := http2curl.GetCurlCommand(req); err == nil { fmt.Fprintf(os.Stderr, "[CURL]: %v", curl) } } client := http.Client{Timeout: s.Timeout} res, err := client.Do(req) if err != nil { return errors.Wrap(err, "Can't post request") } defer func() { if err := res.Body.Close(); err != nil { fmt.Fprintf(os.Stderr, "[WARN]: %v", errors.Wrap(err, "Can't close response body")) } }() if res.StatusCode != 200 { return errors.New("Slack response status is not 2xx") } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s SlackReporter) Post(ctx context.Context, msg string) (string, error) {\n\t_, ts, err := s.api.PostMessageContext(ctx, s.channel, slack.MsgOptionText(msg, false))\n\treturn ts, err\n}", "func (t *FakeSlackChat) postMessage(msg Message) error {\n\treturn nil\n}", "func (s Slack) PostMessage(title string,message string)(errs []error) {\n\tfield1 := slack.Field{Title: title, Value: message}\n\t//field2 := slack.Field{Title: \"AnythingKey\", Value: \"AnythingValue\"}\n\n\tattachment := slack.Attachment{}\n\t//attachment.AddField(field1).AddField(field2)\n\tattachment.AddField(field1)\n\tcolor := \"good\"\n\tattachment.Color = &color\n\tpayload := slack.Payload {\n\t\tUsername: s.UserName,\n\t\tChannel: s.Channel,\n\t\tAttachments: []slack.Attachment{attachment},\n\t}\n\terr := slack.Send(s.WebhookUrl, \"\", payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (b *Bot) post(message map[string]interface{}, reply *domain.WorkReply, data *domain.Context, sub *subscription) error {\n\tmessage[\"text\"] = mainMessageFormatted()\n\tmessage[\"as_user\"] = true\n\tvar err error\n\t_, err = sub.s.Do(\"POST\", \"chat.postMessage\", message)\n\treturn err\n}", "func (m *Module) Post(txt string, params *PostMessageParameters) {\n\tm.PostC(m.config.SlackConfig.Channel, txt, params)\n}", "func SlackPost(username string, icon string, text string, hookurl string) (err error) {\n\tapiURL, err := url.ParseRequestURI(hookurl)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := url.Values{}\n\tapiURL.RawQuery = query.Encode()\n\tdata, _ := json.Marshal(map[string]string{\n\t\t\"text\": text,\n\t\t\"icon_emoji\": icon,\n\t\t\"username\": username,\n\t})\n\tclient := &http.Client{}\n\tr, err := http.NewRequest(\"POST\", hookurl, strings.NewReader(string(data)))\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.Header.Set(\"Content-Type\", \"application/json\")\n\t_, err = client.Do(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *instance) postMessage(jsondata []byte) {\r\n\tif s.client != nil {\r\n\t\tchannelID, timestamp, err := s.client.PostMessage(s.config.Channel, slack.MsgOptionText(string(jsondata), false), slack.MsgOptionUsername(\"g0-h0m3\"), slack.MsgOptionAsUser(true))\r\n\t\tif err == nil {\r\n\t\t\ts.service.Logger.LogInfo(s.name, fmt.Sprintf(\"message '%s' send (%s, %s)\", string(jsondata), channelID, timestamp))\r\n\t\t} else {\r\n\t\t\ts.service.Logger.LogError(s.name, fmt.Sprintf(\"message '%s' not send (%s, %s)\", string(jsondata), s.config.Channel, timestamp))\r\n\t\t\ts.service.Logger.LogError(s.name, err.Error())\r\n\t\t}\r\n\t} else {\r\n\t\ts.service.Logger.LogError(s.name, \"service not connected\")\r\n\t}\r\n}", "func (hc *HipChat2) Post(message string) bool {\n\tif hc.client == nil {\n\t\thc.client = hc.newClient()\n\t\tif hc.client == nil {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tmsg := &hipchat.NotificationRequest{\n\t\tColor: \"purple\",\n\t\tMessage: message,\n\t\tNotify: true,\n\t\tMessageFormat: \"text\",\n\t}\n\n\tif _, err := hc.client.Room.Notification(hc.RoomID, msg); err != nil {\n\t\tlog.Errorf(\"Failed post message...: %s\", msg.Message)\n\t\treturn false\n\t}\n\n\treturn true\n}", "func SendMessageToSlack(message string) {\n\tfmt.Println(\"Sending message to slack...\")\n\n\thttp.Post(url, \"\")\n\n\treturn nil\n}", "func HandlePost(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tvar configuration = config.GetConfig()\n\tvar api = configuration.Slack.Client\n\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(r.Body)\n\tbody := buf.String()\n\n\t// Check if the request is valid and coming from Events API\n\t// TODO: Update tokens auth to OAuth Flow\n\teventsAPIEvent, e := slackevents.ParseEvent(json.RawMessage(body),\n\t\tslackevents.OptionVerifyToken(\n\t\t\t&slackevents.TokenComparator{VerificationToken: configuration.Slack.VerificationToken},\n\t\t),\n\t)\n\tif e != nil {\n\t\tlog.Printf(\"Error parsing slack event %+v\\n\", e)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\t// Slack URL verification method\n\tif eventsAPIEvent.Type == slackevents.URLVerification {\n\t\thandleURLVerificationEvent(w, body)\n\t}\n\n\t// Slack messages in channel\n\tif eventsAPIEvent.Type == slackevents.CallbackEvent {\n\t\thandleCallbackEvent(w, api, eventsAPIEvent)\n\t}\n}", "func Post(w http.ResponseWriter, r *http.Request) {\n\tvar errs []string\n\tvar errStr, userIDStr, message string\n\n\tif userIDStr, errStr = processFormField(r, \"userID\"); len(errStr) != 0 {\n\t\terrs = append(errs, errStr)\n\t}\n\n\tuserID, err := gocql.ParseUUID(userIDStr)\n\tif err != nil {\n\t\terrs = append(errs, \"parameter 'userID' not a UUID\")\n\t}\n\n\tif message, errStr = processFormField(r, \"message\"); len(errStr) != 0 {\n\t\terrs = append(errs, errStr)\n\t}\n\n\tgocqlUUID := gocql.TimeUUID()\n\n\tvar created bool = false\n\tif len(errs) == 0 {\n\t\tquery := \"INSERT INTO messages (id, user_id, message) VALUES (?, ?, ?)\"\n\t\terr := db.Session.Query(\n\t\t\tquery,\n\t\t\tgocqlUUID, userID, message,\n\t\t).Exec()\n\t\tif err != nil {\n\t\t\terrs = append(errs, err.Error())\n\t\t} else {\n\t\t\tcreated = true\n\t\t}\n\t}\n\n\tif created {\n\t\t// send message to stream\n\t\tglobalMessages, err := stream.Client.FlatFeed(\"akshit\", \"global\")\n\t\tlog.Print(\"stream error\", err)\n\t\tif err == nil {\n\t\t\t_, err := globalMessages.AddActivity(getstream.Activity{\n\t\t\t\tActor: userID.String(),\n\t\t\t\tVerb: \"post\",\n\t\t\t\tObject: gocqlUUID.String(),\n\t\t\t})\n\t\t\tlog.Print(\"stream error 2 \", err)\n\t\t}\n\t\tjson.NewEncoder(w).Encode(NewMessageResponse{ID: gocqlUUID})\n\t} else {\n\t\tjson.NewEncoder(w).Encode(ErrorResponse{Errors: errs})\n\t}\n}", "func sendSlackMessage(message slack.Message) {\n\tuserData := SlackAPI.GetUserInfo(message.User)\n\ttimestampSplit := strings.Split(message.Ts, \".\")\n\ttimestampInt, err := strconv.ParseInt(timestampSplit[0], 10, 64)\n\ttimestamp := time.Unix(timestampInt, 0)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\terr = SlackAPI.PostMessage(conf.ChannelToMessage, conf.SlackMessageText)\n\tif err != nil {\n\t\tspew.Dump(err)\n\t}\n\n\terr = SlackAPI.PostMessage(conf.ChannelToMessage, \"> <@\"+userData.User.ID+\"> - \"+timestamp.Format(\"03:04:05 PM\")+\": \\n> \"+message.Text)\n\tif err != nil {\n\t\tspew.Dump(err)\n\t}\n}", "func sendMessage(recipient string, reviewUrl string) {\n\tb := new(bytes.Buffer)\n\tjson.NewEncoder(b).Encode(SlackMessage{Channel: recipient, Text: reviewUrl})\n\tresp, _ := http.Post(os.Getenv(\"SLACKURL\"), \"application/json; charset=utf-8\", b)\n\n\tdefer resp.Body.Close()\n\tioutil.ReadAll(resp.Body)\n}", "func (t *Tracker) send(color, message string) error {\n\tenv := os.Getenv(\"ENV\")\n\t// If no ENV is specified, assume we are in development mode, so we don't want to flood Slack uselessly.\n\tif env == \"\" {\n\t\treturn nil\n\t}\n\n\t_, perr := poster.Post(\n\t\tt.WebHook,\n\t\tmap[string]interface{}{\n\t\t\t\"text\" : fmt.Sprintf(\"%s - %s\", t.Application, env),\n\t\t\t\"attachments\": []map[string]interface{}{\n\t\t\t\t{\n\t\t\t\t\t\"color\": color,\n\t\t\t\t\t\"text\": fmt.Sprintf(\n\t\t\t\t\t\t\"*Message*\\n%s\\n\\n*Stack*\\n```%s```\\n\\n*Time*\\n%s\",\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tstring(debug.Stack()),\n\t\t\t\t\t\ttime.Now().Format(\"2006-01-02 03:04:05\"),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\n\t// An unexpected error happened when sending our message to Slack.\n\treturn perr\n}", "func MsgSlack(ctx *Context, msg string) error {\n\tcfg := ctx.Config\n\twebhookURL := \"https://hooks.slack.com/services/\" + cfg.Slacks[*ctx.ArgProfileName].Key\n\n\tlog.Printf(\"webhook: %s\", webhookURL)\n\n\tslackBody, _ := json.Marshal(slackRequestBody{Text: msg})\n\treq, err := http.NewRequest(http.MethodPost, webhookURL, bytes.NewBuffer(slackBody))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{Timeout: 10 * time.Second}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(resp.Body)\n\tif buf.String() != \"ok\" {\n\t\treturn errors.New(\"Non-ok response returned from Slack\")\n\t}\n\treturn nil\n}", "func postWebhook(webhookUrl string, webhookType string, p []byte) {\n\n\tvar payloadName string\n\tswitch webhookType {\n\tcase \"slack\":\n\t\tpayloadName = \"payload\"\n\tcase \"discord\":\n\t\tpayloadName = \"payload_json\"\n\t}\n\tresp, _ := http.PostForm(\n\t\twebhookUrl,\n\t\turl.Values{payloadName: {string(p)}},\n\t)\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\tfmt.Println(string(body))\n}", "func (c Client) Post(method string, params url.Values) (*jsontree.JsonTree, error) {\n\tparams[\"token\"] = []string{c.Token}\n\tresp, err := http.PostForm(fmt.Sprintf(\"https://slack.com/api/%s\", method), params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\ttree := jsontree.New()\n\terr = tree.UnmarshalJSON(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tok, err := tree.Get(\"ok\").Boolean()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !ok {\n\t\tmessage, _ := tree.Get(\"error\").String()\n\t\treturn nil, fmt.Errorf(\"Error: %s\", message)\n\t}\n\n\treturn tree, nil\n}", "func (s *SlackSvc) SendMessage(report ReportPayload) error {\n\tattachments := make([]map[string]interface{}, 1)\n\tattachments[0] = map[string]interface{}{\"text\": fmt.Sprintf(\"Howdy! Here's a list of *%d* PRs waiting to be reviewed and merged:\", len(report.PRs))}\n\tfor _, v := range report.PRs {\n\t\tattachments = append(attachments, map[string]interface{}{\"text\": v.ToString()})\n\t}\n\n\tif len(report.Reminders) > 0 {\n\t\tfor _, v := range report.Reminders {\n\t\t\tattachments = append(attachments, map[string]interface{}{\"text\": v.Text})\n\t\t}\n\t}\n\n\tmessage := map[string]interface{}{\n\t\t\"channel\": s.channelID,\n\t\t\"username\": s.user,\n\t\t\"icon_emoji\": \":robot_face:\",\n\t\t\"attachments\": attachments,\n\t}\n\n\tpayload, err := json.Marshal(message)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Failed to serialize Slack payload\")\n\t\treturn err\n\t}\n\n\tresp, err := s.client.Post(s.webhook, \"application/json\", bytes.NewReader(payload))\n\tif err != nil {\n\t\tlog.Error().Err(err).Msgf(\"Failed to serialize Slack payload: %v\", err)\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tlog.Info().Msgf(\"Message successfully sent to channel %s\", s.channelID)\n\treturn nil\n}", "func (mm mattermostMessage) sendMessage() {\n\tpost := &model.Post{}\n\tpost.ChannelId = mm.Event.Broadcast.ChannelId\n\t// Create file if message is too large\n\tif len(mm.Response) >= 3990 {\n\t\tres, resp := client.UploadFileAsRequestBody([]byte(mm.Response), mm.Event.Broadcast.ChannelId, mm.Request)\n\t\tif resp.Error != nil {\n\t\t\tlogging.Logger.Error(\"Error occured while uploading file. Error: \", resp.Error)\n\t\t}\n\t\tpost.FileIds = []string{string(res.FileInfos[0].Id)}\n\t} else if len(mm.Response) == 0 {\n\t\tlogging.Logger.Info(\"Invalid request. Dumping the response\")\n\t\treturn\n\t} else {\n\t\tpost.Message = \"```\\n\" + mm.Response + \"\\n```\"\n\t}\n\n\t// Create a post in the Channel\n\tif _, resp := client.CreatePost(post); resp.Error != nil {\n\t\tlogging.Logger.Error(\"Failed to send message. Error: \", resp.Error)\n\t}\n}", "func PostInitSlackMessage(webhook string) {\n\tmsg := &slack.WebhookMessage{\n\t\tUsername: Username,\n\t\tIconEmoji: IconEmoji,\n\t\tText: \"DocNoc has started scanning\",\n\t}\n\tif err := slack.PostWebhook(webhook, msg); err != nil {\n\t\tfmt.Println(\"🔥: Can't post init message to slack. Operating in headless state\", err)\n\t}\n}", "func (b *Bot) PostMessage(text, channel string) {\n\tb.rtm.SendMessage(b.rtm.NewOutgoingMessage(text, channel))\n}", "func PostToNewAccounts(msg string) error {\n\tctx := context.Background()\n\tclient := &http.Client{}\n\tu := url.URL{\n\t\tScheme: \"https\",\n\t\tHost: \"hooks.slack.com\",\n\t\tPath: \"services/TJ42GDSA0/BL63K1C57/T2byQxw0oXiRqUOGCEbwP5TG\",\n\t}\n\n\tbuf := &bytes.Buffer{}\n\tslackMsg := slackMessage{\n\t\tText: msg,\n\t}\n\tif err := json.NewEncoder(buf).Encode(&slackMsg); err != nil {\n\t\treturn errors.Wrap(err, \"encoding slack message\")\n\t}\n\n\toperation := func() error {\n\t\treq, err := http.NewRequest(http.MethodPost, u.String(), buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treq.Header.Set(\"Content-type\", \"application/json\")\n\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer check.Err(resp.Body.Close)\n\n\t\tif resp.StatusCode == http.StatusBadGateway {\n\t\t\treturn fmt.Errorf(\"server: temporary error\")\n\t\t} else if resp.StatusCode >= 300 {\n\t\t\tb, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn backoff.Permanent(fmt.Errorf(\"server: %v\", string(b)))\n\t\t}\n\n\t\treturn nil\n\t}\n\tif err := backoff.RetryNotify(operation,\n\t\tbackoff.WithContext(backoff.WithMaxRetries(backoff.NewExponentialBackOff(), maxRetries), ctx),\n\t\tfunc(err error, t time.Duration) {\n\t\t\tlog.Sugar.Errorw(\"error posting to new-accounts in slack, retrying\",\n\t\t\t\t\"err\", err.Error(),\n\t\t\t)\n\t\t}); err != nil {\n\t\treturn errors.Wrap(err, \"posting to new-accounts in slack\")\n\t}\n\n\treturn nil\n}", "func (s SlackReporter) PostThread(ctx context.Context, timeStamp, msg string) error {\n\t_, _, err := s.api.PostMessageContext(ctx, s.channel, slack.MsgOptionText(msg, false), slack.MsgOptionTS(timeStamp))\n\treturn err\n}", "func SpeakPost(ctx *iris.Context) {\n\n //Get our Json values\n testField := ctx.FormValue(\"statement\")\n\n //Place quotes around the testfield\n testField = fmt.Sprintf(\"\\\"%s\\\"\", testField);\n\n //Log the event\n\tspeakLog := fmt.Sprintf(\"/speak post | Speaking the following statement: %s\\n\", testField)\n fmt.Printf(speakLog)\n\n //Run the espeak command, and catch any errors\n //exec.Command(comman, commandArguments)\n cmd := exec.Command(\"./speak.sh\", testField);\n err := cmd.Start()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n //Send Okay and respond\n ctx.JSON(iris.StatusOK, iris.Map{\"message\": fmt.Sprintf(\"Success! Speaking the following statement: %s\", testField)})\n}", "func messageHandler(w http.ResponseWriter, r *http.Request) {\n\tu := r.PostFormValue(\"username\")\n\tm := r.PostFormValue(\"message\")\n\tlog.Printf(\"Howdy mam, username is: %q, message is: %q\\n\", u, m)\n\tfmt.Fprintf(w, \"I am not ready yet, mam\\n\")\n\t// TODO: need to check for post, username and message.\n\t// TODO: need to send the request to slack.\n}", "func Post(ongoing model.Ongoing) {\n\n\turlImage := \"https://shikimori.one\" + ongoing.Anime.Image.Original\n\n\tpathImage := getImageAndSave(urlImage, ongoing.Anime.ID)\n\n\tcmd := exec.Command(\"notify-send\", \"-i\", pathImage, fmt.Sprintf(`%v Вышла серия номер %d`, ongoing.Anime.Russian, ongoing.NextEpisode))\n\n\tcmd.Run()\n}", "func PostMessage(channel, username, text string) (res *http.Response, err error) {\n\tm := Message{\n\t\tChannel: channel,\n\t\tUsername: username,\n\t\tText: text,\n\t}\n\tb, _ := json.Marshal(m)\n\n\treq, err := http.NewRequest(\"POST\", apiURL, bytes.NewBuffer(b))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{}\n\tres, err = client.Do(req)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\treturn\n}", "func sendMessage(api *slack.Client, ephemeral bool, channel, userID, text, threadTimeStamp, wsToken string, attachments []slack.Attachment) error {\n\t// send ephemeral message is indicated\n\tif ephemeral {\n\t\tvar opt slack.MsgOption\n\t\tif len(attachments) > 0 {\n\t\t\topt = slack.MsgOptionAttachments(attachments[0]) // only handling attachments messages with single attachments\n\t\t\t_, err := api.PostEphemeral(channel, userID, opt)\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\t// send standard message\n\tpmp := slack.PostMessageParameters{\n\t\tAsUser: true,\n\t\tThreadTimestamp: threadTimeStamp,\n\t}\n\t// check if message was a link to set link attachment\n\tif text != \"\" && strings.Contains(text, \"http\") {\n\t\tif isValidURL(text) {\n\t\t\tif len(attachments) > 0 {\n\t\t\t\tattachments[0].ImageURL = text\n\t\t\t} else {\n\t\t\t\tattachments = []slack.Attachment{\n\t\t\t\t\t{\n\t\t\t\t\t\tImageURL: text,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tattachments[0].ImageURL = text\n\t\t\t}\n\t\t}\n\t}\n\t// include attachments if any\n\tif len(attachments) > 0 {\n\t\tpmp.Attachments = attachments\n\t}\n\t_, _, err := api.PostMessage(channel, text, pmp)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func PostActionMessage(webhook, cN, cID, action string, errType bool) {\n\tif errType {\n\t\tIO.Println(fmt.Sprintf(\"\\t🔥 Failed to %s container with ID: %s\", action, cID))\n\t} else {\n\t\tIO.Println(fmt.Sprintf(\"\\t🚒 %s container with ID: %s\", action, cID))\n\t}\n\n\tif webhook != \"\" {\n\t\tvar text, color string\n\t\tif errType {\n\t\t\ttext = fmt.Sprintf(\"Failed to %s container `%s`\", action, cN)\n\t\t\tcolor = \"warning\"\n\t\t} else {\n\t\t\ttext = fmt.Sprintf(\"%s container `%s`\", action, cN)\n\t\t\tcolor = \"good\"\n\t\t}\n\t\tslack.PostWebhook(webhook, &slack.WebhookMessage{\n\t\t\tUsername: Username,\n\t\t\tIconEmoji: IconEmoji,\n\t\t\tAttachments: []slack.Attachment{\n\t\t\t\tslack.Attachment{\n\t\t\t\t\tTitle: fmt.Sprintf(\":package: Container %s\", cN),\n\t\t\t\t\tText: text,\n\t\t\t\t\tFooter: cID,\n\t\t\t\t\tColor: color,\n\t\t\t\t\tMarkdownIn: []string{\"text\"},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\n}", "func testPostWebhook(p bytes.Buffer) {\n\tresp, _ := http.PostForm(\n\t\t\"\",\n\t\turl.Values{\"payload_json\": {p.String()}},\n\t)\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\tfmt.Println(string(body))\n}", "func PostMessage(c *gin.Context) {\n\tbody := c.Request.Body\n\n\tvalue, err := ioutil.ReadAll(body)\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t}\n\tc.JSON(200, gin.H{\n\t\t\"message\": string(value),\n\t})\n}", "func (s *SlackNotify) Send(v ...interface{}) error {\n\tif s.URL == \"\" {\n\t\treturn nil\n\t}\n\tpayload, err := json.Marshal(slackMsg{Text: fmt.Sprint(s.prefix, v)})\n\tif err != nil {\n\t\treturn err\n\t}\n\treq, _ := http.NewRequest(\"POST\", s.URL, bytes.NewBuffer(payload))\n\treq.Header.Add(\"content-type\", \"application/json\")\n\tres, err := s.c.Do(req)\n\tdefer res.Body.Close()\n\tif res.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"Error posting to slack\")\n\t}\n\treturn nil\n}", "func SendSlackWebhook(message string) {\n\twebhookURL := getWebhookURLFromEnvironmentVariable()\n\tif webhookURL == \"none\" {\n\t\treturn\n\t}\n\tslackBody, _ := json.Marshal(slackRequestBody{Text: message})\n\n\treq, err := http.NewRequest(http.MethodPost, webhookURL, bytes.NewBuffer(slackBody))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{Timeout: 10 * time.Second}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(resp.Body)\n\tif buf.String() != \"ok\" {\n\t\tfmt.Println(errors.New(\"Non-ok response returned from Slack\"))\n\t}\n}", "func notifyAdmin(token, channelID, message string) {\n\n\tif token == \"\" || channelID == \"\" {\n\t\treturn\n\t}\n\n\tapi := slack.New(token)\n\n\t// If you set debugging, it will log all requests to the console\n\t// Useful when encountering issues\n\tapi.SetDebug(true)\n\n\t// Ref: https://github.com/nlopes/slack/blob/master/examples/messages/messages.go#L26:2\n\tparams := slack.PostMessageParameters{}\n\tchannelID, timestamp, err := api.PostMessage(channelID, message, params)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"Message successfully sent to channel %s at %s\", channelID, timestamp)\n\n}", "func registerMessage(template, channelID, username, filename, url string) error {\n\tmessage := fmt.Sprintf(template, username, filename, url)\n\t_, _, err := slackClient.PostMessage(channelID, message, slackParams)\n\tcheckError(err)\n\treturn err\n}", "func endpointHandler(w http.ResponseWriter, r *http.Request) {\n\tvar data support.TelegramObject\n\tdefer r.Body.Close()\n\n\terr := data.DecodeJSON(r.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tif debug {\n\t\tlog.Printf(\"got message -> %+v\\n\", data)\n\t}\n\n\tif data.Message.Chat.ID == botSession.ChatID {\n\t\tlog.Println(\"got URL from command /post on group \", botSession.GroupHandle, \"posting on reddit...\")\n\n\t\turl, err := splitPostCommand(data.Message.Text)\n\n\t\tif debug {\n\t\t\tlog.Println(\"splitted url:\", url)\n\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tvalidURL, err := support.ValidateURL(url)\n\t\tif err != nil {\n\t\t\tif err = data.ReplyBackToChat(\"Invalid URL :(\"); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tif debug {\n\t\t\tlog.Println(\"validated url:\", validURL)\n\t\t}\n\n\t\tredditSession, err := reddit.NewSession(redditUsername, redditPassword, redditClientID, redditClientSecret)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tif err = redditSession.Post(validURL); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tif err = data.ReplyBackToChat(\"Posted!\"); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t}\n}", "func PostMessage(c *gin.Context) {\n\tmessage := c.PostForm(\"message\")\n\tname := c.DefaultPostForm(\"name\", \"Guest\")\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"message\": message,\n\t\t\"name\": name,\n\t})\n}", "func sendVideoMessage(slackClient *slack.RTM, slackChannel string) {\n\tpostMessageParameters:= slack.PostMessageParameters{UnfurlMedia: true, UnfurlLinks: true}\n\tslackClient.PostMessage(slackChannel, slack.MsgOptionText(\"https://www.youtube.com/watch?v=Rh64GkNRDNU&ab_channel=MarySpender\", true), slack.MsgOptionPostMessageParameters(postMessageParameters))\n}", "func (mm *mattermostMessage) handleMessage(b *MMBot) {\n\tpost := model.PostFromJson(strings.NewReader(mm.Event.Data[\"post\"].(string)))\n\tchannelType := mmChannelType(mm.Event.Data[\"channel_type\"].(string))\n\tif channelType == mmChannelPrivate || channelType == mmChannelPublic {\n\t\t// Message posted in a channel\n\t\t// Serve only if starts with mention\n\t\tif !strings.HasPrefix(post.Message, \"@\"+BotName+\" \") {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Check if message posted in authenticated channel\n\tif mm.Event.Broadcast.ChannelId == b.getChannel().Id {\n\t\tmm.IsAuthChannel = true\n\t}\n\tlogging.Logger.Debugf(\"Received mattermost event: %+v\", mm.Event.Data)\n\n\t// Trim the @BotKube prefix if exists\n\tmm.Request = strings.TrimPrefix(post.Message, \"@\"+BotName+\" \")\n\n\te := execute.NewDefaultExecutor(mm.Request, b.AllowKubectl, b.ClusterName, b.ChannelName, mm.IsAuthChannel)\n\tmm.Response = e.Execute()\n\tmm.sendMessage()\n}", "func (c *ChanPost) slckSend(rtm *slack.RTM) {\n\tlog.Println(\"Message from bot received\")\n\tmessage := \"Infra Announce: \" + c.text + \" \" +\n\t\ttime.Unix(int64(c.date), 0).Format(\"Mon Jan _2 15:04\") +\n\t\t\"(from telegram channel)\"\n\trtm.SendMessage(rtm.NewOutgoingMessage(message, config.sChat))\n}", "func (a *App) postMessage(w http.ResponseWriter, r *http.Request) {\n\tm := message{}\n\tbody, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\tSendJSON(w, message{message: \"Error reading post message\"}, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr = m.postMessage(a.DB, string(body))\n\n\tif err != nil {\n\t\tSendJSON(w, message{message: \"DB post error\"}, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tSendJSON(w, m, http.StatusOK)\n}", "func (r *PostingBot) Post(p *reddit.Post) error {\n\tswitch {\n\tcase p.NSFW:\n\t\t// We hide NSFW content\n\t\tmsg := tgbotapi.NewMessage(r.Config.ChatID, fmt.Sprintf(\"Uh oh, nsfw content! 🔞\\n%s\", p.URL))\n\t\tmsg.DisableWebPagePreview = true\n\t\tmsg.ReplyMarkup = utility.SetupInlineKeyboard(p.Subreddit, p.Permalink)\n\t\tr.TBot.Send(msg)\n\tcase p.Media.RedditVideo.IsGIF:\n\t\tmsg := tgbotapi.NewDocumentUpload(r.Config.ChatID, p.URL)\n\t\tmsg.ReplyMarkup = utility.SetupInlineKeyboard(p.Subreddit, p.Permalink)\n\t\tr.TBot.Send(msg)\n\tcase strings.Contains(p.URL, \".jpg\") || strings.Contains(p.URL, \".png\"):\n\t\tmsg := tgbotapi.NewPhotoUpload(r.Config.ChatID, \"\")\n\t\tmsg.FileID = p.URL\n\t\tmsg.UseExisting = true\n\t\tmsg.ReplyMarkup = utility.SetupInlineKeyboard(p.Subreddit, p.Permalink)\n\t\tr.TBot.Send(msg)\n\tdefault:\n\t\tif r.Config.VideoDownload {\n\t\t\tfileName, err := video.GetVideo(p.URL)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\tvideoPath := r.Config.DownloadPath + fileName\n\n\t\t\tmsg := tgbotapi.NewVideoUpload(r.Config.ChatID, videoPath)\n\t\t\tmsg.ReplyMarkup = utility.SetupInlineKeyboard(p.Subreddit, p.Permalink)\n\n\t\t\tr.TBot.Send(msg)\n\t\t\tos.Remove(videoPath)\n\t\t} else {\n\t\t\tmsg := tgbotapi.NewMessage(r.Config.ChatID, p.URL)\n\t\t\tr.TBot.Send(msg)\n\t\t}\n\t}\n\treturn nil\n}", "func (b *Bslack) sendWebhook(msg config.Message) error {\n\t// Skip events.\n\tif msg.Event != \"\" {\n\t\treturn nil\n\t}\n\n\tif b.GetBool(useNickPrefixConfig) {\n\t\tmsg.Text = msg.Username + msg.Text\n\t}\n\n\tif msg.Extra != nil {\n\t\t// This sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE.\n\t\tfor _, rmsg := range helper.HandleExtra(&msg, b.General) {\n\t\t\trmsg := rmsg // scopelint\n\t\t\ticonURL := config.GetIconURL(&rmsg, b.GetString(iconURLConfig))\n\t\t\tmatterMessage := matterhook.OMessage{\n\t\t\t\tIconURL: iconURL,\n\t\t\t\tChannel: msg.Channel,\n\t\t\t\tUserName: rmsg.Username,\n\t\t\t\tText: rmsg.Text,\n\t\t\t}\n\t\t\tif err := b.mh.Send(matterMessage); err != nil {\n\t\t\t\tb.Log.Errorf(\"Failed to send message: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\t// Webhook doesn't support file uploads, so we add the URL manually.\n\t\tfor _, f := range msg.Extra[\"file\"] {\n\t\t\tfi, ok := f.(config.FileInfo)\n\t\t\tif !ok {\n\t\t\t\tb.Log.Errorf(\"Received a file with unexpected content: %#v\", f)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif fi.URL != \"\" {\n\t\t\t\tmsg.Text += \" \" + fi.URL\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we have native slack_attachments add them.\n\tvar attachs []slack.Attachment\n\tfor _, attach := range msg.Extra[sSlackAttachment] {\n\t\tattachs = append(attachs, attach.([]slack.Attachment)...)\n\t}\n\n\ticonURL := config.GetIconURL(&msg, b.GetString(iconURLConfig))\n\tmatterMessage := matterhook.OMessage{\n\t\tIconURL: iconURL,\n\t\tAttachments: attachs,\n\t\tChannel: msg.Channel,\n\t\tUserName: msg.Username,\n\t\tText: msg.Text,\n\t}\n\tif msg.Avatar != \"\" {\n\t\tmatterMessage.IconURL = msg.Avatar\n\t}\n\tif err := b.mh.Send(matterMessage); err != nil {\n\t\tb.Log.Errorf(\"Failed to send message via webhook: %#v\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Slack) Send(color, msg string, v ...interface{}) error {\n\tb, err := json.Marshal(&payload{\n\t\tChannel: s.channel,\n\t\tUsername: s.username,\n\t\tIconURL: s.iconURL,\n\t\tAttachments: []attachment{\n\t\t\t{\n\t\t\t\tColor: color,\n\t\t\t\tText: fmt.Sprintf(msg, v...),\n\t\t\t},\n\t\t},\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.infof(\"payload: %s\", b)\n\tr, err := http.Post(s.webhookURL, \"application/json\", bytes.NewReader(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.infof(\"response: %s\", r.Status)\n\n\tif r.StatusCode >= 400 {\n\t\treturn &ResponseError{r}\n\t}\n\treturn nil\n}", "func (sn *SlackMessage) Notify(slackURL string) error {\n\tbp, err := json.Marshal(sn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = http.Post(slackURL, \"application/json\", bytes.NewBuffer(bp))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (h *slackNotificationPostHandler) Run(ctx context.Context) gimlet.Responder {\n\tattachments := []message.SlackAttachment{}\n\tfor _, a := range h.APISlack.Attachments {\n\t\ti, err := a.ToService()\n\t\tif err != nil {\n\t\t\treturn gimlet.MakeJSONInternalErrorResponder(errors.Wrap(err, \"API error converting from model.APISlackAttachment to message.SlackAttachment\"))\n\t\t}\n\t\tattachment, ok := i.(*message.SlackAttachment)\n\t\tif !ok {\n\t\t\treturn gimlet.MakeJSONErrorResponder(gimlet.ErrorResponse{\n\t\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\t\tMessage: fmt.Sprintf(\"Unexpected type %T for message.SlackAttachment\", i),\n\t\t\t})\n\t\t}\n\t\tattachments = append(attachments, *attachment)\n\t}\n\ttarget := utility.FromStringPtr(h.APISlack.Target)\n\tmsg := utility.FromStringPtr(h.APISlack.Msg)\n\n\th.composer = message.NewSlackMessage(level.Notice, target, msg, attachments)\n\ts, err := h.environment.GetSender(evergreen.SenderSlack)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONInternalErrorResponder(errors.Wrap(err, \"Error fetching sender key for evergreen.SenderSlack\"))\n\t}\n\n\th.sender = s\n\th.sender.Send(h.composer)\n\n\treturn gimlet.NewJSONResponse(struct{}{})\n}", "func send(api *slack.Client, message models.Message, bot *models.Bot) {\n\tusers, err := getSlackUsers(api, message)\n\tif err != nil {\n\t\tbot.Log.Errorf(\"Problem sending message: %s\", err.Error())\n\t}\n\tif message.DirectMessageOnly {\n\t\terr := handleDirectMessage(api, message, bot)\n\t\tif err != nil {\n\t\t\tbot.Log.Errorf(\"Problem sending message: %s\", err.Error())\n\t\t}\n\t} else {\n\t\terr := handleNonDirectMessage(api, users, message, bot)\n\t\tif err != nil {\n\t\t\tbot.Log.Errorf(\"Problem sending message: %s\", err.Error())\n\t\t}\n\t}\n}", "func (m *Module) PostC(channel, txt string, params *PostMessageParameters) {\n\tvar p PostMessageParameters\n\tif params != nil {\n\t\tp = *params\n\t}\n\tif m.LogMessages {\n\t\tm.Logger.Infof(\"[%s] %s\", m.config.SlackConfig.Channel, txt)\n\t}\n\t_, _, err := m.client.PostMessage(channel, txt, p)\n\tif err != nil {\n\t\tm.Logger.Error(errors.Wrap(err))\n\t}\n}", "func SendSlack(temp string, data interface{}) error {\n\tmessageLock.Lock()\n\tbuf := new(bytes.Buffer)\n\tslackTemp, _ := template.New(\"slack\").Parse(temp)\n\tslackTemp.Execute(buf, data)\n\tslackMessages = append(slackMessages, buf.String())\n\tmessageLock.Unlock()\n\treturn nil\n}", "func SendSlackNotification(title string, cobraCmd *cobra.Command, output string, mgr credential.Manager) error {\n\tuserID, err := mgr.GetUserIDByParseToken()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"while parsinng oauth2 token\")\n\t}\n\n\tslackhookUrl := GlobalOpts.SlackAPIURL()\n\ttext_msg := \"New \" + title + \" is triggerred on \" + getClusterType() + \" by \" + userID\n\ttriggeredCmd := revertUpgradeOpts(title, cobraCmd)\n\tattachment := Attachment{\n\t\tColor: SLACK_COLOR,\n\t\tText: triggeredCmd + \"\\n\" + output,\n\t}\n\n\tslackBody, _ := json.Marshal(SlackRequestBody{Text: text_msg, Icon_emoji: ICON_EMOJI, Username: SLACK_USER_NAME,\n\t\tAttachments: []Attachment{attachment}})\n\treq, err := http.NewRequest(http.MethodPost, slackhookUrl, bytes.NewBuffer(slackBody))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\tclient := &http.Client{Timeout: 10 * time.Second}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Drain response body and close, return error to context if there isn't any.\n\tdefer func() {\n\t\tderr := drainResponseBody(resp.Body)\n\t\tif err == nil {\n\t\t\terr = derr\n\t\t}\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil {\n\t\t\terr = cerr\n\t\t}\n\t}()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"calling %s returned %s status\", slackhookUrl, resp.Status)\n\t}\n\n\tbodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while decoding slack response body\")\n\t}\n\tbodyString := string(bodyBytes)\n\tif bodyString != \"ok\" {\n\t\treturn fmt.Errorf(\"non-ok response returned from Slack\")\n\t}\n\treturn nil\n}", "func (m *MatterMail) postMessage(client *model.Client, channelID string, message string, fileIds []string) error {\n\tpost := &model.Post{ChannelId: channelID, Message: message}\n\n\tif len(fileIds) > 0 {\n\t\tpost.FileIds = fileIds\n\t}\n\n\tres, err := client.CreatePost(post)\n\tif res == nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func SlackSendMsg(slackAPI *slack.Client, MsgText string) error {\n\tif _, _, err := slackAPI.PostMessage(viper.GetString(\"slack_channel_id\"), slack.MsgOptionText(MsgText, false)); err != nil {\n\t\tlog.Errorf(\"[ERROR] %s\\n\", err)\n\t\treturn err\n\t}\n\tlog.Infof(\"[Slack] Send %s\", MsgText)\n\treturn nil\n}", "func (c *Consumer) CreatePost(ctx context.Context, m gosqs.Message) error {\n\tvar p Post\n\tif err := m.Decode(&p); err != nil {\n\t\treturn err\n\t}\n\n\t// send a message to the same queue\n\tc.MessageSelf(ctx, \"some_new_message\", &p)\n\n\t//forward the message to another queue\n\tc.Message(ctx, \"notification-worker\", \"some_new_message\", &p)\n\n\treturn nil\n}", "func (c *Client) postMessage(ctx context.Context, username, iconurl, channel, text string) error {\n\tif iconurl != \"\" {\n\t\ticonurl = \"icon_url=\" + iconurl\n\t}\n\tvar resp ResponseHeader\n\treturn rpc(ctx, c, &resp, \"chat.postMessage\",\n\t\t\"username=\"+username,\n\t\ticonurl,\n\t\t\"as_user=false\",\n\t\t\"channel=\"+channel,\n\t\t\"text=\"+text)\n}", "func (post *Post) Send(app *state.AppState) error {\n\tsession := app.MgoSession.Clone()\n\tdefer session.Close()\n\n\tchannel, err := GetChannelByID(app, post.ChannelID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbot, err := GetBotById(app, channel.BotID.Hex())\n\tif err != nil {\n\t\treturn err\n\t}\n\tbotAPI, err := tg.NewBotAPI(bot.Token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcoll := session.DB(dbName).C(\"posts\")\n\tchange := mgo.Change{\n\t\tUpdate: bson.M{\"$set\": bson.M{\"isSent\": true}},\n\t\tReturnNew: false,\n\t}\n\tvar prevPostState Post\n\t_, err = coll.FindId(post.ID).Apply(change, &prevPostState)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// return if post already processed by something\n\tif prevPostState.IsSent {\n\t\treturn nil\n\t}\n\n\tmsg := tg.NewMessage(channel.Chat.ID, post.Text)\n\tmsg.ReplyMarkup = post.BuildReplyMarkup()\n\tmsg.DisableNotification = !post.WithNotification\n\tmsg.DisableWebPagePreview = !post.WithPreview\n\tif post.Mode == tg.ModeMarkdown {\n\t\tmsg.ParseMode = tg.ModeMarkdown\n\t} else {\n\t\tmsg.ParseMode = \"\"\n\t}\n\n\t_, err = botAPI.Send(msg)\n\tif err != nil {\n\t\tisInvalidSyntax := strings.Contains(err.Error(), \"can't parse entities in message text\")\n\n\t\t// If syntax incorrect mark as sent to prevent retrying\n\t\tset := bson.M{\"isSent\": false, \"error\": \"\"}\n\t\tif isInvalidSyntax {\n\t\t\tset = bson.M{\"isSent\": true, \"error\": \"Invalid markdown syntax\"}\n\t\t}\n\n\t\tif err := coll.UpdateId(post.ID, bson.M{\"$set\": set}); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *SlcLogger) sendNotification(logLevel logLevel, color string, message interface{}, titleParam []string) error {\n\n\tvar text string\n\tif t, ok := message.(error); ok {\n\t\ttext = t.Error()\n\t} else if t, ok := message.(string); ok {\n\t\ttext = t\n\t} else {\n\t\treturn &SlcErr{errors.New(\"the type of message parameter should be string or error\"), 0}\n\t}\n\n\tif logLevel < s.LogLevel {\n\t\treturn nil\n\t}\n\tslackChannel := s.getTargetChannel(logLevel)\n\n\tpayload, err := s.buildPayload(slackChannel, color, text, titleParam)\n\tif err != nil {\n\t\treturn &SlcErr{err, 0}\n\t}\n\n\treq, err := http.NewRequest(\"POST\", s.WebHookURL, bytes.NewBuffer(payload))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tif err != nil {\n\t\treturn &SlcErr{err, 0}\n\t}\n\tctx := context.Background()\n\treq.WithContext(ctx)\n\n\tresp, err := http.DefaultClient.Do(req)\n\n\tdefer func() {\n\t\tif resp != nil {\n\t\t\t_, _ = io.Copy(ioutil.Discard, resp.Body)\n\t\t\t_ = resp.Body.Close()\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn &SlcErr{err, 0}\n\t}\n\n\tif resp.StatusCode >= 400 {\n\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\treturn &SlcErr{errors.New(string(body)), resp.StatusCode}\n\t}\n\n\treturn nil\n}", "func (m *Slack) Send(mes *message.Message) error {\n\topts := createSlackMessageOptions(mes.Text, mes.Image, mes.Fields, mes.Level)\n\n\t_channel, _timestamp, _text, err := m.api.SendMessage(m.channel, opts...)\n\n\tm.logger.Debug(\"send slack message\",\n\t\tzap.String(\"channel\", _channel),\n\t\tzap.String(\"timestamp\", _timestamp),\n\t\tzap.String(\"text\", _text),\n\t\tzap.Error(err),\n\t)\n\n\treturn err\n}", "func sendEchoMessage(slackClient *slack.RTM, message, slackChannel string) {\n\tsplitMessage := strings.Fields(strings.ToLower(message))\n\tslackClient.SendMessage(slackClient.NewOutgoingMessage(strings.Join(splitMessage[1:], \" \"), slackChannel))\n}", "func (s *Slack) SendMessage(message string) error {\n\t_, _, err := s.client.PostMessage(s.channelID, slack.MsgOptionText(message, false))\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"client.PostMessage(): failed to post message\")\n\t}\n\n\treturn nil\n}", "func (c *Client) WebhookPost(falcopayload types.FalcoPayload) {\n\terr := c.Post(falcopayload)\n\tif err != nil {\n\t\tc.Stats.Webhook.Add(Error, 1)\n\t\tc.PromStats.Outputs.With(map[string]string{\"destination\": \"webhook\", \"status\": Error}).Inc()\n\t} else {\n\t\tc.Stats.Webhook.Add(OK, 1)\n\t\tc.PromStats.Outputs.With(map[string]string{\"destination\": \"webhook\", \"status\": OK}).Inc()\n\t}\n\n\tc.Stats.Webhook.Add(Total, 1)\n}", "func (r *searchBot) Post(p *reddit.Post) error {\n\tif strings.Contains(p.SelfText, r.searchText) {\n\t\t<-time.After(2 * time.Second) // Buffer\n\t\tpost := datamanager.PostMessage{URL: p.URL, Text: p.SelfText}\n\t\tmsg, err := json.Marshal(post)\n\t\tif err != nil {\n\t\t\tlogger.Error(fmt.Sprintf(\"Error converting to JSON for Reddit post %s\", p.URL))\n\t\t}\n\t\tpubErr := r.distClient.Channel.Publish(\n\t\t\tconfig.DefaultExchange(),\n\t\t\tr.distClient.Queue.Name,\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\tdistributed.PublishBody(msg),\n\t\t)\n\t\tif pubErr != nil {\n\t\t\tlogger.Error(fmt.Sprintf(\"Error publishing message to queue %s\", r.distClient.Queue.Name))\n\t\t}\n\t}\n\treturn nil\n}", "func Send(config config.Config, text string) {\n\tapi := slack.New(config.Slack.Token)\n\tparams := slack.PostMessageParameters{}\n\tparams.IconEmoji = config.Slack.IconEmoji\n\tparams.Username = config.Slack.Username\n\tchannelID, timestamp, err := api.PostMessage(config.Slack.Channel, text, params)\n\tif err != nil {\n\t\tfmt.Printf(\"%s\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"Message successfully sent to channel %s at %s\", channelID, timestamp)\n}", "func (player *Athelete) MediaPost(t, m string, v bool) {\n\tMessage := &Message{\n\t\tFrom: player.GetName(),\n\t\tTitle: t,\n\t\tMessage: m,\n\t\tVisible: v,\n\t}\n\tif v == true {\n\t\t//IMPLEMENT LEAGUE BOARD\n\t\tplayer.League.MessBoard = append(player.League.MessBoard, Message)\n\t} else if v == false {\n\t\tplayer.Team.MessBoard = append(player.Team.MessBoard, Message)\n\t}\n\n}", "func sendNotificationToSlack(payloadJSONEncoded []byte, response chan<- *http.Response) {\n\tfmt.Println(\"Sending notification to Slack...\")\n\n\t// Récupération des paramètres\n\t// ---------------------------\n\thookURL = config.SlackHookURL\n\thookPayload = config.SlackHookPayload\n\n\t// Envoi de la requête\n\t// -------------------\n\tresponse <- sendNotificationToApplication(hookURL, hookPayload, payloadJSONEncoded)\n}", "func (s *Slack) Send(pending []reviewit.MergeRequest) error {\n\ts.pending = pending\n\ts.build()\n\tbuf, err := json.Marshal(&s.msg)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failure to Marshal\")\n\t}\n\treq, _ := http.NewRequest(\"POST\", s.WebhookURL, bytes.NewReader(buf))\n\tif _, err := http.DefaultClient.Do(req); err != nil {\n\t\treturn errors.WithMessage(err, \"slack post message failed\")\n\t}\n\treturn nil\n}", "func (s DialogflowServer) DialogPostMessage(w http.ResponseWriter, r *http.Request) {\r\n\tvars := mux.Vars(r)\r\n\tsessionID := vars[\"sessionID\"]\r\n\r\n\tlog.Printf(\"Route: %s , SessionID: %s\\n\", r.URL, sessionID)\r\n\r\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\r\n\tif r.Method == http.MethodOptions {\r\n\t\treturn\r\n\t}\r\n\r\n\tbody, err := ioutil.ReadAll(r.Body)\r\n\tif err != nil {\r\n\t\thttp.Error(w, \"Error reading request body\",\r\n\t\t\thttp.StatusInternalServerError)\r\n\t}\r\n\r\n\tvar m DialogflowMessage\r\n\terr = json.Unmarshal(body, &m)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\trequest := dialogflowpb.DetectIntentRequest{\r\n\t\tSession: fmt.Sprintf(\"projects/%s/agent/sessions/%s\", s.projectID, sessionID),\r\n\t\tQueryInput: &dialogflowpb.QueryInput{\r\n\t\t\tInput: &dialogflowpb.QueryInput_Text{\r\n\t\t\t\tText: &dialogflowpb.TextInput{\r\n\t\t\t\t\tText: m.Message,\r\n\t\t\t\t\tLanguageCode: s.lang,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t},\r\n\t}\r\n\r\n\tresponse, err := s.sessionClient.DetectIntent(s.ctx, &request)\r\n\tif err != nil {\r\n\t\tlog.Fatalf(\"Error in communication with Dialogflow %s\", err.Error())\r\n\t\treturn\r\n\t}\r\n\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\tjson.NewEncoder(w).Encode(response)\r\n}", "func PostWebhooks(diagnostic structs.DiagnosticSpec, status string, promotestatus string, isCron bool, result structs.ResultSpec) error {\n\t// No configured webhook destinations\n\tif diagnostic.WebhookURLs == \"\" {\n\t\treturn nil\n\t}\n\n\t// Assemble the webhook payload\n\tpayload := WebhookPayload{\n\t\tJob: diagnostic.JobSpace + \"/\" + diagnostic.Job,\n\t\tTarget: diagnostic.App + \"-\" + diagnostic.Space,\n\t\tStatus: status,\n\t\tIsPreview: diagnostic.IsPreview,\n\t\tIsCron: isCron,\n\t\tLogURL: os.Getenv(\"LOG_URL\") + \"/logs/\" + diagnostic.RunID,\n\t\tKibanaURL: os.Getenv(\"KIBANA_URL\") + \"/app/kibana#/doc/logs/logs/run/?id=\" + diagnostic.RunID,\n\t\tArtifactsURL: os.Getenv(\"ARTIFACTS_URL\") + \"/v1/artifacts/\" + diagnostic.RunID + \"/\",\n\t\tRerunURL: os.Getenv(\"RERUN_URL\") + \"?space=\" + diagnostic.Space + \"&app=\" + diagnostic.App + \"&action=\" + diagnostic.Action + \"&result=\" + diagnostic.Result + \"&releaseid=\" + diagnostic.ReleaseID + \"&buildid=\" + diagnostic.BuildID,\n\t\tCommitAuthor: diagnostic.CommitAuthor,\n\t\tStartTime: result.Payload.StartTime,\n\t\tStopTime: result.Payload.StopTime,\n\t\tRunDurationMs: result.Payload.BuildTimeMillis,\n\t\tPromotionResults: PromotionResults{},\n\t}\n\n\tif diagnostic.GithubVersion != \"\" {\n\t\tpayload.GithubVersion = diagnostic.GithubVersion\n\t}\n\n\tif status != \"success\" {\n\t\tpayload.PromotionResults.Message = \"No promotion triggered - tests not successful\"\n\t} else if diagnostic.PipelineName == \"manual\" {\n\t\tpayload.PromotionResults.Message = \"No promotion triggered - set to manual\"\n\t\tpayload.PromotionResults.Pipeline = diagnostic.PipelineName\n\t} else {\n\t\tpayload.PromotionResults.Message = \"Promotion was triggered with result \" + promotestatus\n\t\tpayload.PromotionResults.Status = promotestatus\n\t\tpayload.PromotionResults.From = diagnostic.TransitionFrom\n\t\tpayload.PromotionResults.To = diagnostic.TransitionTo\n\t\tpayload.PromotionResults.Pipeline = diagnostic.PipelineName\n\t}\n\n\t// Send message to each hook URL\n\tfor _, hookURL := range strings.Split(diagnostic.WebhookURLs, \",\") {\n\t\tpayloadBytes, err := json.Marshal(payload)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\n\t\tif !strings.HasPrefix(hookURL, \"http://\") && !strings.HasPrefix(hookURL, \"https://\") {\n\t\t\thookURL = \"https://\" + hookURL\n\t\t}\n\n\t\treq, err := http.NewRequest(\"POST\", hookURL, bytes.NewBuffer(payloadBytes))\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\t\treq.Header.Add(\"Content-type\", \"application/json\")\n\n\t\tclient := http.Client{}\n\t\t_, err = client.Do(req)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\n\t\t// If we ever want to save the result and do something with it\n\t\t// defer resp.Body.Close()\n\t\t// bodybytes, err := ioutil.ReadAll(resp.Body)\n\t\t// if err != nil {\n\t\t// \tfmt.Println(err)\n\t\t// \treturn err\n\t\t// }\n\t\t// fmt.Println(string(bodybytes))\n\t\t// fmt.Println(resp.status)\n\t}\n\treturn nil\n}", "func makePost(client *mm.Client, channelId string, message string) *mm.Post {\n\tpost := &mm.Post{}\n\tpost.ChannelId = channelId\n\tpost.Message = message\n\treturn post\n}", "func (s *SlackService) SendMessage(channel string, message string) {\n\t// https://godoc.org/github.com/nlopes/slack#PostMessageParameters\n\tpostParams := slack.PostMessageParameters{\n\t\tAsUser: true,\n\t}\n\n\t// https://godoc.org/github.com/nlopes/slack#Client.PostMessage\n\ts.Client.PostMessage(channel, message, postParams)\n}", "func SendSlackNotification(webhookURL string, msg data.SlackRequestBody) error {\n\n\tslackBody, _ := json.Marshal(msg)\n\n\tlog.Printf(\"Sending message to Slack:\\n %v\\n\", string(slackBody))\n\n\treq, err := http.NewRequest(http.MethodPost, webhookURL, bytes.NewBuffer(slackBody))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tclient := &http.Client{Timeout: 10 * time.Second}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(resp.Body)\n\tif buf.String() != \"ok\" {\n\t\treturn errors.New(\"Non-ok response returned from Slack\")\n\t}\n\treturn nil\n}", "func echoMessage(slackClient *slack.RTM, message, slackChannel string) {\n\tsplitMessage := strings.Fields(strings.ToLower(message))\n\n\tslackClient.SendMessage(slackClient.NewOutgoingMessage(strings.Join(splitMessage[1:], \" \"), slackChannel))\n}", "func (d *DingTalkClient) SendMessage(msg DingTalkMessage) error {\n\n\tvar message string\n\tswitch msg.Type {\n\tcase \"text\":\n\t\tmessage = fmt.Sprintf(`{\"msgtype\": \"text\",\"text\": {\"content\": \"监控报警: %s\"}}`, msg.Message)\n\tcase \"markdown\":\n\t\tmessage = fmt.Sprintf(`{\"msgtype\": \"markdown\",\"markdown\":{\"title\": 监控报警: \"%s\", \"text\": \"%s\"}}`, msg.Title, msg.Message)\n\tdefault:\n\t\tmessage = fmt.Sprintf(`{\"msgtype\": \"text\",\"text\": {\"content\": \"监控报警: %s\"}}`, msg.Message)\n\t}\n\n\tclient := &http.Client{}\n\trequest, _ := http.NewRequest(\"POST\", d.RobotURL, bytes.NewBuffer([]byte(message)))\n\trequest.Header.Set(\"Content-type\", \"application/json\")\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"访问钉钉URL(%s) 出错了: %s\", d.RobotURL, err)\n\t}\n\tif response.StatusCode != 200 {\n\t\tbody, _ := ioutil.ReadAll(response.Body)\n\t\treturn fmt.Errorf(\"访问钉钉URL(%s) 出错了: %s\", d.RobotURL, string(body))\n\t}\n\treturn nil\n}", "func (s *Slack) SendEvent(event events.Event) error {\n\tlog.Logger.Info(fmt.Sprintf(\">> Sending to slack: %+v\", event))\n\n\tapi := slack.New(s.Token)\n\tparams := slack.PostMessageParameters{\n\t\tAsUser: true,\n\t}\n\tattachment := slack.Attachment{\n\t\tFields: []slack.AttachmentField{\n\t\t\t{\n\t\t\t\tTitle: \"Kind\",\n\t\t\t\tValue: event.Kind,\n\t\t\t\tShort: true,\n\t\t\t},\n\t\t\t{\n\n\t\t\t\tTitle: \"Name\",\n\t\t\t\tValue: event.Name,\n\t\t\t\tShort: true,\n\t\t\t},\n\t\t},\n\t\tFooter: \"BotKube\",\n\t}\n\n\t// Add timestamp\n\tts := json.Number(strconv.FormatInt(event.TimeStamp.Unix(), 10))\n\tif ts > \"0\" {\n\t\tattachment.Ts = ts\n\t}\n\n\tif event.Namespace != \"\" {\n\t\tattachment.Fields = append(attachment.Fields, slack.AttachmentField{\n\t\t\tTitle: \"Namespace\",\n\t\t\tValue: event.Namespace,\n\t\t\tShort: true,\n\t\t})\n\t}\n\n\tif event.Reason != \"\" {\n\t\tattachment.Fields = append(attachment.Fields, slack.AttachmentField{\n\t\t\tTitle: \"Reason\",\n\t\t\tValue: event.Reason,\n\t\t\tShort: true,\n\t\t})\n\t}\n\n\tif len(event.Messages) > 0 {\n\t\tmessage := \"\"\n\t\tfor _, m := range event.Messages {\n\t\t\tmessage = message + m\n\t\t}\n\t\tattachment.Fields = append(attachment.Fields, slack.AttachmentField{\n\t\t\tTitle: \"Message\",\n\t\t\tValue: message,\n\t\t})\n\t}\n\n\tif event.Action != \"\" {\n\t\tattachment.Fields = append(attachment.Fields, slack.AttachmentField{\n\t\t\tTitle: \"Action\",\n\t\t\tValue: event.Action,\n\t\t})\n\t}\n\n\tif len(event.Recommendations) > 0 {\n\t\trec := \"\"\n\t\tfor _, r := range event.Recommendations {\n\t\t\trec = rec + r\n\t\t}\n\t\tattachment.Fields = append(attachment.Fields, slack.AttachmentField{\n\t\t\tTitle: \"Recommendations\",\n\t\t\tValue: rec,\n\t\t})\n\t}\n\n\t// Add clustername in the message\n\tattachment.Fields = append(attachment.Fields, slack.AttachmentField{\n\t\tTitle: \"Cluster\",\n\t\tValue: s.ClusterName,\n\t})\n\n\tattachment.Color = attachmentColor[event.Level]\n\tparams.Attachments = []slack.Attachment{attachment}\n\n\tchannelID, timestamp, err := api.PostMessage(s.Channel, \"\", params)\n\tif err != nil {\n\t\tlog.Logger.Errorf(\"Error in sending slack message %s\", err.Error())\n\t\treturn err\n\t}\n\n\tlog.Logger.Infof(\"Message successfully sent to channel %s at %s\", channelID, timestamp)\n\treturn nil\n}", "func manageSlack() {\n\tfor msg := range slackRtm.IncomingEvents {\n\t\tfmt.Print(\"Slack Event Received: \")\n\t\tswitch ev := msg.Data.(type) {\n\t\tcase *slack.HelloEvent:\n\t\t\t// Ignore hello\n\t\tcase *slack.ConnectedEvent:\n\t\t\tfmt.Println(\"Infos:\", ev.Info)\n\t\t\tfmt.Println(\"Connection counter:\", ev.ConnectionCount)\n\t\tcase *slack.MessageEvent:\n\t\t\tslackUser, err := slackApi.GetUserInfo(ev.User)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error retrieving slack user: %s\\n\", err)\n\t\t\t} else {\n\t\t\t\tif slackUser.Name != \"mumblerelay\" {\n\t\t\t\t\t//Mumble accepts HTML, Slack (just API; IRC uses plain text) uses their own weird formatting. Lets fix that.\n\t\t\t\t\tvar re = regexp.MustCompile(`<(http[\\$\\+\\!\\*\\'\\(\\)\\,\\?\\=%\\_a-zA-Z0-9\\/\\.:-]*)\\|?(.*)?>`)\n\t\t\t\t\ttext := re.ReplaceAllString(ev.Text, `<a href=\"$1\">$2</a>`)\n\t\t\t\t\ttext = strings.Replace(text, `\"></a>`, `\">Link has no title? I didn't know Slack would even do that...</a>`, -1)\n\t\t\t\t\tmsg := slackUser.Name + \": \" + text\n\t\t\t\t\tmumbleClient.Self.Channel.Send(msg, false)\n\t\t\t\t\tfmt.Println(msg)\n\t\t\t\t}\n\t\t\t}\n\t\tcase *slack.PresenceChangeEvent:\n\t\t\tfmt.Printf(\"Presence Change: %v\\n\", ev)\n\t\tcase *slack.LatencyReport:\n\t\t\tfmt.Printf(\"Current latency: %v\\n\", ev.Value)\n\t\tcase *slack.RTMError:\n\t\t\tfmt.Printf(\"Error: %s\\n\", ev.Error())\n\t\tcase *slack.DisconnectedEvent:\n\t\t\t//Nothing yet...\n\t\tcase *slack.FileCommentEditedEvent:\n\t\t\t//Maybe\n\t\t\tfmt.Printf(\"FileCommentEdited: %v\\n\", msg.Data)\n\t\tcase *slack.FilePublicEvent:\n\t\t\t//Maybe\n\t\t\tfmt.Printf(\"FilePublic: %v\\n\", msg.Data)\n\t\tcase *slack.FileSharedEvent:\n\t\t\t//Maybe\n\t\t\tfmt.Printf(\"FileShared: %v\\n\", msg.Data)\n\t\tcase *slack.ChannelJoinedEvent:\n\t\t\t//Maybe\n\t\t\t//Perhaps when I join a non-configured channel, I complain and leave..\n\t\t\t//Or better yet, enter spy mode; Read history, members and future messages :P\n\t\t\tfmt.Printf(\"ChannelJoined: %v\\n\", msg.Data)\n\t\tcase *slack.ReactionAddedEvent:\n\t\t\t//Maybe\n\t\t\tfmt.Printf(\"ReactionAdded: %v\\n\", msg.Data)\n\t\tcase *slack.MessageTooLongEvent:\n\t\t\t//Maybe\n\t\t\tfmt.Printf(\"MessageTooLong: %v\\n\", msg.Data)\n\t\tcase *slack.FileCommentAddedEvent:\n\t\t\tfmt.Printf(\"File Comment Added: %s: %s\\n\", ev.Comment.User, ev.Comment.Comment)\n\t\tcase *slack.InvalidAuthEvent:\n\t\t\tfmt.Printf(\"Invalid credentials\")\n\t\t\treturn\n\t\tdefault:\n\t\t\t// Ignore other events..\n\t\t\tfmt.Printf(\"Unexpected: %v\\n\", msg.Data)\n\t\t}\n\t}\n}", "func (s *Slack) SendMessage(msg string) error {\n\tlog.Logger.Info(fmt.Sprintf(\">> Sending to slack: %+v\", msg))\n\n\tapi := slack.New(s.Token)\n\tparams := slack.PostMessageParameters{\n\t\tAsUser: true,\n\t}\n\n\tchannelID, timestamp, err := api.PostMessage(s.Channel, msg, params)\n\tif err != nil {\n\t\tlog.Logger.Errorf(\"Error in sending slack message %s\", err.Error())\n\t\treturn err\n\t}\n\n\tlog.Logger.Infof(\"Message successfully sent to channel %s at %s\", channelID, timestamp)\n\treturn nil\n}", "func (bot *SlackBot) sendMessage(msg Message) error {\n\tmsg.ID = atomic.AddUint64(&counter, 1)\n\terr := websocket.JSON.Send(bot.ws, msg)\n\treturn err\n}", "func (cli *chatLogInteral) postInternal(llp LogLineParsed) {\n\n\t// Forward Alert\nSubLoop:\n\tfor _, subs := range cli.subbedToChat {\n\t\t// Check if Channel is Subbed to this Topic\n\t\tfor _, t := range subs.Subbed {\n\t\t\tif t == llp.Cat {\n\t\t\t\tselect {\n\t\t\t\tcase subs.C <- llp:\n\t\t\t\tdefault: // Non blocking\n\t\t\t\t}\n\t\t\t\tcontinue SubLoop\n\t\t\t}\n\t\t}\n\n\t\t// Not Subbed to Topic\n\t}\n}", "func slackMeetup(w http.ResponseWriter, r *http.Request) {\n\ttext := r.FormValue(\"text\")\n\ttrigger := r.FormValue(\"trigger_word\")\n\n\ttext = strings.Replace(text, trigger, \"\", -1)\n\n\tevents := filterEventsByKeyword(text)\n\tvar response string\n\n\tif len(events) > 0 {\n\t\te := events[0]\n\t\tt := time.Unix(0, e.Time*int64(time.Millisecond)).In(time.Local)\n\t\tlayout := \"Jan 2, 2006 at 3:04pm (MST)\"\n\t\tresponse = fmt.Sprint(e.Name, \" | \", t.Format(layout), \" @ \", e.Venue.Name, \" | \", e.EventUrl)\n\t} else {\n\t\tresponse = \"No matching meetup found.\"\n\t}\n\n\tdata := struct {\n\t\tText string `json:\"text\"`\n\t}{response}\n\n\toutput, _ := json.Marshal(data)\n\tlog.Println(string(output))\n\tw.Write(output)\n}", "func postDiscordMessage(session *discordgo.Session, channelID, msg string) {\n\t_, err := session.ChannelMessageSend(channelID, msg)\n\tif err != nil {\n\t\t// See if the error is a common one that we recognize.\n\t\tif err.Error() == msgTooLongErr {\n\t\t\terrMsg := \"The generated message was too long. Discord doesn't let messages that are\" +\n\t\t\t\t\" longer than 2000 characters go through.\"\n\t\t\tsession.ChannelMessageSend(channelID, errMsg)\n\t\t\treturn\n\t\t}\n\t\t// We didn't recognize the error at this point. Post a general response.\n\t\terrMsg := fmt.Sprintf(\"Something went wrong: %v\", err)\n\t\tsession.ChannelMessageSend(channelID, errMsg)\n\t}\n}", "func HandlePostMessage(w http.ResponseWriter, r *http.Request) {\n\tvar res []byte\n\tb, _ := readRequestParams(r.Body)\n\tm, _ := initChannels(b, channels...)\n\terr := sendMessages(m)\n\tif err != nil {\n\t\terr := err.Error()\n\t\tres, _ = json.Marshal(MsgResBody{Sent: false, Error: &err})\n\t} else {\n\t\tres, _ = json.Marshal(MsgResBody{Sent: true, Error: nil})\n\t}\n\n\tw.Write(res)\n}", "func NotifySlack(token string, channelID string, url string) error {\n\tapi := slack.New(token)\n\t_, _, err := api.PostMessage(channelID, slack.MsgOptionText(url, false))\n\treturn err\n}", "func (h *Hookbot) ServePublish(w http.ResponseWriter, r *http.Request) {\n\n\ttopic := Topic(r)\n\n\tvar (\n\t\tbody []byte\n\t\terr error\n\t)\n\n\tbody, err = ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Println(\"Error in ServePublish reading body:\", err)\n\t\thttp.Error(w, \"500 Internal Server Error\",\n\t\t\thttp.StatusInternalServerError)\n\t\treturn\n\t}\n\n\textraMetadata := r.URL.Query()[\"extra-metadata\"]\n\tif len(extraMetadata) > 0 {\n\t\tswitch extraMetadata[0] {\n\t\tcase \"github\":\n\n\t\t\tbody, err = json.Marshal(map[string]interface{}{\n\t\t\t\t\"Signature\": r.Header.Get(\"X-Hub-Signature\"),\n\t\t\t\t\"Event\": r.Header.Get(\"X-GitHub-Event\"),\n\t\t\t\t\"Delivery\": r.Header.Get(\"X-GitHub-Delivery\"),\n\t\t\t\t\"Payload\": body,\n\t\t\t})\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error in ServePublish serializing payload:\", err)\n\t\t\t\thttp.Error(w, \"500 Internal Server Error\",\n\t\t\t\t\thttp.StatusInternalServerError)\n\t\t\t}\n\n\t\tdefault:\n\t\t\thttp.Error(w, \"400 Bad Request (bad ?extra-metadata=)\",\n\t\t\t\thttp.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tlog.Printf(\"Publish %q\", topic)\n\n\tok := h.Publish(Message{Topic: topic, Body: body})\n\n\tif !ok {\n\t\thttp.Error(w, \"Timeout in send\", http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\n\tfmt.Fprintln(w, \"OK\")\n}", "func handleAppMentionEvent(event *slackevents.AppMentionEvent, client *slack.Client) error {\n\n\t// Grab the user name based on the ID of the one who mentioned the bot\n\tuser, err := client.GetUserInfo(event.User)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Check if the user said Hello to the bot\n\ttext := strings.ToLower(event.Text)\n\n\t// Create the attachment and assigned based on the message\n\tattachment := slack.Attachment{}\n\t// Add Some default context like user who mentioned the bot\n\tattachment.Fields = []slack.AttachmentField{\n\t\t{\n\t\t\tTitle: \"Date\",\n\t\t\tValue: time.Now().String(),\n\t\t}, {\n\t\t\tTitle: \"Initializer\",\n\t\t\tValue: user.Name,\n\t\t},\n\t}\n\tif strings.Contains(text, \"hello\") {\n\t\t// Greet the user\n\t\tattachment.Text = fmt.Sprintf(\"Hello %s\", user.Name)\n\t\tattachment.Pretext = \"Greetings\"\n\t\tattachment.Color = \"#4af030\"\n\t} else {\n\t\t// Send a message to the user\n\t\tattachment.Text = fmt.Sprintf(\"How can I help you %s?\", user.Name)\n\t\tattachment.Pretext = \"How can I be of service\"\n\t\tattachment.Color = \"#3d3d3d\"\n\t}\n\t// Send the message to the channel\n\t// The Channel is available in the event message\n\t_, _, err = client.PostMessage(event.Channel, slack.MsgOptionAttachments(attachment))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to post message: %w\", err)\n\t}\n\treturn nil\n}", "func (s *Slack) Message(msg string, v ...interface{}) error {\n\treturn s.Send(\"\", msg, v...)\n}", "func (handler *MessageHandler) PostMessage(w http.ResponseWriter, r *http.Request) {\n\ttokenString := r.Header.Get(\"Authorization\")\n\n\tvar message entities.Message\n\terr := json.NewDecoder(r.Body).Decode(&message)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(entities.Error{\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tmessageID, timestamp, err := handler.usecases.PostMessage(tokenString, message)\n\tif err != nil && err.Error() == \"not authenticated\" {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tjson.NewEncoder(w).Encode(entities.Error{\n\t\t\tError: \"not authenticated\",\n\t\t})\n\t\treturn\n\t}\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tjson.NewEncoder(w).Encode(entities.Error{\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tnewMessageOutput := struct {\n\t\tID uint `json:\"id\"`\n\t\tTimestamp time.Time `json:\"timestamp\"`\n\t}{\n\t\tID: messageID,\n\t\tTimestamp: timestamp,\n\t}\n\tjson.NewEncoder(w).Encode(&newMessageOutput)\n\tw.WriteHeader(http.StatusOK)\n}", "func (p *Plugin) PostToChannelByIDAsBot(channelID, message string) error {\n\t_, appError := p.API.CreatePost(&model.Post{\n\t\tUserId: p.BotUserID,\n\t\tChannelId: channelID,\n\t\tMessage: message,\n\t})\n\tif appError != nil {\n\t\treturn appError\n\t}\n\n\treturn nil\n}", "func SendMessage(version, build string) error {\n\texpanded, err := homedir.Expand(configPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := os.Stat(expanded); os.IsNotExist(err) {\n\t\treturn errgo.Mask(ErrNotConfigured, errgo.Any)\n\t}\n\n\tslackConfiguration := SlackConfiguration{\n\t\tNotificationUsername: \"KochoBot\",\n\t\tEmojiIcon: \":robot_face:\",\n\t}\n\n\tconfigFile, err := os.Open(expanded)\n\tif err != nil {\n\t\treturn errgo.WithCausef(err, ErrInvalidConfiguration, \"couldn't open Slack configuration file\")\n\t}\n\tdefer configFile.Close()\n\n\tif err := json.NewDecoder(configFile).Decode(&slackConfiguration); err != nil {\n\t\treturn errgo.WithCausef(err, ErrInvalidConfiguration, \"couldn't decode Slack configuration\")\n\t}\n\n\tclient := slack.New(slackConfiguration.Token)\n\n\tparams := slack.PostMessageParameters{}\n\tparams.Attachments = []slack.Attachment{\n\t\tslack.Attachment{\n\t\t\tColor: \"#2484BE\",\n\t\t\tText: fmt.Sprintf(\"*Kocho*: %s ran `%s`\", slackConfiguration.Username, strings.Join(os.Args, \" \")),\n\t\t\tFields: []slack.AttachmentField{\n\t\t\t\tslack.AttachmentField{\n\t\t\t\t\tTitle: \"Kocho Version\",\n\t\t\t\t\tValue: version,\n\t\t\t\t\tShort: true,\n\t\t\t\t},\n\t\t\t\tslack.AttachmentField{\n\t\t\t\t\tTitle: \"Kocho Build\",\n\t\t\t\t\tValue: build,\n\t\t\t\t\tShort: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\tMarkdownIn: []string{\"text\"},\n\t\t},\n\t}\n\tparams.Username = slackConfiguration.NotificationUsername\n\tparams.IconEmoji = slackConfiguration.EmojiIcon\n\n\tif _, _, err := client.PostMessage(slackConfiguration.NotificationChannel, \"\", params); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (t *Typetalk) ChatPostMessage(ctx context.Context, message string) (*typetalk.PostedMessageResult, *typetalkShared.Response, error) {\n\treturn t.Client.Messages.PostMessage(ctx, t.TopicID, message, nil)\n}", "func (n Notification) Post(obj *mgh.MungeObject) error {\n\treturn obj.WriteComment(n.String())\n}", "func PushNote(title string, body string, token string, device string) error {\n\t// curl --header 'Access-Token: <your_access_token_here>' \\\n\t// --header 'Content-Type: application/json' \\\n\t// --data-binary '{\"body\":\"Space Elevator, Mars Hyperloop, Space Model S (Model Space?)\",\"title\":\"Space Travel Ideas\",\"type\":\"note\"}' \\\n\t// --request POST \\\n\t// https://api.pushbullet.com/v2/pushes\n\n\tuserDevice, err := GetDefaultDevice(device, token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpbURL := \"https://api.pushbullet.com\"\n\theaders := []header{\n\t\t{\"Access-Token\", token},\n\t\t{\"Content-Type\", \"application/json\"},\n\t}\n\tcontent := pushBody{\n\t\ttitle,\n\t\tbody,\n\t\t\"note\",\n\t\tuserDevice.Iden,\n\t}\n\n\treqContent, err := json.Marshal(content)\n\tres, err := makeRequest(pbURL+\"/v2/pushes\", \"POST\", headers, bytes.NewBuffer(reqContent))\n\tdefer res.Body.Close()\n\treturn err\n}", "func post(body map[string]interface{}) {\n\tif len(Token) == 0 {\n\t\tstderr(\"Token is empty\")\n\t\treturn\n\t}\n\n\tjsonBody, err := json.Marshal(body)\n\tif err != nil {\n\t\tstderr(fmt.Sprintf(\"Rollbar payload couldn't be encoded: %s\", err.Error()))\n\t\treturn\n\t}\n\n\tresp, err := http.Post(Endpoint, \"application/json\", bytes.NewReader(jsonBody))\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\tstderr(fmt.Sprintf(\"Rollbar POST failed: %s\", err.Error()))\n\t} else if resp.StatusCode != 200 {\n\t\tstderr(fmt.Sprintf(\"Rollbar response: %s\", resp.Status))\n\t}\n}", "func hookPerformWebPOST(url string, data interface{}) error {\n\t// Generate a buffer for us to store some JSON\n\tb := new(bytes.Buffer)\n\n\t// Take the data we have received and encode it in JSON to POST\n\tjson.NewEncoder(b).Encode(data)\n\n\t// It's always important to log.\n\tlog.WithFields(log.Fields{\n\t\t\"url\": url,\n\t\t\"data\": b,\n\t}).Debug(\"POSTing to webhook\")\n\n\t// POST up our data and then return if we got an error or not.\n\tres, err := http.Post(url, \"application/json; charset=utf-8\", b)\n\n\tlog.WithFields(log.Fields{\n\t\t\"url\": url,\n\t\t\"code\": res.StatusCode,\n\t\t\"status\": res.Status,\n\t}).Debug(\"Response received from webhook\")\n\n\treturn err\n}", "func sendAnonymousMessage(username, message string) error {\n\turl := os.Getenv(webhookConfig)\n\tpayload, err := json.Marshal(slackMsg{\n\t\tText: message,\n\t\tChannel: username,\n\t\tUsername: fmt.Sprintf( animals[rand.Intn(len(animals))]),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = http.Post(url, \"application/json\", bytes.NewBuffer(payload))\n\treturn err\n}", "func sendPush(apiKey string, name string, url string, newStatus string, oldStatus string) {\n\tlogging.MustGetLogger(\"\").Debug(\"Sending Push about \\\"\" + url + \"\\\"...\")\n\n\tpb := pushbullet.New(apiKey)\n\n\tpush := requests.NewLink()\n\tpush.Title = GetConfiguration().Application.Title + \" - Status Change\"\n\tpush.Body = name + \" went from \\\"\" + oldStatus + \"\\\" to \\\"\" + newStatus + \"\\\".\"\n\tpush.Url = url\n\n\t_, err := pb.PostPushesLink(push)\n\tif err != nil {\n\t\tlogging.MustGetLogger(\"\").Error(\"Unable to send Push: \", err)\n\t}\n}", "func PostEvent(client *http.Client, hookURL string, message EventMessage) (*http.Response, error) {\n\tbuf := new(bytes.Buffer)\n\terr := json.NewEncoder(buf).Encode(message)\n\tif err != nil {\n\t\tlog.Printf(\"Encode json failed: %+v\\n\", err)\n\t\treturn nil, err\n\t}\n\tresp, err := client.Post(hookURL, \"application/json; charset=utf-8\", buf)\n\treturn resp, err\n}", "func handlePostMessage(w http.ResponseWriter, r *http.Request) {\n\t//TODO do some sanity checks on the body or message passed in.\n\t//TODO use this as part of validation if r.Header.Get(\"Content-Type\") == \"application/x-www-form-urlencoded\" {\n\tfmt.Printf(\"Got input new method.\\n\")\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tmessage := string(body)\n\tfmt.Printf(\"Message sent in \" + message + \"\\n\")\n\t//Add message to the map....\n\tvar messageid string = addToMessageMap(message)\n\tfmt.Printf(\"Message ID \" + messageid + \"\\n\")\n\n\t//return json object with message id\n\n\tmis := messageIdStruct{messageid, message}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tif err := json.NewEncoder(w).Encode(mis); err != nil {\n\t\tpanic(err)\n\t}\n}", "func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {\r\n // Ignore all messages created by the bot itself\r\n // This isn't required in this specific example but it's a good practice.\r\n if m.Author.ID == s.State.User.ID {\r\n return\r\n }\r\n // If the message is \"ping\" reply with \"Pong!\"\r\n if m.Content == \"ping\" {\r\n s.ChannelMessageSend(m.ChannelID, \"Pong!\")\r\n }\r\n\r\n // If the message is \"pong\" reply with \"Ping!\"\r\n if m.Content == \"pong\" {\r\n s.ChannelMessageSend(m.ChannelID, \"Ping!\")\r\n }\r\n\r\n // If the message is \"getmyid\" reply with \"Ping!\"\r\n if m.Content == \"getchannelid\" {\r\n s.ChannelMessageSend(m.ChannelID, \"ChannelID:\" + m.ChannelID)\r\n }\r\n\r\n if m.Content == \"getpushurl\" {\r\n s.ChannelMessageSend(m.ChannelID, sendMessageURLGen(m.ChannelID))\r\n }\r\n}", "func (c *EventController) Post(ctx *app.PostEventContext) error {\n\teid := uuid.NewV4().String()\n\tocctime := time.Now()\n\tif ctx.Payload.Occtime != nil {\n\t\tocctime = *ctx.Payload.Occtime\n\t}\n\tvar data interface{}\n\tif ctx.Payload.Params != nil {\n\t\tdata = *ctx.Payload.Params\n\t}\n\n\tevt := engine.Event{\n\t\tEid: eid,\n\t\tEtype: ctx.Payload.Etype,\n\t\tAction: ctx.Payload.Action,\n\t\tOccTime: occtime,\n\t\tFrom: ctx.Payload.From,\n\t\tData: data,\n\t}\n\t// Put your logic here\n\tengine.Put(evt)\n\t// EventController_Put: end_implement\n\tres := &app.AntResult{Eid: &eid}\n\treturn ctx.OK(res)\n}", "func (d *Deogracias) Post(p *reddit.Post) error {\n\terr := d.bot.Reply(p.Name, d.getPostQuote())\n\tif err != nil {\n\t\tlog.Println(errors.WithStack(errors.Errorf(\"failed to make post reply: %v\", err)))\n\t}\n\treturn nil\n}", "func sendButtonMessage(senderID int64, text string) {\n\trecipient := new(Recipient)\n\trecipient.ID = senderID\n\tbuttonMessage := new(ButtonMessage)\n\tbuttonMessage.Recipient = *recipient\n\tbuttonMessage.ButtonMessageBody.Attachment.Type = \"template\"\n\tbuttonMessage.ButtonMessageBody.Attachment.Payload.TemplateType = \"button\"\n\tbuttonMessage.ButtonMessageBody.Attachment.Payload.Text = text\n\tbuttonMessage.ButtonMessageBody.Attachment.Payload.Buttons.Type = \"web_url\"\n\tbuttonMessage.ButtonMessageBody.Attachment.Payload.Buttons.Url = \"https://still-bayou-19762.herokuapp.com/\"\n\tbuttonMessage.ButtonMessageBody.Attachment.Payload.Buttons.Title = \"May 13\"\n\tlog.Print(buttonMessage)\n\tbuttonMessageBody, err := json.Marshal(buttonMessage)\n\tlog.Print(buttonMessageBody)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\treq, err := http.NewRequest(\"POST\", FacebookEndPoint, bytes.NewBuffer(buttonMessageBody))\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\tvalues := url.Values{}\n\tvalues.Add(\"access_token\", accessToken)\n\treq.URL.RawQuery = values.Encode()\n\treq.Header.Add(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tclient := &http.Client{Timeout: time.Duration(30 * time.Second)}\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\tdefer res.Body.Close()\n\tvar result map[string]interface{}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\tif err := json.Unmarshal(body, &result); err != nil {\n\t\tlog.Print(err)\n\t}\n\tlog.Print(result)\n}" ]
[ "0.76651305", "0.7442603", "0.71486974", "0.71397513", "0.71380925", "0.70558584", "0.7021113", "0.6846197", "0.6742398", "0.6505753", "0.650403", "0.6456163", "0.63341874", "0.63200605", "0.6228203", "0.62201923", "0.61911505", "0.6082172", "0.6075067", "0.60693914", "0.6054156", "0.60284084", "0.60275143", "0.60164434", "0.5992761", "0.5987074", "0.5971948", "0.59535545", "0.59267896", "0.592586", "0.59144145", "0.589187", "0.58902436", "0.58862007", "0.5866575", "0.58536565", "0.5852144", "0.585074", "0.58442205", "0.5821414", "0.57997364", "0.5798188", "0.57973397", "0.57961005", "0.5773535", "0.5770005", "0.5768645", "0.5760105", "0.5753005", "0.57427377", "0.572583", "0.5681387", "0.5680179", "0.5659953", "0.565788", "0.5653832", "0.5633531", "0.5627167", "0.56271404", "0.56227934", "0.561682", "0.5614212", "0.56134677", "0.56130975", "0.5611089", "0.56009203", "0.5579959", "0.55797225", "0.5578415", "0.5568151", "0.55473214", "0.55233115", "0.5520833", "0.5516489", "0.5505784", "0.5504449", "0.5483549", "0.54628664", "0.5462299", "0.54433703", "0.5431114", "0.54105467", "0.53861415", "0.5381168", "0.5369228", "0.53646237", "0.53544354", "0.53470343", "0.53432614", "0.5331731", "0.53292453", "0.53250057", "0.53242564", "0.5317173", "0.5297283", "0.52965456", "0.5290303", "0.52797174", "0.52770376", "0.5270181" ]
0.7452913
1
Retrieve schedules by plan ID
func NewGetPlanSchedules(planID uuid.UUID, logger *zap.Logger, db pgxload.PgxLoader) *GetPlanSchedules { return &GetPlanSchedules{ planID: planID, db: db, logger: logger.Named("GetPlanSchedules"), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func restGetScheduleById(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tvar sid string = vars[ID]\n\tvar res models.Schedule\n\terr := dbClient.GetScheduleById(&res, sid)\n\tif err != nil {\n\t\tif err == db.ErrNotFound {\n\t\t\thttp.Error(w, \"Schedule not found\", http.StatusNotFound)\n\t\t\tLoggingClient.Error(\"Schedule not found: \"+err.Error(), \"\")\n\t\t} else {\n\t\t\tLoggingClient.Error(\"Problem getting schedule: \"+err.Error(), \"\")\n\t\t\thttp.Error(w, err.Error(), http.StatusServiceUnavailable)\n\t\t}\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(res)\n}", "func (c Client) Get(id string, params *stripe.SubscriptionScheduleParams) (*stripe.SubscriptionSchedule, error) {\n\tpath := stripe.FormatURLPath(\"/v1/subscription_schedules/%s\", id)\n\tsched := &stripe.SubscriptionSchedule{}\n\terr := c.B.Call(http.MethodGet, path, c.Key, params, sched)\n\treturn sched, err\n}", "func GetSchedule(connection *common.Connection, id string) (*Schedule, *common.ErrorHUE, error) {\n\tschedule := &Schedule{}\n\tpath := fmt.Sprintf(\"/api/\" + connection.Username + \"/schedules/\" + id)\n\tbodyResponse, errHUE, err := internal.Request(connection, \"GET\", http.StatusOK, path, nil)\n\tif errHUE != nil {\n\t\tlog.Errorf(\"HUE Error: %s\", errHUE.Error.Description)\n\t\treturn schedule, errHUE, err\n\t}\n\tif err != nil {\n\t\tlog.Errorf(\"Error: %s\", err.Error())\n\t\treturn schedule, errHUE, err\n\t}\n\terr = json.Unmarshal(bodyResponse, &schedule)\n\tif err != nil {\n\t\tlog.Errorf(\"Error with unmarshalling GetSchedule: %s\", err.Error())\n\t\treturn schedule, nil, err\n\t}\n\treturn schedule, nil, nil\n}", "func (l *RemoteProvider) GetSchedule(req *http.Request, scheduleID string) ([]byte, error) {\n\tif !l.Capabilities.IsSupported(PersistSchedules) {\n\t\tlogrus.Error(\"operation not available\")\n\t\treturn nil, ErrInvalidCapability(\"PersistSchedules\", l.ProviderName)\n\t}\n\n\tep, _ := l.Capabilities.GetEndpointForFeature(PersistSchedules)\n\n\tlogrus.Infof(\"attempting to fetch schedule from cloud for id: %s\", scheduleID)\n\n\tremoteProviderURL, _ := url.Parse(fmt.Sprintf(\"%s%s/%s\", l.RemoteProviderURL, ep, scheduleID))\n\tlogrus.Debugf(\"constructed schedule url: %s\", remoteProviderURL.String())\n\tcReq, _ := http.NewRequest(http.MethodGet, remoteProviderURL.String(), nil)\n\n\ttokenString, err := l.GetToken(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := l.DoRequest(cReq, tokenString)\n\tif err != nil {\n\t\treturn nil, ErrFetch(err, \"Perf Schedule :\"+scheduleID, resp.StatusCode)\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\tbdr, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, ErrDataRead(err, \"Perf Schedule :\"+scheduleID)\n\t}\n\n\tif resp.StatusCode == http.StatusOK {\n\t\tlogrus.Infof(\"schedule successfully retrieved from remote provider\")\n\t\treturn bdr, nil\n\t}\n\treturn nil, ErrFetch(err, fmt.Sprint(bdr), resp.StatusCode)\n}", "func Get(id string, params *stripe.SubscriptionScheduleParams) (*stripe.SubscriptionSchedule, error) {\n\treturn getC().Get(id, params)\n}", "func (db *Database) GetSchedule(startLocationName, destinationName, date string) ([]Trip, map[int][]TripOffering, error) {\n trips := []Trip{}\n offerings := make(map[int][]TripOffering)\n row, err := db.Query(fmt.Sprintf(\"SELECT * FROM Trip WHERE StartLocationName=%s\", startLocationName))\n if err != nil {\n return trips, offerings, err\n }\n // Get the trips with the given start location name\n trips = RowToTrips(row)\n row.Close()\n // Get the trip offerings for each trip\n for _, t := range trips {\n row, err := db.Query(fmt.Sprintf(\"SELECT * FROM TripOffering WHERE TripNumber=%d\", t.TripNumber))\n if err != nil {\n return trips, offerings, err\n }\n for row.Next() {\n var tripNumber int\n var date string\n var scheduledStartTime string\n var scheduledArrivalTime string\n var driverName string\n var busID int\n row.Scan(&tripNumber, &date, &scheduledStartTime, &scheduledArrivalTime, &driverName, &busID)\n if _, ok := offerings[tripNumber]; !ok {\n offerings[tripNumber] = []TripOffering{}\n }\n offerings[tripNumber] = append(offerings[tripNumber], TripOffering{\n TripNumber: tripNumber,\n Date: date,\n ScheduledStartTime: scheduledStartTime,\n ScheduledArrivalTime: scheduledArrivalTime,\n DriverName: driverName,\n BusID: busID,\n })\n }\n row.Close()\n }\n return trips, offerings, nil\n}", "func (c *DetaClient) GetSchedule(req *GetScheduleRequest) (*GetScheduleResponse, error) {\n\ti := &requestInput{\n\t\tPath: fmt.Sprintf(\"/schedules/%s\", req.ProgramID),\n\t\tMethod: \"GET\",\n\t\tNeedsAuth: true,\n\t}\n\n\to, err := c.request(i)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif o.Status == 404 {\n\t\treturn nil, nil\n\t}\n\n\tif o.Status != 200 {\n\t\tmsg := o.Error.Message\n\t\tif msg == \"\" {\n\t\t\tmsg = o.Error.Errors[0]\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to get schedule: %v\", msg)\n\t}\n\n\tvar resp GetScheduleResponse\n\terr = json.Unmarshal(o.Body, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func (svc *ServiceDefinition) GetPlanById(planId string) (*ServicePlan, error) {\n\tcatalogEntry, err := svc.CatalogEntry()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, plan := range catalogEntry.Plans {\n\t\tif plan.ID == planId {\n\t\t\treturn &plan, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"Plan ID %q could not be found\", planId)\n}", "func (m *DirectoryRequestBuilder) RoleAssignmentSchedulesById(id string)(*ifcfeaaa38c74c27248ac242dc390a943df9fda837089f362cf5a0b616515e16e.UnifiedRoleAssignmentScheduleItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"unifiedRoleAssignmentSchedule%2Did\"] = id\n }\n return ifcfeaaa38c74c27248ac242dc390a943df9fda837089f362cf5a0b616515e16e.NewUnifiedRoleAssignmentScheduleItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func GetADVSchedules(id string, addr string, localIP string) error {\r\n\tlocalAddr, err := net.ResolveIPAddr(\"ip\", localIP)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tLocalBindAddr := &net.TCPAddr{IP: localAddr.IP}\r\n\ttransport := &http.Transport{\r\n\t\tDial: (&net.Dialer{\r\n\t\t\tLocalAddr: LocalBindAddr,\r\n\t\t\tTimeout: 5 * time.Second,\r\n\t\t\tKeepAlive: 30 * time.Second,\r\n\t\t}).Dial,\r\n\t}\r\n\tclient := &http.Client{\r\n\t\tTransport: transport,\r\n\t}\r\n\r\n\turl := \"http://\" + addr + \"/adm/adv-schedules/\" + id + \"?format=cic\"\r\n\r\n\treq, err := http.NewRequest(\"GET\", url, nil)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tresp, err := client.Do(req)\r\n\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tif resp.StatusCode != 200 {\r\n\t\treturn fmt.Errorf(\"ADM Receved %v\", resp.Status)\r\n\t}\r\n\r\n\tfor {\r\n\t\tbuf := make([]byte, 32*1024)\r\n\t\t_, err := resp.Body.Read(buf)\r\n\r\n\t\tif err != nil && err != io.EOF {\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\tif err == io.EOF {\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\tresp.Body.Close()\r\n\ttransport.CloseIdleConnections()\r\n\r\n\treturn nil\r\n}", "func GetPlans(BattleID string) []*Plan {\n\tvar plans = make([]*Plan, 0)\n\tplanRows, plansErr := db.Query(\"SELECT id, name, points, active, skipped, votestart_time, voteend_time, votes FROM plans WHERE battle_id = $1 ORDER BY created_date\", BattleID)\n\tif plansErr == nil {\n\t\tdefer planRows.Close()\n\t\tfor planRows.Next() {\n\t\t\tvar v string\n\t\t\tvar p = &Plan{PlanID: \"\",\n\t\t\t\tPlanName: \"\",\n\t\t\t\tVotes: make([]*Vote, 0),\n\t\t\t\tPoints: \"\",\n\t\t\t\tPlanActive: false,\n\t\t\t\tPlanSkipped: false,\n\t\t\t\tVoteStartTime: time.Now(),\n\t\t\t\tVoteEndTime: time.Now(),\n\t\t\t}\n\t\t\tif err := planRows.Scan(&p.PlanID, &p.PlanName, &p.Points, &p.PlanActive, &p.PlanSkipped, &p.VoteStartTime, &p.VoteEndTime, &v); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t} else {\n\t\t\t\terr = json.Unmarshal([]byte(v), &p.Votes)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t}\n\n\t\t\t\tfor i := range p.Votes {\n\t\t\t\t\tvote := p.Votes[i]\n\t\t\t\t\tif p.PlanActive {\n\t\t\t\t\t\tvote.VoteValue = \"\"\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tplans = append(plans, p)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn plans\n}", "func cmdGetPolicySchedules(ccmd *cobra.Command, args []string) {\n\taplSvc := apl.NewClient()\n\n\toutput := runGetCommand(args, aplSvc.PolicySchedules.Get)\n\n\tif output != nil {\n\t\tfields := []string{\"ID\", \"Name\", \"ResourceType\", \"Status\", \"CreatedTime\"}\n\t\tprintTableResultsCustom(output.(apl.PolicySchedule), fields)\n\t}\n}", "func (c Client) GetSchedules(stationIds []string, dates []string) ([]Schedule, error) {\n\turl := fmt.Sprint(DefaultBaseURL, APIVersion, \"/schedules\")\n\tfmt.Println(\"URL:>\", url)\n\n\t//buffer to store the json request\n\tvar buffer bytes.Buffer\n\n\t//creating the request\n\tbuffer.WriteString(\"[\")\n\tfor index, station := range stationIds {\n\t\t//fmt.Println(station)\n\t\tbuffer.WriteString(`{\"stationID\":\"`+ station + `\",\"date\":[`)\n \tfor index2, date := range dates {\n\t\t buffer.WriteString(`\"`+date+`\"`)\n\t\t if index2 != len(dates)-1 {\n\t\t\t buffer.WriteString(\",\")\n\t\t } else {\n buffer.WriteString(\"]\")\n }\n }\n\t\tif index != len(stationIds)-1 {\n\t\t\tbuffer.WriteString(\"},\")\n\t\t} else {\n buffer.WriteString(\"}\")\n }\n\t}\n\tbuffer.WriteString(\"]\")\n\n\t//setup the request\n\treq, err := http.NewRequest(\"POST\", url, &buffer)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept-Encoding\", \"deflate,gzip\")\n\treq.Header.Set(\"token\", c.Token)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tlog.Fatal(resp.Status)\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close() //resp.Body.Close() will run when we're finished.\n \n // decode the response\n\tvar h []Schedule\n \n // debug code\t\n //body, _ := ioutil.ReadAll(resp.Body)\n\t//fmt.Println(string(body))\n \n\t// decode the body\n\terr = json.NewDecoder(resp.Body).Decode(&h)\n\tif err != nil {\n\t\tfmt.Println(\"Error parsing schedules response\")\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\n\treturn h, nil\n}", "func restGetScheduleEventByAddressableId(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tvar aid string = vars[ADDRESSABLEID]\n\tvar res []models.ScheduleEvent = make([]models.ScheduleEvent, 0)\n\n\t// Check if the addressable exists\n\tvar a models.Addressable\n\tif err := dbClient.GetAddressableById(&a, aid); err != nil {\n\t\tif err == db.ErrNotFound {\n\t\t\thttp.Error(w, \"Addressable not found for schedule event\", http.StatusNotFound)\n\t\t\tLoggingClient.Error(\"Addressable not found for schedule event: \"+err.Error(), \"\")\n\t\t} else {\n\t\t\tLoggingClient.Error(err.Error(), \"\")\n\t\t\thttp.Error(w, \"Problem getting addressable for schedule event: \"+err.Error(), http.StatusServiceUnavailable)\n\t\t}\n\t\treturn\n\t}\n\n\t// Get the schedule events\n\tif err := dbClient.GetScheduleEventsByAddressableId(&res, aid); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusServiceUnavailable)\n\t\tLoggingClient.Error(\"Problem getting schedule events: \"+err.Error(), \"\")\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(res)\n}", "func (s *Service) PlansGet(billingPlanID string) *PlansGetOp {\n\treturn &PlansGetOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: strings.Join([]string{\"\", \"v2.1\", \"billing_plans\", billingPlanID}, \"/\"),\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "func (c *PlanClient) Retrieve(id string) (*Plan, error) {\n\tplan := Plan{}\n\terr := c.client.get(\"/plans/\"+id, nil, &plan)\n\treturn &plan, err\n}", "func (l *RemoteProvider) GetSchedules(req *http.Request, page, pageSize, order string) ([]byte, error) {\n\tif !l.Capabilities.IsSupported(PersistSchedules) {\n\t\tlogrus.Error(\"operation not available\")\n\t\treturn []byte{}, ErrInvalidCapability(\"PersistSchedules\", l.ProviderName)\n\t}\n\n\tep, _ := l.Capabilities.GetEndpointForFeature(PersistSchedules)\n\n\tlogrus.Infof(\"attempting to fetch schedules from cloud\")\n\n\tremoteProviderURL, _ := url.Parse(l.RemoteProviderURL + ep)\n\tq := remoteProviderURL.Query()\n\tif page != \"\" {\n\t\tq.Set(\"page\", page)\n\t}\n\tif pageSize != \"\" {\n\t\tq.Set(\"page_size\", pageSize)\n\t}\n\tif order != \"\" {\n\t\tq.Set(\"order\", order)\n\t}\n\tremoteProviderURL.RawQuery = q.Encode()\n\tlogrus.Debugf(\"constructed schedules url: %s\", remoteProviderURL.String())\n\tcReq, _ := http.NewRequest(http.MethodGet, remoteProviderURL.String(), nil)\n\n\ttokenString, err := l.GetToken(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := l.DoRequest(cReq, tokenString)\n\tif err != nil {\n\t\treturn nil, ErrFetch(err, \"Perf Schedule Page\", resp.StatusCode)\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\tbdr, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, ErrDataRead(err, \"Perf Schedule Page\")\n\t}\n\n\tif resp.StatusCode == http.StatusOK {\n\t\tlogrus.Infof(\"schedules successfully retrieved from remote provider\")\n\t\treturn bdr, nil\n\t}\n\tlogrus.Errorf(\"error while fetching schedules: %s\", bdr)\n\treturn nil, ErrFetch(err, fmt.Sprint(bdr), resp.StatusCode)\n}", "func FindByPlan(fb string) (entity.SubscriptionPlans, error) {\n\tsp := entity.SubscriptionPlans{}\n\tif fb == \"\" {\n\t\tlog.Println(repo.MessageMap[\"V004\"])\n\t\treturn sp, errors.New(repo.MessageMap[\"V004\"])\n\t}\n\n\tdb, err := infra.NewDB()\n\tctx := context.Background()\n\tif err != nil {\n\t\treturn sp, errors.New(repo.MessageMap[\"C001\"])\n\t}\n\tdefer db.Close()\n\n\tif fb == \"free\" {\n\t\ttsql := `SELECT TOP 1 sp_id, sp_duration_in_days, sp_enable, sp_free, cf_active_flag\n FROM [SubscriptionPlans] \n WHERE cf_active_flag=1 AND sp_free=1 AND sp_enable=1\n ORDER BY [cf_date_created_on] DESC`\n\t\trows, err := db.QueryContext(ctx, tsql)\n\t\tif err != nil {\n\t\t\treturn sp, errors.New(repo.MessageMap[\"C003\"])\n\t\t}\n\t\tif rows.Next() {\n\t\t\trows.Scan(&sp.ID, &sp.PeriodInDays, &sp.EnableFlag, &sp.Free, &sp.ActiveFlag)\n\t\t}\n\t\tdefer rows.Close()\n\t}\n\treturn sp, nil\n}", "func (s *Schedule) GetAll(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {\n\tconn, err := db.Connect()\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\tsession := conn.NewSession(nil)\n\tdefer session.Close()\n\tdefer conn.Close()\n\n\tif request.QueryStringParameters == nil {\n\t\trequest.QueryStringParameters = map[string]string{\n\t\t\t\"event_id\": request.PathParameters[\"id\"],\n\t\t}\n\t} else {\n\t\trequest.QueryStringParameters[\"event_id\"] = request.PathParameters[\"id\"]\n\t}\n\n\tresult, err := db.Select(session, db.TableEventSchedule, request.QueryStringParameters, Schedule{})\n\tif err != nil {\n\t\treturn common.APIError(http.StatusInternalServerError, err)\n\t}\n\n\treturn common.APIResponse(result, http.StatusOK)\n}", "func (t *tripDetails) Plan() []*arrivalDetails {\n\treturn t.stops\n}", "func (o *Offer) GetPlanByID(planID string) *Plan {\n\tfor _, plan := range o.Definition.Plans {\n\t\tif plan.ID == planID {\n\t\t\treturn &plan\n\t\t}\n\t}\n\treturn nil\n}", "func (m *DirectoryRequestBuilder) RoleAssignmentScheduleInstancesById(id string)(*if28346ffd76078448f76b8e3a6438c69f288f33de995f80b4470bf3dd729afa7.UnifiedRoleAssignmentScheduleInstanceItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"unifiedRoleAssignmentScheduleInstance%2Did\"] = id\n }\n return if28346ffd76078448f76b8e3a6438c69f288f33de995f80b4470bf3dd729afa7.NewUnifiedRoleAssignmentScheduleInstanceItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func GetSchedule(r ScheduleRepo, id ScheduleID, uid user.ID) (*ScheduleData, Error) {\n\ts, err := r.GetForUser(id, uid)\n\tif err != nil {\n\t\treturn nil, err.Prefix(\"error getting schedule id %v\", id)\n\t}\n\n\tif !s.IsValid() {\n\t\treturn nil, NewError(ErrRecordNotFound, \"schedule id %d not found\", id)\n\t}\n\n\treturn &ScheduleData{ScheduleID: id, Schedule: s}, nil\n}", "func (s *API) GetAllSchedules(\n\tparams map[string]zoho.Parameter,\n) (data GetSchedulesResponse, err error) {\n\tendpoint := zoho.Endpoint{\n\t\tName: \"GetAllSchedules\",\n\t\tURL: fmt.Sprintf(\n\t\t\t\"https://shifts.zoho.%s/api/v1/%s/%s/%s\",\n\t\t\ts.ZohoTLD,\n\t\t\ts.OrganizationID,\n\t\t\tSettingsModule,\n\t\t\tschedulesModule,\n\t\t),\n\t\tMethod: zoho.HTTPGet,\n\t\tResponseData: &GetSchedulesResponse{},\n\t}\n\n\terr = s.Zoho.HTTPRequest(&endpoint)\n\tif err != nil {\n\t\treturn GetSchedulesResponse{}, fmt.Errorf(\"failed to retrieve schedules: %s\", err)\n\t}\n\tif v, ok := endpoint.ResponseData.(*GetSchedulesResponse); ok {\n\t\treturn *v, nil\n\t}\n\treturn GetSchedulesResponse{}, fmt.Errorf(\"data retrieved was not 'GetSchedulesResponse'\")\n}", "func (m *DirectoryRequestBuilder) RoleEligibilitySchedulesById(id string)(*i329ceabcf38e19751c19b2a6282c453f471d4acda1f60ae66f8e961ea5ffe9e7.UnifiedRoleEligibilityScheduleItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"unifiedRoleEligibilitySchedule%2Did\"] = id\n }\n return i329ceabcf38e19751c19b2a6282c453f471d4acda1f60ae66f8e961ea5ffe9e7.NewUnifiedRoleEligibilityScheduleItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (c *MealplanClient) Get(ctx context.Context, id int) (*Mealplan, error) {\n\treturn c.Query().Where(mealplan.ID(id)).Only(ctx)\n}", "func (o RefreshScheduleMapOutput) ScheduleId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RefreshScheduleMap) *string { return v.ScheduleId }).(pulumi.StringPtrOutput)\n}", "func (db *BotDB) GetSchedule(guild uint64) []ScheduleEvent {\n\tq, err := db.sqlGetSchedule.Query(guild)\n\tif db.CheckError(\"GetSchedule\", err) != nil {\n\t\treturn []ScheduleEvent{}\n\t}\n\tdefer q.Close()\n\tr := make([]ScheduleEvent, 0, 2)\n\tfor q.Next() {\n\t\tp := ScheduleEvent{}\n\t\tif err := q.Scan(&p.ID, &p.Date, &p.Type, &p.Data); err == nil {\n\t\t\tr = append(r, p)\n\t\t}\n\t}\n\treturn r\n}", "func restGetScheduleByName(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tn, err := url.QueryUnescape(vars[NAME])\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusServiceUnavailable)\n\t\tLoggingClient.Error(err.Error(), \"\")\n\t\treturn\n\t}\n\n\tvar res models.Schedule\n\terr = dbClient.GetScheduleByName(&res, n)\n\tif err != nil {\n\t\tif err == db.ErrNotFound {\n\t\t\thttp.Error(w, \"Schedule not found\", http.StatusNotFound)\n\t\t\tLoggingClient.Error(\"Schedule not found: \"+err.Error(), \"\")\n\t\t} else {\n\t\t\thttp.Error(w, err.Error(), http.StatusServiceUnavailable)\n\t\t\tLoggingClient.Error(\"Problem getting schedule: \"+err.Error(), \"\")\n\t\t}\n\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(res)\n}", "func GetPlan(name string) *stripe.PlanParams {\n\treturn plans[name]\n}", "func (m *ScheduleRequestBuilder) SchedulingGroupsById(id string)(*i25835bf2ea4b2783655a613062849327eae2c462a3fb0bb246ab4e81c0aeefcd.SchedulingGroupItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"schedulingGroup%2Did\"] = id\n }\n return i25835bf2ea4b2783655a613062849327eae2c462a3fb0bb246ab4e81c0aeefcd.NewSchedulingGroupItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (m *TeamItemRequestBuilder) Schedule()(*ifd53534f50d40567e607c2213e794582e29aa46a0c07e2d406db231a42a0140a.ScheduleRequestBuilder) {\n return ifd53534f50d40567e607c2213e794582e29aa46a0c07e2d406db231a42a0140a.NewScheduleRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (l *RemoteProvider) DeleteSchedule(req *http.Request, scheduleID string) ([]byte, error) {\n\tif !l.Capabilities.IsSupported(PersistSchedules) {\n\t\tlogrus.Error(\"operation not available\")\n\t\treturn nil, ErrInvalidCapability(\"PersistSchedules\", l.ProviderName)\n\t}\n\n\tep, _ := l.Capabilities.GetEndpointForFeature(PersistSchedules)\n\n\tlogrus.Infof(\"attempting to fetch schedule from cloud for id: %s\", scheduleID)\n\n\tremoteProviderURL, _ := url.Parse(fmt.Sprintf(\"%s%s/%s\", l.RemoteProviderURL, ep, scheduleID))\n\tlogrus.Debugf(\"constructed schedule url: %s\", remoteProviderURL.String())\n\tcReq, _ := http.NewRequest(http.MethodDelete, remoteProviderURL.String(), nil)\n\n\ttokenString, err := l.GetToken(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := l.DoRequest(cReq, tokenString)\n\tif err != nil {\n\t\tlogrus.Errorf(\"unable to delete schedules: %v\", err)\n\t\treturn nil, ErrDelete(err, \"Perf Schedule :\"+scheduleID, resp.StatusCode)\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\tbdr, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, ErrDataRead(err, \"Perf Schedule :\"+scheduleID)\n\t}\n\n\tif resp.StatusCode == http.StatusOK {\n\t\tlogrus.Infof(\"schedule successfully retrieved from remote provider\")\n\t\treturn bdr, nil\n\t}\n\treturn nil, ErrDelete(err, fmt.Sprint(bdr), resp.StatusCode)\n}", "func (r *FirewallScheduleResource) Get(id string) (*FirewallScheduleConfig, error) {\n\tvar item FirewallScheduleConfig\n\tif err := r.c.ReadQuery(BasePath+FirewallScheduleEndpoint, &item); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &item, nil\n}", "func (c *Client) GetScheduleByName(name string) (*arkAPI.Schedule, error) {\n\tvar schedule arkAPI.Schedule\n\n\terr := c.Client.Get(context.Background(), types.NamespacedName{\n\t\tName: name,\n\t\tNamespace: c.Namespace,\n\t}, &schedule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &schedule, nil\n}", "func (p *PlanTest) GetOne(id int) (*Plan, error) {\n\tplan := Plan{\n\t\tID: 1,\n\t\tPlanName: \"Bronze Plan\",\n\t\tPlanAmount: 1000,\n\t\tCreatedAt: time.Now(),\n\t\tUpdatedAt: time.Now(),\n\t}\n\n\treturn &plan, nil\n}", "func (m *ItemCalendarRequestBuilder) GetSchedule()(*ItemCalendarGetScheduleRequestBuilder) {\n return NewItemCalendarGetScheduleRequestBuilderInternal(m.pathParameters, m.requestAdapter)\n}", "func (a *PlansApiService) GetPlan(ctx context.Context, id string) ApiGetPlanRequest {\n\treturn ApiGetPlanRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func (r *DeviceManagementReportScheduleRequest) Get(ctx context.Context) (resObj *DeviceManagementReportSchedule, 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 (p *Cmd) Plan() (map[string][]string, error) {\n\tbundle, err := p.getBundle()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tplan := &airshipv1.PhasePlan{}\n\tselector, err := document.NewSelector().ByObject(plan, airshipv1.Scheme)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdoc, err := bundle.SelectOne(selector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := doc.ToAPIObject(plan, airshipv1.Scheme); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := make(map[string][]string)\n\tfor _, phaseGroup := range plan.PhaseGroups {\n\t\tphases := make([]string, len(phaseGroup.Phases))\n\t\tfor i, phase := range phaseGroup.Phases {\n\t\t\tphases[i] = phase.Name\n\t\t}\n\t\tresult[phaseGroup.Name] = phases\n\t}\n\treturn result, nil\n}", "func (table *Timetable) Remove(id string) error {\n\tfor k, task := range table.schedule {\n\t\tif task.Id == id {\n\t\t\tdelete(table.schedule, k)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"not found\")\n}", "func (a *SchedulesApiService) OrganizationsOrganizationIdAccountsAccountIdSchedulesGet(ctx context.Context, accountId string, organizationId string) (Schedule, *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\tsuccessPayload Schedule\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/organizations/{organization_id}/accounts/{account_id}/schedules\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"account_id\"+\"}\", fmt.Sprintf(\"%v\", accountId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"organization_id\"+\"}\", fmt.Sprintf(\"%v\", organizationId), -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{}\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}\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[\"Authorization\"] = 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-api-key\"] = 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\treturn successPayload, localVarHttpResponse, err\n}", "func Schedule() scheduleView {\n\tview := scheduleView{\n\t\tLayout: DefaultLayout(),\n\t\tLivemode: config.Config.LiveMode,\n\t\tCopyrightYear: time.Now().Year(),\n\t}\n\n\t// Attempt to find a cached schedule\n\tschedules, found := cache.Get(\"schedules\")\n\tview.Cached = found\n\tif view.Cached {\n\t\tview.Schedules = schedules.([]schedule.Schedule)\n\t}\n\n\treturn view\n}", "func (c *ProjectsBrokersV2ServiceInstancesServiceBindingsGetCall) PlanId(planId string) *ProjectsBrokersV2ServiceInstancesServiceBindingsGetCall {\n\tc.urlParams_.Set(\"planId\", planId)\n\treturn c\n}", "func (m *DirectoryRequestBuilder) RoleAssignmentScheduleRequestsById(id string)(*i97ec61667ae4af0dc73f94ca00501e020bfd2cab6faca9653c9cdf54198c1c7b.UnifiedRoleAssignmentScheduleRequestItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"unifiedRoleAssignmentScheduleRequest%2Did\"] = id\n }\n return i97ec61667ae4af0dc73f94ca00501e020bfd2cab6faca9653c9cdf54198c1c7b.NewUnifiedRoleAssignmentScheduleRequestItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (sps *ServerPlanService) GetServerPlan(planID string) (serverPlan *types.ServerPlan, err error) {\n\tlog.Debug(\"GetServerPlan\")\n\n\tdata, status, err := sps.concertoService.Get(fmt.Sprintf(APIPathCloudServerPlans, planID))\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, &serverPlan); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn serverPlan, nil\n}", "func BurnPlan(BattleID string, warriorID string, PlanID string) ([]*Plan, error) {\n\terr := ConfirmLeader(BattleID, warriorID)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Incorrect permissions\")\n\t}\n\n\tvar isActivePlan bool\n\n\t// delete plan\n\te := db.QueryRow(\"DELETE FROM plans WHERE id = $1 RETURNING active\", PlanID).Scan(&isActivePlan)\n\tif e != nil {\n\t\tlog.Println(e)\n\t\treturn nil, errors.New(\"Plan Not found\")\n\t}\n\n\tif isActivePlan {\n\t\tif _, err := db.Exec(\n\t\t\t`UPDATE battles SET updated_date = NOW(), voting_locked = true, active_plan_id = null WHERE id = $1`, BattleID); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\n\tplans := GetPlans(BattleID)\n\n\treturn plans, nil\n}", "func GetAllScheduledTrips(db DatabaseInterface) ([]*TripSchedule, error) {\n\treturn db.GetAllScheduledTrips()\n}", "func (m *MaintenanceScheduler) Schedule(id string,\n\tschedules map[string]Schedule) error {\n\tbytes, err := json.Marshal(schedules)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"schedules marshall error\")\n\t}\n\tmbytes, err := json.Marshal(EventMessage{ID: id})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"schedules marshall error\")\n\t}\n\tc := m.rclt.gconn()\n\tdefer c.Close()\n\t_, err = c.Do(\"HSET\", fmt.Sprintf(\"%s_flags\", m.hkey), id, false)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"fail to set new flag data\")\n\t}\n\t_, err = c.Do(\"HSET\", fmt.Sprintf(\"%s_schedules\", m.hkey), id, string(bytes))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"fail to set new schedule data\")\n\t}\n\tkey := fmt.Sprintf(\"%s_channel\", m.hkey)\n\t_, err = c.Do(\"PUBLISH\", key, string(mbytes))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"fail to set new schedule data\")\n\t}\n\treturn nil\n}", "func recuperaIDPlanbyName(keysec string, nomeprogetto string, nomeplan string) (string, error) {\n\tvar result interface{}\n\tvar risultatoTSs []interface{}\n\tvar risultatoTS map[string]interface{}\n\tvar idTS string\n\tvar ok bool\n\n\tlog.Logga(nomemodulo).Info(\"Predispongo chiamata getTestPlanByName su progetto-plan:\" + nomeprogetto + \"-\" + nomeplan)\n\n\tparTL := make(map[string]string)\n\tparTL[\"devKey\"] = keysec\n\tparTL[\"testprojectname\"] = nomeprogetto\n\tparTL[\"testplanname\"] = nomeplan\n\n\tlog.Logga(nomemodulo).Debug(\"Chiamo metodo tl.getTestPlanByName\")\n\terr = client.Call(\"tl.getTestPlanByName\", parTL, &result)\n\tif err != nil {\n\t\tlog.Logga(nomemodulo).Error(\"Errore in getTestPlanByName\")\n\t\treturn \"0\", err\n\t}\n\tlog.Logga(nomemodulo).Debug(\"Chiamata getTestPlanByName riuscita\")\n\tlog.Logga(nomemodulo).Debug(result)\n\tif risultatoTSs, ok = result.([]interface{}); !ok {\n\t\tlog.Logga(nomemodulo).Debug(reflect.ValueOf(result).Type())\n\t\treturn \"0\", errors.New(\"Errore in mapping risultati getTestPlanByName\")\n\t}\n\tfor _, valorizziamo := range risultatoTSs {\n\t\tlog.Logga(nomemodulo).Debug(\"Ciclo i TS\")\n\t\tif risultatoTS, ok = valorizziamo.(map[string]interface{}); !ok {\n\t\t\tlog.Logga(nomemodulo).Debug(reflect.ValueOf(valorizziamo).Type())\n\t\t\treturn \"\", errors.New(\"Errore in mapping risultati risultatoTSs su singolo item\")\n\t\t}\n\t\tif idTS, ok = risultatoTS[\"id\"].(string); !ok {\n\t\t\tlog.Logga(nomemodulo).Debug(reflect.ValueOf(risultatoTS[\"id\"]).Type())\n\t\t\treturn \"\", errors.New(\"Errore in mapping idts\")\n\t\t}\n\t\tlog.Logga(nomemodulo).Debug(risultatoTS[\"id\"])\n\t}\n\tlog.Logga(nomemodulo).Debug(risultatoTS)\n\treturn idTS, nil\n}", "func ListSchedulePath() string {\n\treturn \"/schedule\"\n}", "func (m *DirectoryRequestBuilder) RoleEligibilityScheduleInstancesById(id string)(*i38a0099911c322678afe0e91db6bf13f1336c0bd7474a79696eab0396dd25d72.UnifiedRoleEligibilityScheduleInstanceItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"unifiedRoleEligibilityScheduleInstance%2Did\"] = id\n }\n return i38a0099911c322678afe0e91db6bf13f1336c0bd7474a79696eab0396dd25d72.NewUnifiedRoleEligibilityScheduleInstanceItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (db *Database) GetDriverWeeklySchedule(driverName string, date string) ([]TripOffering, error) {\n result := []TripOffering{}\n sameWeek := func(t1, t2 *time.Time) bool {\n year1, week1 := t1.ISOWeek()\n year2, week2 := t2.ISOWeek()\n return year1 == year2 && week1 == week2\n }\n row, err := db.Query(\"SELECT * FROM TripOffering WHERE DriverName=%q\", driverName)\n if err != nil {\n return result, err\n }\n defer row.Close()\n date1, err := time.Parse(DATE_FORMAT, date)\n if err != nil {\n return result, err\n }\n if err != nil {\n return result, err\n }\n for row.Next() {\n var tripNumber int\n var date string\n var scheduledStartTime string\n var scheduledArrivalTime string\n var driverName string\n var busID int\n row.Scan(&tripNumber, &date, &scheduledStartTime, &scheduledArrivalTime, &driverName, &busID)\n date2, err := time.Parse(DATE_FORMAT, date)\n if err != nil {\n log.Fatal(err)\n }\n if sameWeek(&date1, &date2) {\n result = append(result, TripOffering{\n TripNumber: tripNumber,\n Date: date,\n ScheduledStartTime: scheduledStartTime,\n ScheduledArrivalTime: scheduledArrivalTime,\n DriverName: driverName,\n BusID: busID,\n })\n }\n }\n return result, nil\n}", "func RunSchedule() {\n\tgo func() {\n\t\tcount := 0\n\t\tfor {\n\t\t\ttime.Sleep(time.Hour * 4)\n\t\t\tcount++\n\t\t\tBuzzy = true\n\t\t\tif count == 12 {\n\t\t\t\tcount = 0\n\t\t\t\terr := SearchForClanIds(other.Flags, false)\n\t\t\t\tif err != nil {\n\t\t\t\t\tapiErr(\"RunSchedule\", err, \"error check SearchForClanIds\")\n\t\t\t\t\tother.DevPrint(\"ERROR: [SearchForClanIds]:\", err.Error())\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr := GetClanData()\n\t\t\t\tif err != nil {\n\t\t\t\t\tapiErr(\"RunSchedule\", err, \"error check GetClanData\")\n\t\t\t\t\tother.DevPrint(\"ERROR: [GetClanData]:\", err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t\tGetIcons()\n\t\t\tBuzzy = false\n\t\t}\n\t}()\n}", "func (c *Client) FetchSchedule(fetchMoreInfo bool) ([]Course, error) {\n\t// TODO: GET page, then check if a <form> exists, then extract the name of the radio buttons?\n\tpostData := url.Values{}\n\tpostData.Add(\"SSR_DUMMY_RECV1$sels$0\", \"0\")\n\n\tif resp, err := c.RequestPagePost(scheduleListViewPath, postData); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tdefer resp.Body.Close()\n\n\t\tcontents, err := ioutil.ReadAll(resp.Body)\n\t\tfmt.Println(string(contents))\n\n\t\tnodes, err := html.ParseFragment(resp.Body, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(nodes) != 1 {\n\t\t\treturn nil, errors.New(\"invalid number of root elements\")\n\t\t}\n\n\t\tcourses, err := parseSchedule(nodes[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif fetchMoreInfo {\n\t\t\tc.authLock.RLock()\n\t\t\tdefer c.authLock.RUnlock()\n\t\t\tif err := fetchExtraScheduleInfo(&c.client, courses, nodes[0]); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\treturn courses, nil\n\t}\n}", "func (o RefreshScheduleMapPtrOutput) ScheduleId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RefreshScheduleMap) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ScheduleId\n\t}).(pulumi.StringPtrOutput)\n}", "func (m *Planner) GetPlans()([]PlannerPlanable) {\n return m.plans\n}", "func (c *ProjectsBrokersV2ServiceInstancesGetLastOperationCall) PlanId(planId string) *ProjectsBrokersV2ServiceInstancesGetLastOperationCall {\n\tc.urlParams_.Set(\"planId\", planId)\n\treturn c\n}", "func (a *SchedulesApiService) OrganizationsOrganizationIdAccountsAccountIdSchedulesScheduleIdGet(ctx context.Context, scheduleId string, accountId string, organizationId string) (Schedule, *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\tsuccessPayload Schedule\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/organizations/{organization_id}/accounts/{account_id}/schedules/{schedule_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"schedule_id\"+\"}\", fmt.Sprintf(\"%v\", scheduleId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"account_id\"+\"}\", fmt.Sprintf(\"%v\", accountId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"organization_id\"+\"}\", fmt.Sprintf(\"%v\", organizationId), -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{}\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}\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[\"Authorization\"] = 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-api-key\"] = 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\treturn successPayload, localVarHttpResponse, err\n}", "func (m *ServicePlanInfo) GetServicePlanId()(*string) {\n return m.servicePlanId\n}", "func (m *AccessPackageAssignment) GetSchedule()(EntitlementManagementScheduleable) {\n return m.schedule\n}", "func GetScheduledTrips(db DatabaseInterface, user string) ([]TripSchedule, error) {\n\treturn db.GetTrips(user)\n}", "func (a HTTPAPI) EPTGetFlightPlan(c *gin.Context) {\n\t// Get requested ID\n\tfpID, err := mprimitive.ObjectIDFromHex(\n\t\tc.Param(\"id\"))\n\tif a.CheckRespondErr(c, http.StatusBadRequest,\n\t\t\"the flight plan ID was not in a \"+\n\t\t\t\"recognizable format\", err) {\n\t\treturn\n\t}\n\n\t// Query database for flight plan\n\tdbRes := a.DB.FlightPlans.FindOne(a.Ctx, bson.D{{\n\t\t\"_id\", fpID,\n\t}})\n\tif dbRes.Err() == mongo.ErrNoDocuments {\n\t\ta.RespondErr(c, http.StatusNotFound,\n\t\t\t\"no flight plan with that ID was found\",\n\t\t\tnil)\n\t\treturn\n\t}\n\n\tif a.CheckRespondErr(c, -1,\n\t\t\"we ran into trouble looking for \"+\n\t\t\t\"flight plans\", dbRes.Err()) {\n\t\treturn\n\t}\n\n\tvar foundFP DBFlightPlan\n\tif a.CheckRespondErr(c, -1,\n\t\t\"a flight plan was found but we ran into \"+\n\t\t\t\"trouble processing the results\",\n\t\tdbRes.Decode(&foundFP)) {\n\t\treturn\n\t}\n\n\t// Respond\n\tc.JSON(http.StatusOK, EPTGetFlightPlanResp{\n\t\tFlightPlan: foundFP,\n\t})\n}", "func GetScheduledTask(stid int64) (*ScheduledTask, error) {\n\tvar next pq.NullTime\n\ttask := ScheduledTask{}\n\n\tif err := db.QueryRow(\"SELECT * FROM schedule_tasks WHERE id=$1\", stid).\n\t\tScan(&task.Id, &task.Name, &task.Status, &next,\n\t\t&task.Cron); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgroup_task, err := getGroupTask(task.Id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttask.User = group_task.user\n\ttask.Project = group_task.project\n\ttask.Bot = group_task.bot\n\n\tif next.Valid {\n\t\ttask.Next = next.Time\n\t}\n\n\treturn &task, nil\n}", "func (ctx *Context) ScheduleHandler(w http.ResponseWriter, r *http.Request) {\n\t// Only support GET POST method\n\tif r.Method != \"GET\" && r.Method != \"POST\" && r.Method != \"DELETE\" {\n\t\thttp.Error(w, errUnsuportMethod, http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\t// parse meeting id\n\turlID := path.Base(path.Dir(r.URL.Path))\n\tmid := getIDfromURL(w, r, urlID)\n\tif mid < 0 {\n\t\treturn\n\t}\n\n\tif r.Method == \"POST\" {\n\t\t// Only support JSON body\n\t\tif !isContentTypeJSON(w, r) {\n\t\t\treturn\n\t\t}\n\n\t\t// Read response body\n\t\tbody := getRequestBody(w, r)\n\t\tif body == nil {\n\t\t\treturn\n\t\t}\n\n\t\t// Unmarshal body to group object\n\t\tsch := &model.Schedule{}\n\t\tif !unmarshalBody(w, body, sch) {\n\t\t\treturn\n\t\t}\n\t\tsch.MeetingID = mid\n\n\t\t// Add to database\n\t\tid, err := ctx.Store.CreateSchedule(sch)\n\t\tif !dbErrorHandle(w, \"Insert group\", err) {\n\t\t\treturn\n\t\t}\n\n\t\tschedule, err := ctx.Store.GetScheduleByID(id)\n\t\tif !dbErrorHandle(w, \"Get schedule\", err) {\n\t\t\treturn\n\t\t}\n\n\t\t// marshal into bytes\n\t\tresponse := marshalRep(w, schedule)\n\t\tif response == nil {\n\t\t\treturn\n\t\t}\n\n\t\t// Response\n\t\trespondWithHeader(w, typeJSON, response, http.StatusCreated)\n\t}\n\n\tif r.Method == \"GET\" {\n\t\tschedules, err := ctx.Store.GetAllSchedule(mid)\n\t\tif !dbErrorHandle(w, \"Get schedule\", err) {\n\t\t\treturn\n\t\t}\n\n\t\tresponse := marshalRep(w, schedules)\n\t\trespondWithHeader(w, typeJSON, response, http.StatusOK)\n\t}\n\n}", "func (m *GetSchedulePostRequestBody) GetSchedules()([]string) {\n return m.schedules\n}", "func List(params *stripe.SubscriptionScheduleListParams) *Iter {\n\treturn getC().List(params)\n}", "func (c *volumeSnapshotSchedules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VolumeSnapshotSchedule, err error) {\n\tresult = &v1alpha1.VolumeSnapshotSchedule{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"volumesnapshotschedules\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func FindScheduleSubject(ctx context.Context, exec boil.ContextExecutor, iD int64, selectCols ...string) (*ScheduleSubject, error) {\n\tscheduleSubjectObj := &ScheduleSubject{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"schedule_subject\\\" where \\\"id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, scheduleSubjectObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from schedule_subject\")\n\t}\n\n\treturn scheduleSubjectObj, nil\n}", "func (ctx *Context) SpecificScheduleHandler(w http.ResponseWriter, r *http.Request) {\n\t// Only support DELETE, PATCH method\n\tif r.Method != \"DELETE\" && r.Method != \"PATCH\" {\n\t\thttp.Error(w, errUnsuportMethod, http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\t// parse schedule id\n\turlID := path.Base(r.URL.Path)\n\tsid := getIDfromURL(w, r, urlID)\n\tif sid < 0 {\n\t\treturn\n\t}\n\n\tif r.Method == \"DELETE\" {\n\t\terr := ctx.Store.DeleteSchedule(sid)\n\t\tif !dbErrorHandle(w, \"Delete schedule\", err) {\n\t\t\treturn\n\t\t}\n\n\t\trespondWithHeader(w, typeText, []byte(\"Successfully deleted the schedule\"), http.StatusOK)\n\t}\n\n\t// This method is used to confirm a meeting\n\tif r.Method == \"PATCH\" {\n\t\t// parse meeting id\n\t\turlID = path.Base(path.Dir(path.Dir(r.URL.Path)))\n\t\tmid := getIDfromURL(w, r, urlID)\n\t\tif mid < 0 {\n\t\t\treturn\n\t\t}\n\n\t\t//get schedule\n\t\tschedule, err := ctx.Store.GetScheduleByID(sid)\n\t\tif !dbErrorHandle(w, \"Get schedule\", err) {\n\t\t\treturn\n\t\t}\n\n\t\t// Confim current meeting with current schedule\n\t\tmeeting, err := ctx.Store.ConfirmMeeting(mid, schedule)\n\n\t\t// marshal response\n\t\tresponse := marshalRep(w, meeting)\n\n\t\trespondWithHeader(w, typeJSON, response, http.StatusOK)\n\n\t}\n\n}", "func cmdListPolicySchedules(ccmd *cobra.Command, args []string) {\n\taplSvc := apl.NewClient()\n\n\toutput := runListCommand(&policyScheduleParams, aplSvc.PolicySchedules.List)\n\n\tif output != nil {\n\t\tfields := []string{\"ID\", \"Name\", \"ResourceType\", \"Status\", \"CreatedTime\"}\n\t\tprintTableResultsCustom(output.([]apl.PolicySchedule), fields)\n\t}\n}", "func (ts *TaskServiceImpl) QueryById(id uint32) (*Task, error) {\n\tvar (\n\t\ttask Task\n\t)\n\n\trows, err := ts.DB.Query(taskSqls[sqlQuerybyId], id)\n\tif err != nil {\n\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&task.Content, &task.Comment, &task.Started, &task.Ended, &task.Stoped, &task.Status); err != nil {\n\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &task, nil\n}", "func (c *Client) ListSchedules() (*arkAPI.ScheduleList, error) {\n\tvar schedules arkAPI.ScheduleList\n\n\terr := c.Client.List(context.Background(), &schedules, runtimeclient.InNamespace(c.Namespace))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &schedules, nil\n}", "func (db *ConcreteDatastore) GetCommentsOfSchedule(ScheduleId int64) (model.Comments, error) {\n\tvar (\n\t\terr error\n\t\trows *sqlx.Rows\n\t)\n\n\t// Setting up and executing the request\n\trequest := \"SELECT * FROM Comment WHERE Comment.schedule_id=?;\"\n\tif rows, err = db.Queryx(request, ScheduleId); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Formatting the data we got from the request\n\tcommentsList := model.Comments{}\n\tfor rows.Next() {\n\t\tcomment := model.Comment{}\n\t\tif err = rows.StructScan(&comment); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcommentsList = append(commentsList, comment)\n\t}\n\n\tdefer rows.Close()\n\treturn commentsList, nil\n}", "func (s *PlanServiceOp) List() ([]Plan, *Response, error) {\n\troot := new(planRoot)\n\n\tresp, err := s.client.DoRequest(\"GET\", planBasePath, nil, root)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn root.Plans, resp, err\n}", "func (a *SchedulesAPI) RequestRouteSchedules(route int, date string, time string, legend bool) (res RouteSchedulesResponse, err error) {\n\tparams := initSchedulesRequest(\"routesched\")\n\tparams.options[\"route\"] = []string{strconv.Itoa(route)}\n\tif date != \"\" {\n\t\tparams.options[\"date\"] = []string{date}\n\t}\n\tif time != \"\" {\n\t\tparams.options[\"time\"] = []string{time}\n\t}\n\tif legend {\n\t\tparams.options[\"l\"] = []string{\"1\"}\n\t}\n\n\terr = params.requestAPI(a, &res)\n\treturn\n}", "func planHandler(lp loadpoint.API) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar err error\n\n\t\ttargetTime := lp.GetTargetTime()\n\t\tif t := r.URL.Query().Get(\"targetTime\"); t != \"\" {\n\t\t\ttargetTime, err = time.Parse(time.RFC3339, t)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tpower := lp.GetMaxPower()\n\t\trequiredDuration, plan, err := lp.GetPlan(targetTime, power)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tres := struct {\n\t\t\tDuration int64 `json:\"duration\"`\n\t\t\tPlan api.Rates `json:\"plan\"`\n\t\t\tUnit string `json:\"unit\"`\n\t\t\tPower float64 `json:\"power\"`\n\t\t}{\n\t\t\tDuration: int64(requiredDuration.Seconds()),\n\t\t\tPlan: plan,\n\t\t\tPower: power,\n\t\t}\n\t\tjsonResult(w, res)\n\t}\n}", "func restGetScheduleEventByAddressableName(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tan, err := url.QueryUnescape(vars[ADDRESSABLENAME])\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tLoggingClient.Error(err.Error(), \"\")\n\t\treturn\n\t}\n\tvar res []models.ScheduleEvent = make([]models.ScheduleEvent, 0)\n\n\t// Check if the addressable exists\n\tvar a models.Addressable\n\tif err = dbClient.GetAddressableByName(&a, an); err != nil {\n\t\tif err == db.ErrNotFound {\n\t\t\tLoggingClient.Error(\"Addressable not found for schedule event: \"+err.Error(), \"\")\n\t\t\thttp.Error(w, \"Addressable not found for schedule event\", http.StatusNotFound)\n\t\t} else {\n\t\t\tLoggingClient.Error(\"Problem getting addressable for schedule event: \"+err.Error(), \"\")\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\n\t// Get the schedule events\n\tif err = dbClient.GetScheduleEventsByAddressableId(&res, a.Id.Hex()); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\tLoggingClient.Error(\"Problem getting schedule events: \"+err.Error(), \"\")\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(res)\n}", "func search(schedules chan<- schedule.Schedule, cronConfig *config.Config) {\n\t// @I Support different sources of candidate Schedules configurable via JSON\n\t// or YAML\n\n\t// Create Redis Storage.\n\tstorage, err := storage.Create(cronConfig.Storage)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// The duration of the search interval.\n\tinterval, err := time.ParseDuration(cronConfig.SearchInterval)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcandidateSchedules, err := storage.Search(interval)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, schedule := range candidateSchedules {\n\t\tschedules <- *schedule\n\t}\n\n\t// Repeat the search after the defined search interval.\n\ttime.Sleep(interval)\n\tsearch(schedules, cronConfig)\n}", "func (j *ScheduledJob) ScheduleID() int64 {\n\treturn j.rec.ScheduleID\n}", "func GetLightingEventsByScheduleID(scheduleID int64) ([]LightingEvent, error) {\n\tlightingEvent := LightingEvent{}\n\tres := []LightingEvent{}\n\n\tdb := database.Open()\n\tdefer database.Close(db)\n\trows, err := db.Query(\"SELECT * FROM lightingEvents WHERE lightingScheduleId = ? ORDER BY startTime ASC\", scheduleID)\n\tif err != nil {\n\t\treturn res, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tlightingEvent.getRow(rows)\n\n\t\tif err != nil {\n\t\t\treturn res, err\n\t\t}\n\n\t\tres = append(res, lightingEvent)\n\t}\n\n\treturn res, nil\n}", "func Get(name string) (Driver, error) {\n\tif d, ok := schedulers[name]; ok {\n\t\treturn d, nil\n\t}\n\treturn nil, &errors.ErrNotFound{\n\t\tID: name,\n\t\tType: \"Scheduler\",\n\t}\n}", "func (j *JPush) ScheduleGetCid() (*PushCIDResponse, error) {\n\treturn j.PushGetCids(1, \"schedule\")\n}", "func (m *ScheduleRequestBuilder) Get(ctx context.Context, requestConfiguration *ScheduleRequestBuilderGetRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Scheduleable, error) {\n requestInfo, err := m.CreateGetRequestInformation(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.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateScheduleFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Scheduleable), nil\n}", "func (planetDeliveryRest *PlanetDeliveryRest) FindByID(w http.ResponseWriter, r *http.Request) {\n\tplanetID := mux.Vars(r)[\"id\"]\n\tplanet, err := planetDeliveryRest.planetUsecase.FindByID(r.Context(), planetID)\n\tif err != nil {\n\t\tError(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t}\n\tJSON(w, planet, http.StatusOK)\n}", "func (p *DeliveryConfigProcessor) Plan(cli *Client) (*ActuationPlan, error) {\n\tif len(p.content) == 0 {\n\t\terr := p.Load()\n\t\tif err != nil {\n\t\t\treturn nil, xerrors.Errorf(\"Failed to load delivery config: %w\", err)\n\t\t}\n\t}\n\n\tcontent, err := commonRequest(cli, \"POST\", \"/managed/delivery-configs/actuation-plan\", requestBody{\n\t\tContent: bytes.NewReader(p.content),\n\t\tContentType: \"application/x-yaml\",\n\t})\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"Failed to calculate actuation plan: %w\", err)\n\t}\n\n\t// convert content into an ActuationPlan\n\tdata := &ActuationPlan{}\n\terr = json.Unmarshal(content, data)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\n\t\t\t\"failed to parse response from actuation plan api: %w\",\n\t\t\tErrorInvalidContent{Content: content, ParseError: err},\n\t\t)\n\t}\n\n\treturn data, nil\n}", "func (c Client) List(listParams *stripe.SubscriptionScheduleListParams) *Iter {\n\treturn &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) {\n\t\tlist := &stripe.SubscriptionScheduleList{}\n\t\terr := c.B.CallRaw(http.MethodGet, \"/v1/subscription_schedules\", c.Key, b, p, list)\n\n\t\tret := make([]interface{}, len(list.Data))\n\t\tfor i, v := range list.Data {\n\t\t\tret[i] = v\n\t\t}\n\n\t\treturn ret, list, err\n\t})}\n}", "func Plans(plans PlansConfig, provider internal.CloudProvider, includeOIDCParams bool) map[string]Plan {\n\tawsSchema := AWSSchema([]string{\"m5.2xlarge\", \"m5.4xlarge\", \"m5.8xlarge\", \"m5.12xlarge\"})\n\tawsHASchema := AWSHASchema([]string{\"m5.2xlarge\", \"m5.4xlarge\", \"m5.8xlarge\", \"m5.12xlarge\"})\n\tgcpSchema := GCPSchema([]string{\"n1-standard-2\", \"n1-standard-4\", \"n1-standard-8\", \"n1-standard-16\", \"n1-standard-32\", \"n1-standard-64\"})\n\topenstackSchema := OpenStackSchema([]string{\"m2.xlarge\", \"m1.2xlarge\"})\n\tazureSchema := AzureSchema([]string{\"Standard_D8_v3\"})\n\tazureLiteSchema := AzureLiteSchema([]string{\"Standard_D4_v3\"})\n\tazureHASchema := AzureHASchema([]string{\"Standard_D8_v3\"})\n\tfreemiumSchema := FreemiumSchema(provider)\n\ttrialSchema := TrialSchema()\n\n\tif includeOIDCParams {\n\t\tincludeOIDCSchema(&awsSchema, &awsHASchema, &gcpSchema, &openstackSchema, &azureSchema,\n\t\t\t&azureLiteSchema, &azureHASchema, &freemiumSchema, &trialSchema)\n\t}\n\n\treturn map[string]Plan{\n\t\tAWSPlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: AWSPlanID,\n\t\t\t\tName: AWSPlanName,\n\t\t\t\tDescription: defaultDescription(AWSPlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(AWSPlanName, plans), Schemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(awsSchema),\n\t\t\tupdateRawSchema: schemaForUpdate(awsSchema),\n\t\t},\n\t\tPreviewPlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: PreviewPlanID,\n\t\t\t\tName: PreviewPlanName,\n\t\t\t\tDescription: defaultDescription(PreviewPlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(PreviewPlanName, plans), Schemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(awsSchema),\n\t\t\tupdateRawSchema: schemaForUpdate(awsSchema),\n\t\t},\n\t\tAWSHAPlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: AWSHAPlanID,\n\t\t\t\tName: AWSHAPlanName,\n\t\t\t\tDescription: defaultDescription(AWSHAPlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(AWSHAPlanName, plans), Schemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(awsHASchema),\n\t\t\tupdateRawSchema: schemaForUpdate(awsHASchema),\n\t\t},\n\t\tGCPPlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: GCPPlanID,\n\t\t\t\tName: GCPPlanName,\n\t\t\t\tDescription: defaultDescription(GCPPlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(GCPPlanName, plans),\n\t\t\t\tSchemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(gcpSchema),\n\t\t\tupdateRawSchema: schemaForUpdate(gcpSchema),\n\t\t},\n\t\tOpenStackPlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: OpenStackPlanID,\n\t\t\t\tName: OpenStackPlanName,\n\t\t\t\tDescription: defaultDescription(OpenStackPlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(OpenStackPlanName, plans),\n\t\t\t\tSchemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(openstackSchema),\n\t\t\tupdateRawSchema: schemaForUpdate(openstackSchema),\n\t\t},\n\t\tAzurePlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: AzurePlanID,\n\t\t\t\tName: AzurePlanName,\n\t\t\t\tDescription: defaultDescription(AzurePlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(AzurePlanName, plans),\n\t\t\t\tSchemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(azureSchema),\n\t\t\tupdateRawSchema: schemaForUpdate(azureSchema),\n\t\t},\n\t\tAzureLitePlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: AzureLitePlanID,\n\t\t\t\tName: AzureLitePlanName,\n\t\t\t\tDescription: defaultDescription(AzureLitePlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(AzureLitePlanName, plans),\n\t\t\t\tSchemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(azureLiteSchema),\n\t\t\tupdateRawSchema: schemaForUpdate(azureLiteSchema),\n\t\t},\n\t\tFreemiumPlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: FreemiumPlanID,\n\t\t\t\tName: FreemiumPlanName,\n\t\t\t\tDescription: defaultDescription(FreemiumPlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(FreemiumPlanName, plans),\n\t\t\t\tSchemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(freemiumSchema),\n\t\t\tupdateRawSchema: schemaForUpdate(freemiumSchema),\n\t\t},\n\t\tAzureHAPlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: AzureHAPlanID,\n\t\t\t\tName: AzureHAPlanName,\n\t\t\t\tDescription: defaultDescription(AzureHAPlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(AzureHAPlanName, plans),\n\t\t\t\tSchemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(azureHASchema),\n\t\t\tupdateRawSchema: schemaForUpdate(azureHASchema),\n\t\t},\n\t\tTrialPlanID: {\n\t\t\tPlanDefinition: domain.ServicePlan{\n\t\t\t\tID: TrialPlanID,\n\t\t\t\tName: TrialPlanName,\n\t\t\t\tDescription: defaultDescription(TrialPlanName, plans),\n\t\t\t\tMetadata: defaultMetadata(TrialPlanName, plans),\n\t\t\t\tSchemas: &domain.ServiceSchemas{\n\t\t\t\t\tInstance: domain.ServiceInstanceSchema{\n\t\t\t\t\t\tCreate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tUpdate: domain.Schema{\n\t\t\t\t\t\t\tParameters: make(map[string]interface{}),\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\tprovisioningRawSchema: marshalSchema(trialSchema),\n\t\t\tupdateRawSchema: schemaForUpdate(trialSchema),\n\t\t},\n\t}\n}", "func (a *SchedulesApiService) OrganizationsOrganizationIdAccountsAccountIdSchedulesScheduleIdTimesGet(ctx context.Context, scheduleId string, accountId string, organizationId string) (ScheduleTime, *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\tsuccessPayload ScheduleTime\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/organizations/{organization_id}/accounts/{account_id}/schedules/{schedule_id}/times\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"schedule_id\"+\"}\", fmt.Sprintf(\"%v\", scheduleId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"account_id\"+\"}\", fmt.Sprintf(\"%v\", accountId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"organization_id\"+\"}\", fmt.Sprintf(\"%v\", organizationId), -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{}\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}\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[\"Authorization\"] = 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-api-key\"] = 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\treturn successPayload, localVarHttpResponse, err\n}", "func GetMasterSchedule(w http.ResponseWriter, r *http.Request) {\n\tgid := chi.URLParam(r, \"groupID\")\n\tgroupID, err := primitive.ObjectIDFromHex(gid)\n\tif err != nil {\n\t\trender.Render(w, r, ErrInvalidRequest(err))\n\t\treturn\n\t}\n\tms := &MasterSchedule{}\n\terr = mh.GetMasterSchedule(ms, bson.M{\"groupId\": groupID})\n\tif err != nil {\n\t\trender.Render(w, r, ErrNotFound(err))\n\t\treturn\n\t}\n\trender.Status(r, http.StatusOK)\n\trender.Render(w, r, NewMasterScheduleResponse(*ms))\n}", "func Schedule(names ...string) ([]window.Schedule, error) {\n\tvar r window.Reader\n\tm, err := window.Windows(auklib.ConfDir, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(names) == 0 {\n\t\tnames = m.Keys()\n\t}\n\tdeck.Infof(\"Aggregating schedule for label(s): %s\", strings.Join(names, \", \"))\n\tvar out []window.Schedule\n\tfor i := range names {\n\t\tschedules := m.AggregateSchedules(names[i])\n\t\tvar success int64 = 1\n\t\tif len(schedules) == 0 {\n\t\t\tdeck.Errorf(\"no schedule found for label %q\", names[i])\n\t\t\tsuccess = 0\n\t\t\tcontinue\n\t\t}\n\n\t\tmetricName := fmt.Sprintf(\"%s/%s\", auklib.MetricRoot, \"schedule_retrieved\")\n\t\tmetric, err := metrics.NewInt(metricName, auklib.MetricSvc)\n\t\tif err != nil {\n\t\t\tdeck.Warningf(\"could not create metric: %v\", err)\n\t\t}\n\t\tmetric.Data.AddStringField(\"request\", names[i])\n\t\tmetric.Set(success)\n\n\t\tout = append(out, findNearest(schedules))\n\t}\n\treturn out, nil\n}", "func (a *SchedulesApiService) OrganizationsOrganizationIdAccountsAccountIdSchedulesScheduleIdServersGet(ctx context.Context, scheduleId string, accountId string, organizationId string) (Server, *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\tsuccessPayload Server\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/organizations/{organization_id}/accounts/{account_id}/schedules/{schedule_id}/servers\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"schedule_id\"+\"}\", fmt.Sprintf(\"%v\", scheduleId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"account_id\"+\"}\", fmt.Sprintf(\"%v\", accountId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"organization_id\"+\"}\", fmt.Sprintf(\"%v\", organizationId), -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{}\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}\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[\"Authorization\"] = 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-api-key\"] = 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\treturn successPayload, localVarHttpResponse, err\n}", "func (j *ScheduledJob) ScheduleDetails() *jobspb.ScheduleDetails {\n\treturn &j.rec.ScheduleDetails\n}", "func executeSchedule(resp http.ResponseWriter, request *http.Request) {\n\tcors := handleCors(resp, request)\n\tif cors {\n\t\treturn\n\t}\n\n\tlocation := strings.Split(request.URL.String(), \"/\")\n\tvar workflowId string\n\n\tif location[1] == \"api\" {\n\t\tif len(location) <= 4 {\n\t\t\tresp.WriteHeader(401)\n\t\t\tresp.Write([]byte(`{\"success\": false}`))\n\t\t\treturn\n\t\t}\n\n\t\tworkflowId = location[4]\n\t}\n\n\tif len(workflowId) != 32 {\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(`{\"success\": false, \"message\": \"ID not valid\"}`))\n\t\treturn\n\t}\n\n\tctx := context.Background()\n\tlog.Printf(\"EXECUTING %s!\", workflowId)\n\tidConfig, err := getSchedule(ctx, workflowId)\n\tif err != nil {\n\t\tlog.Printf(\"Error getting schedule: %s\", err)\n\t\tresp.WriteHeader(401)\n\t\tresp.Write([]byte(fmt.Sprintf(`{\"success\": false, \"reason\": \"%s\"}`, err)))\n\t\treturn\n\t}\n\n\t// Basically the src app\n\tinputStrings := map[string]string{}\n\tfor _, item := range idConfig.Translator {\n\t\tif item.Dst.Required == \"false\" {\n\t\t\tlog.Println(\"Skipping not required\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif item.Src.Name == \"\" {\n\t\t\terrorMsg := fmt.Sprintf(\"Required field %s has no source\", item.Dst.Name)\n\t\t\tlog.Println(errorMsg)\n\t\t\tresp.WriteHeader(401)\n\t\t\tresp.Write([]byte(fmt.Sprintf(`{\"success\": false, \"reason\": \"%s\"}`, errorMsg)))\n\t\t\treturn\n\t\t}\n\n\t\tinputStrings[item.Dst.Name] = item.Src.Name\n\t}\n\n\tconfigmap := map[string]string{}\n\tfor _, config := range idConfig.AppInfo.SourceApp.Config {\n\t\tconfigmap[config.Key] = config.Value\n\t}\n\n\t// FIXME - this wont work for everything lmao\n\tfunctionName := strings.ToLower(idConfig.AppInfo.SourceApp.Action)\n\tfunctionName = strings.Replace(functionName, \" \", \"_\", 10)\n\n\tcmdArgs := []string{\n\t\tfmt.Sprintf(\"%s/%s/app.py\", baseAppPath, \"thehive\"),\n\t\tfmt.Sprintf(\"--referenceid=%s\", workflowId),\n\t\tfmt.Sprintf(\"--function=%s\", functionName),\n\t}\n\n\tfor key, value := range configmap {\n\t\tcmdArgs = append(cmdArgs, fmt.Sprintf(\"--%s=%s\", key, value))\n\t}\n\n\t// FIXME - processname\n\tbaseProcess := \"python3\"\n\tlog.Printf(\"Executing: %s %s\", baseProcess, strings.Join(cmdArgs, \" \"))\n\texecSubprocess(baseProcess, cmdArgs)\n\n\tresp.WriteHeader(200)\n\tresp.Write([]byte(`{\"success\": true}`))\n}", "func (s *Service) PlansGetAccountPlan() *PlansGetAccountPlanOp {\n\treturn &PlansGetAccountPlanOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: \"billing_plan\",\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "func (r *FirewallScheduleResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+FirewallScheduleEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *API) DeleteSchedule(id string) (data DeleteScheduleResponse, err error) {\n\tendpoint := zoho.Endpoint{\n\t\tName: \"DeleteSchedule\",\n\t\tURL: fmt.Sprintf(\n\t\t\t\"https://shifts.zoho.%s/api/v1/%s/%s/%s/%s\",\n\t\t\ts.ZohoTLD,\n\t\t\ts.OrganizationID,\n\t\t\tSettingsModule,\n\t\t\tschedulesModule,\n\t\t\tid,\n\t\t),\n\t\tMethod: zoho.HTTPDelete,\n\t\tResponseData: &DeleteScheduleResponse{},\n\t}\n\n\terr = s.Zoho.HTTPRequest(&endpoint)\n\tif err != nil {\n\t\treturn DeleteScheduleResponse{}, fmt.Errorf(\"failed to delete schedule with id: %s\", err)\n\t}\n\n\tif v, ok := endpoint.ResponseData.(*DeleteScheduleResponse); ok {\n\t\treturn *v, nil\n\t}\n\n\treturn DeleteScheduleResponse{}, fmt.Errorf(\"data returned was not 'DeleteScheduleResponse'\")\n}", "func (o *PaymentInitiationPaymentGetResponse) GetSchedule() ExternalPaymentScheduleGet {\n\tif o == nil || o.Schedule.Get() == nil {\n\t\tvar ret ExternalPaymentScheduleGet\n\t\treturn ret\n\t}\n\treturn *o.Schedule.Get()\n}", "func (o *PaymentInitiationPayment) GetSchedule() ExternalPaymentScheduleGet {\n\tif o == nil || o.Schedule.Get() == nil {\n\t\tvar ret ExternalPaymentScheduleGet\n\t\treturn ret\n\t}\n\treturn *o.Schedule.Get()\n}", "func ListSchedules(r ScheduleRepo, uid user.ID) (map[ScheduleID]*schedule.Schedule, Error) {\n\tss, err := r.GetAllForUser(uid)\n\tif err != nil {\n\t\treturn nil, err.Prefix(\"error listing all schedules\")\n\t}\n\n\tlist := make(map[ScheduleID]*schedule.Schedule)\n\tfor id, s := range ss {\n\t\tif !s.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tlist[id] = s\n\t}\n\n\treturn list, nil\n}" ]
[ "0.6269456", "0.61960685", "0.60036653", "0.59995407", "0.5843331", "0.5808705", "0.57743835", "0.5762594", "0.5711601", "0.5688818", "0.56506807", "0.558694", "0.5540339", "0.55214155", "0.5469528", "0.5466648", "0.5460155", "0.5455818", "0.5449708", "0.5426146", "0.541981", "0.53614086", "0.53557825", "0.5352077", "0.5347334", "0.53348666", "0.5302536", "0.5298099", "0.52743393", "0.52255213", "0.52226084", "0.52188975", "0.5193635", "0.5174185", "0.51694506", "0.51323915", "0.51229846", "0.5121184", "0.51132727", "0.5101932", "0.50817025", "0.50773835", "0.5063184", "0.506031", "0.5051252", "0.5026338", "0.50234646", "0.5020246", "0.50063497", "0.50050396", "0.49995384", "0.4992251", "0.498642", "0.4981392", "0.49767512", "0.49715465", "0.49603188", "0.49491102", "0.49453714", "0.49324661", "0.492966", "0.4913339", "0.49131492", "0.49095473", "0.4900042", "0.4898729", "0.48827755", "0.4875148", "0.48689395", "0.48608738", "0.48457652", "0.48436388", "0.4838241", "0.48316342", "0.4825123", "0.4823555", "0.48226184", "0.48209247", "0.4795513", "0.47929627", "0.4792825", "0.47927728", "0.47869542", "0.4777685", "0.47747838", "0.47708678", "0.47699845", "0.4763869", "0.47617042", "0.47580504", "0.4756571", "0.47463188", "0.47378236", "0.47370088", "0.47214535", "0.47114518", "0.46962944", "0.4690059", "0.46853635", "0.4684398" ]
0.6279898
0
Get takes name of the cloudwatchEventTarget, and returns the corresponding cloudwatchEventTarget object, and an error if there is any.
func (c *FakeCloudwatchEventTargets) Get(name string, options v1.GetOptions) (result *v1alpha1.CloudwatchEventTarget, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{}) if obj == nil { return nil, err } return obj.(*v1alpha1.CloudwatchEventTarget), err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetEventTarget(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EventTargetState, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tvar resource EventTarget\n\terr := ctx.ReadResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (e *EventAPI) Get(name string) (*EventType, error) {\n\teventType := &EventType{}\n\terr := e.client.httpGET(e.backOffConf.create(), e.eventURL(name), eventType, \"unable to request event types\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn eventType, nil\n}", "func (m *DeviceManagementTroubleshootingEvent) GetEventName()(*string) {\n val, err := m.GetBackingStore().Get(\"eventName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c *OutputEventContext) Get(eventName string) (*protocol.Event, error) {\n\te, ok := c.Context[eventName]\n\tif !ok {\n\t\terr := fmt.Errorf(\"cannot find the event name in OutputEventContext : %s\", eventName)\n\t\treturn nil, err\n\t}\n\treturn e, nil\n}", "func (c *FakeCloudwatchEventTargets) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{})\n\n\treturn err\n}", "func NewEventTarget(ctx *pulumi.Context,\n\tname string, args *EventTargetArgs, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tif args == nil || args.Arn == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Arn'\")\n\t}\n\tif args == nil || args.Rule == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Rule'\")\n\t}\n\tif args == nil {\n\t\targs = &EventTargetArgs{}\n\t}\n\tvar resource EventTarget\n\terr := ctx.RegisterResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (t EventType) GetName() string {\n\treturn C.GoString((*C.char)(C.gst_event_type_get_name(C.GstEventType(t))))\n}", "func (r *ProjectsTraceSinksService) Get(name string) *ProjectsTraceSinksGetCall {\n\tc := &ProjectsTraceSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (o *EventTypeIn) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (w *Watcher) GetTarget(targetName string) (*Target, error) {\n\tmutableMutex.Lock()\n\tdefer mutableMutex.Unlock()\n\tif w.TargetMap == nil {\n\t\tw.TargetMap = make(map[string]*Target)\n\t}\n\ttarget, ok := w.TargetMap[targetName]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"not exist domain\")\n\t}\n\treturn target, nil\n}", "func (c *FakeCloudwatchEventTargets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(cloudwatcheventtargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (c *Channel) Get(eventID string) (Event, error) {\n\ttxn := c.db.NewTransaction(false)\n\tdefer txn.Discard()\n\n\te, err := getEvent(txn, c.topic, eventID, c.name)\n\tif err != nil {\n\t\treturn Event{}, err\n\t}\n\n\treturn *e, nil\n}", "func (a ProblemAdapter) GetEvent() string {\n\treturn a.cloudEvent.GetType()\n}", "func (d *DevClient) GetTrigger(systemKey, name string) (map[string]interface{}, error) {\n\treturn d.GetEventHandler(systemKey, name)\n}", "func (s CloudEventResource) GetName() string {\n\treturn s.Name\n}", "func (tc *Target) EventType(space string, name eventpkg.TypeName) *eventpkg.Type {\n\ttc.eventTypeCache.RLock()\n\tdefer tc.eventTypeCache.RUnlock()\n\treturn tc.eventTypeCache.cache[libkv.EventTypeKey{Space: space, Name: name}]\n}", "func (s googleCloudStorageTargetNamespaceLister) Get(name string) (*v1alpha1.GoogleCloudStorageTarget, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"googlecloudstoragetarget\"), name)\n\t}\n\treturn obj.(*v1alpha1.GoogleCloudStorageTarget), nil\n}", "func (m *AppliedAuthenticationEventListener) GetEventType()(*AuthenticationEventType) {\n val, err := m.GetBackingStore().Get(\"eventType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*AuthenticationEventType)\n }\n return nil\n}", "func (c *FakeCloudwatchEventTargets) Update(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (m *UserSimulationEventInfo) GetEventName()(*string) {\n return m.eventName\n}", "func (c *FakeCloudwatchEventTargets) Create(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (s *StopEvent) Name() string {\n\treturn s.name\n}", "func (e *UnknownEvent) GetEventName() string {\n\treturn \"unknown\"\n}", "func (c *Event) Name() string {\n\treturn c.name\n}", "func NameOfEvent(t uint32) string {\n\tswitch t {\n\tcase SessionCreate:\n\t\treturn \"SessionCreate\"\n\tcase SessionDestroy:\n\t\treturn \"SessionDestroy\"\n\tcase TopicPublish:\n\t\treturn \"TopicPublish\"\n\tcase TopicSubscribe:\n\t\treturn \"TopicSubscribe\"\n\tcase TopicUnsubscribe:\n\t\treturn \"TopicUnsubscribe\"\n\tcase QutoChange:\n\t\treturn \"QutoChange\"\n\tcase SessionResume:\n\t\treturn \"SessionResume\"\n\tcase AuthChange:\n\t\treturn \"AuthChange\"\n\tdefault:\n\t\treturn \"Unknown\"\n\t}\n}", "func Get(c *gophercloud.ServiceClient, stackName, stackID, resourceName, eventID string) (r GetResult) {\n\tresp, err := c.Get(getURL(c, stackName, stackID, resourceName, eventID), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (s knativeEventingNamespaceLister) Get(name string) (*v1beta1.KnativeEventing, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"knativeeventing\"), name)\n\t}\n\treturn obj.(*v1beta1.KnativeEventing), nil\n}", "func (s *Structured) GetName() string {\n\treturn s.cloudEvent.Source\n}", "func (o *WebhooksJsonWebhook) GetEvent() string {\n\tif o == nil || o.Event == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Event\n}", "func (e *Event) Get(name string) uint64 {\n\tif idx, has := e.Type.Arg(name); has && idx <= len(e.Args) {\n\t\treturn e.Args[idx]\n\t}\n\treturn 0\n}", "func (m *DomainDnsSrvRecord) GetNameTarget()(*string) {\n val, err := m.GetBackingStore().Get(\"nameTarget\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (m *EventLog) Get(key string) interface{} {\n\treturn m.Payload()[key]\n}", "func (m *Reminder) GetEventWebLink()(*string) {\n val, err := m.GetBackingStore().Get(\"eventWebLink\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func GetGoCallback(name string) GoCallback {\n\tcallback, ok := goCallbacks[name]\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn callback\n}", "func (t Tags) Get(name string) string {\n\treturn t[name]\n}", "func Get(name string) (AlertClient, error) {\n\tlock.RLock()\n\tdefer lock.RUnlock()\n\n\tif v, ok := instances[name]; ok {\n\t\treturn v, nil\n\t}\n\treturn nil, ErrAlertClientNotFound\n}", "func (n *Node) GetEvent(ctx context.Context, req *api.EventRequest) (*wire.Event, error) {\n\tif err := checkSource(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// food for discovery\n\thost := api.GrpcPeerHost(ctx)\n\tn.CheckPeerIsKnown(host, nil)\n\n\tvar eventHash hash.Event\n\n\tif req.Hash != nil {\n\t\teventHash.SetBytes(req.Hash)\n\t} else {\n\t\tcreator := hash.HexToPeer(req.PeerID)\n\t\th := n.store.GetEventHash(creator, req.Index)\n\t\tif h == nil {\n\t\t\treturn nil, status.Error(codes.NotFound, fmt.Sprintf(\"event not found: %s-%d\", req.PeerID, req.Index))\n\t\t}\n\t\teventHash = *h\n\t}\n\n\tevent := n.store.GetWireEvent(eventHash)\n\tif event == nil {\n\t\treturn nil, status.Error(codes.NotFound, fmt.Sprintf(\"event not found: %s\", eventHash.Hex()))\n\t}\n\n\treturn event, nil\n}", "func (el *EventListener) GetEventName() string {\n\treturn el.EventName\n}", "func (c *EventService) Get(id string) (Event, *http.Response, error) {\n\toutput := &struct {\n\t\tData Event `json:\"data\"`\n\t}{}\n\tpath := fmt.Sprintf(\"%s/%s\", c.endpoint, id)\n\tresp, err := doGet(c.sling, path, output)\n\treturn output.Data, resp, err\n}", "func (e *TracepointEvent) GetString(name string) string {\n\tv, _ := e.tp.format.decodeString(e.data, name)\n\treturn v\n}", "func (dep *Deps) Get(name string) T {\n\n\treturn dep.deps[name]\n\n}", "func (el *EventListener) GetEventSourceName() string {\n\treturn el.EventSourceName\n}", "func (es *EventService) Get(eventID string) (e Event, err error) {\n\t// GET: /event/:eventID\n\tvar req *http.Request\n\treq, err = es.c.NewRequest(\"GET\", \"/event/\"+eventID, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresp := struct {\n\t\tStatus string\n\t\tData Event\n\t\tMessage string\n\t}{}\n\n\terr = es.c.Do(req, &resp)\n\treturn resp.Data, err\n}", "func (e *Event) GetTypeName() string {\n\treturn e.GetType().GetName()\n}", "func (m *UserExperienceAnalyticsAnomalyDevice) GetDeviceName()(*string) {\n val, err := m.GetBackingStore().Get(\"deviceName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (s tektonListenerNamespaceLister) Get(name string) (*v1alpha1.TektonListener, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"tektonlistener\"), name)\n\t}\n\treturn obj.(*v1alpha1.TektonListener), nil\n}", "func (o *CreateEventPayloadActions) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (s eventProviderNamespaceLister) Get(name string) (*v1alpha1.EventProvider, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"eventprovider\"), name)\n\t}\n\treturn obj.(*v1alpha1.EventProvider), nil\n}", "func getMessageName(eventStruct interface{}) string {\n\tif t := reflect.TypeOf(eventStruct); t.Kind() == reflect.Ptr {\n\t\treturn t.Elem().Name()\n\t} else {\n\t\treturn t.Name()\n\t}\n}", "func (s *Service) GetNode(name string) *EventNode {\n\tfor _, node := range s.eventDefinition.EventDestinations {\n\t\tif node.Name == name {\n\t\t\treturn node\n\t\t}\n\t}\n\treturn nil\n}", "func (r *DeviceManagementTroubleshootingEventRequest) Get(ctx context.Context) (resObj *DeviceManagementTroubleshootingEvent, 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 (t *Tuner) getEvent() (*C.struct_dvb_frontend_event, error) {\n\tev := new(C.struct_dvb_frontend_event)\n\terr := ioctl(t.fe.Fd(), C.iFE_GET_EVENT, unsafe.Pointer(ev))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ev, nil\n}", "func (c *Collection) GetEvent(\n\tkey, typ string, ts time.Time, ordinal int64, value interface{},\n) (*Event, error) {\n\tevent := &Event{\n\t\tCollection: c,\n\t\tKey: key,\n\t\tOrdinal: ordinal,\n\t\tTimestamp: ts,\n\t\tType: typ,\n\t}\n\n\t// Perform the actual GET\n\tpath := fmt.Sprintf(\"%s/%s/events/%s/%d/%d\", c.Name, key, typ,\n\t\tts.UnixNano()/1000000, ordinal)\n\tvar responseData jsonEvent\n\t_, err := c.client.jsonReply(\"GET\", path, nil, 200, &responseData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Move the data from the returned values into the Event object.\n\tevent.Value = responseData.Value\n\tevent.Ref = responseData.Path.Ref\n\tsecs := responseData.Timestamp / 1000\n\tnsecs := (responseData.Timestamp % 1000) * 1000000\n\tevent.Timestamp = time.Unix(secs, nsecs)\n\tevent.Ordinal = responseData.Ordinal\n\n\t// If the user provided us a place to unmarshal the 'value' field into\n\t// we do that here.\n\tif value != nil {\n\t\treturn event, event.Unmarshal(value)\n\t}\n\n\t// Success\n\treturn event, nil\n}", "func (o *StorageNetAppCloudTargetAllOf) GetName() string {\n\tif o == nil || o.Name == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "func (m *CalendarGroup) GetName()(*string) {\n val, err := m.GetBackingStore().Get(\"name\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (client *Client) Target(kind string, name string) Target {\n\tclient.mutex.RLock()\n\tdefer client.mutex.RUnlock()\n\n\tfor _, target := range client.targets {\n\t\tif target.Kind() == kind && strings.EqualFold(name, target.Name()) {\n\t\t\treturn target\n\t\t}\n\t}\n\n\treturn nil\n}", "func (e *EventAPI) Delete(name string) error {\n\treturn e.client.httpDELETE(e.backOffConf.create(), e.eventURL(name), \"unable to delete event type\")\n}", "func Get(v reflect.Value, name string) reflect.Value {\n\tif v.Kind() == reflect.Interface {\n\t\tv = v.Elem()\n\t}\n\t// dereference pointers\n\tfor v.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t}\n\tswitch v.Kind() {\n\tcase reflect.Struct:\n\t\ttyp := v.Type()\n\t\tfor i := 0; i < typ.NumField(); i++ {\n\t\t\tf := typ.Field(i)\n\t\t\tif f.PkgPath != \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tns, mapped := Field(f)\n\t\t\tif (f.Anonymous && !mapped) || ns == \"-\" {\n\t\t\t\tnV := Get(v.Field(i), name)\n\t\t\t\tif nV.IsValid() {\n\t\t\t\t\treturn nV\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ns == name {\n\t\t\t\treturn v.Field(i)\n\t\t\t}\n\t\t}\n\tcase reflect.Map:\n\t\treturn v.MapIndex(reflect.ValueOf(name))\n\t}\n\treturn reflect.Value{}\n}", "func (e *BasicEvent) Name() string {\n\treturn e.name\n}", "func GetEventDataStore(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EventDataStoreState, opts ...pulumi.ResourceOption) (*EventDataStore, error) {\n\tvar resource EventDataStore\n\terr := ctx.ReadResource(\"aws-native:cloudtrail:EventDataStore\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (o *EventAttributes) GetEvt() Event {\n\tif o == nil || o.Evt == nil {\n\t\tvar ret Event\n\t\treturn ret\n\t}\n\treturn *o.Evt\n}", "func (r *Record) Get(name string) (Value, bool) {\n\tvalue, ok := r.nameValueMap[name]\n\treturn value, ok\n}", "func (box *EventBox) Get(id uint64) (*Event, error) {\n\tobject, err := box.Box.Get(id)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if object == nil {\n\t\treturn nil, nil\n\t}\n\treturn object.(*Event), nil\n}", "func (m *Descriptor) GetMessage(name string) *Descriptor {\n\tfor _, msg := range m.GetMessages() {\n\t\t// can lookup by name or message prefixed name (qualified)\n\t\tif msg.GetName() == name || msg.GetLongName() == name {\n\t\t\treturn msg\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *SyntheticMonitorUpdate) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (s *StatusEvent) GetName() string {\n\tif s == nil || s.Name == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Name\n}", "func (hc *Actions) Get(name string) (*release.Release, error) {\n\tactGet := action.NewGet(hc.Config)\n\treturn actGet.Run(name)\n}", "func GetWebhook(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *WebhookState, opts ...pulumi.ResourceOption) (*Webhook, error) {\n\tvar resource Webhook\n\terr := ctx.ReadResource(\"datadog:index/webhook:Webhook\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (h *EventsHandlers)Get(e interface{})[]IAppEventHandler{\n\th.RLock()\n\tdefer h.RUnlock()\n\tif old, ok := h.handlers[e]; ok{\n\t\treturn old\n\t}\n\treturn nil\n}", "func (e *BasicEvent) Get(key string) any {\n\tif v, ok := e.data[key]; ok {\n\t\treturn v\n\t}\n\n\treturn nil\n}", "func (d *V8interceptor) GetByname(name string, object *V8value, retval **V8value, exception *string) int32 {\n\tname_ := C.cef_string_userfree_alloc()\n\tsetCEFStr(name, name_)\n\tdefer func() {\n\t\tC.cef_string_userfree_free(name_)\n\t}()\n\tretval_ := (*retval).toNative()\n\texception_ := C.cef_string_userfree_alloc()\n\tsetCEFStr(*exception, exception_)\n\tdefer func() {\n\t\t*exception = cefstrToString(exception_)\n\t\tC.cef_string_userfree_free(exception_)\n\t}()\n\treturn int32(C.gocef_v8interceptor_get_byname(d.toNative(), (*C.cef_string_t)(name_), object.toNative(), &retval_, (*C.cef_string_t)(exception_), d.get_byname))\n}", "func (f *FileDescriptor) GetMessage(name string) *Descriptor {\n\tfor _, m := range f.GetMessages() {\n\t\tif m.GetName() == name || m.GetLongName() == name {\n\t\t\treturn m\n\t\t}\n\t}\n\n\treturn nil\n}", "func (t *Timeline) GetEvent() string {\n\tif t == nil || t.Event == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Event\n}", "func (obs *Observer) Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error) {\n\treturn obs.client.Namespace(obs.namespace).Get(name, options, subresources...)\n}", "func (domain *Domain) GetEvent(uuid string) (*Event, error) {\n\t// determine event\n\tdomain.EventsX.RLock()\n\tevent, ok := domain.Events[uuid]\n\tdomain.EventsX.RUnlock()\n\n\tif !ok {\n\t\treturn nil, errors.New(\"event not found\")\n\t}\n\n\t// success\n\treturn event, nil\n}", "func (r *DeviceManagementAutopilotEventRequest) Get(ctx context.Context) (resObj *DeviceManagementAutopilotEvent, 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 derefEvent(e Event) Event {\n\tswitch e := e.(type) {\n\tcase *SwitchScenesEvent:\n\t\treturn *e\n\tcase *ScenesChangedEvent:\n\t\treturn *e\n\tcase *SceneCollectionChangedEvent:\n\t\treturn *e\n\tcase *SceneCollectionListChangedEvent:\n\t\treturn *e\n\tcase *SwitchTransitionEvent:\n\t\treturn *e\n\tcase *TransitionListChangedEvent:\n\t\treturn *e\n\tcase *TransitionDurationChangedEvent:\n\t\treturn *e\n\tcase *TransitionBeginEvent:\n\t\treturn *e\n\tcase *ProfileChangedEvent:\n\t\treturn *e\n\tcase *ProfileListChangedEvent:\n\t\treturn *e\n\tcase *StreamStartingEvent:\n\t\treturn *e\n\tcase *StreamStartedEvent:\n\t\treturn *e\n\tcase *StreamStoppingEvent:\n\t\treturn *e\n\tcase *StreamStoppedEvent:\n\t\treturn *e\n\tcase *StreamStatusEvent:\n\t\treturn *e\n\tcase *RecordingStartingEvent:\n\t\treturn *e\n\tcase *RecordingStartedEvent:\n\t\treturn *e\n\tcase *RecordingStoppingEvent:\n\t\treturn *e\n\tcase *RecordingStoppedEvent:\n\t\treturn *e\n\tcase *RecordingPausedEvent:\n\t\treturn *e\n\tcase *RecordingResumedEvent:\n\t\treturn *e\n\tcase *ReplayStartingEvent:\n\t\treturn *e\n\tcase *ReplayStartedEvent:\n\t\treturn *e\n\tcase *ReplayStoppingEvent:\n\t\treturn *e\n\tcase *ReplayStoppedEvent:\n\t\treturn *e\n\tcase *ExitingEvent:\n\t\treturn *e\n\tcase *HeartbeatEvent:\n\t\treturn *e\n\tcase *BroadcastCustomMessageEvent:\n\t\treturn *e\n\tcase *SourceCreatedEvent:\n\t\treturn *e\n\tcase *SourceDestroyedEvent:\n\t\treturn *e\n\tcase *SourceVolumeChangedEvent:\n\t\treturn *e\n\tcase *SourceMuteStateChangedEvent:\n\t\treturn *e\n\tcase *SourceAudioSyncOffsetChangedEvent:\n\t\treturn *e\n\tcase *SourceAudioMixersChangedEvent:\n\t\treturn *e\n\tcase *SourceRenamedEvent:\n\t\treturn *e\n\tcase *SourceFilterAddedEvent:\n\t\treturn *e\n\tcase *SourceFilterRemovedEvent:\n\t\treturn *e\n\tcase *SourceFilterVisibilityChangedEvent:\n\t\treturn *e\n\tcase *SourceFiltersReorderedEvent:\n\t\treturn *e\n\tcase *SourceOrderChangedEvent:\n\t\treturn *e\n\tcase *SceneItemAddedEvent:\n\t\treturn *e\n\tcase *SceneItemRemovedEvent:\n\t\treturn *e\n\tcase *SceneItemVisibilityChangedEvent:\n\t\treturn *e\n\tcase *SceneItemTransformChangedEvent:\n\t\treturn *e\n\tcase *SceneItemSelectedEvent:\n\t\treturn *e\n\tcase *SceneItemDeselectedEvent:\n\t\treturn *e\n\tcase *PreviewSceneChangedEvent:\n\t\treturn *e\n\tcase *StudioModeSwitchedEvent:\n\t\treturn *e\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (pgs *PGStorage) GetEvent(eventUUID uuid.UUID) (event.Event, error) {\n\tsql := \"select uuid, title, datetime, duration, description, userid, notify from events where uuid = $1\"\n\tres := make(map[string]interface{})\n\terr := pgs.DB.QueryRowxContext(pgs.Ctx, sql, eventUUID.String()).MapScan(res)\n\tif err != nil {\n\t\treturn event.Event{}, err\n\t}\n\te := event.Event{\n\t\tUUID: eventUUID,\n\t\tTitle: res[\"title\"].(string),\n\t\tDatetime: res[\"datetime\"].(time.Time),\n\t\tDuration: res[\"duration\"].(string),\n\t\tDesc: res[\"description\"].(string),\n\t\tUser: res[\"userid\"].(string),\n\t\tNotify: res[\"notify\"].(bool),\n\t}\n\treturn e, nil\n}", "func (store Manager) GetEvent(id string) (Event, error) {\n\t//\tOur return item\n\tretval := Event{}\n\n\terr := store.systemdb.View(func(tx *buntdb.Tx) error {\n\t\titem, err := tx.Get(GetKey(\"Event\", id))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(item) > 0 {\n\t\t\t//\tUnmarshal data into our item\n\t\t\tval := []byte(item)\n\t\t\tif err := json.Unmarshal(val, &retval); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\t//\tIf there was an error, report it:\n\tif err != nil {\n\t\treturn retval, fmt.Errorf(\"problem getting the event: %s\", err)\n\t}\n\n\t//\tReturn our data:\n\treturn retval, nil\n}", "func (m *ChatMessageAttachment) GetName()(*string) {\n val, err := m.GetBackingStore().Get(\"name\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (ns *Namespace) GetSource(gvk schema.GroupVersionKind, name string) *unstructured.Unstructured {\n\tpos := ns.GetPropagatedObjects(gvk)\n\tfor _, po := range pos {\n\t\tif po.GetName() == name {\n\t\t\treturn po\n\t\t}\n\t}\n\treturn nil\n}", "func (c *AuditEventClient) Get(ctx context.Context, guid string) (*resource.AuditEvent, error) {\n\tvar a resource.AuditEvent\n\terr := c.client.get(ctx, path.Format(\"/v3/audit_events/%s\", guid), &a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &a, nil\n}", "func (a Event_Payload) Get(fieldName string) (value interface{}, found bool) {\n\tif a.AdditionalProperties != nil {\n\t\tvalue, found = a.AdditionalProperties[fieldName]\n\t}\n\treturn\n}", "func (s redisTriggerNamespaceLister) Get(name string) (*v1beta1.RedisTrigger, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"redistrigger\"), name)\n\t}\n\treturn obj.(*v1beta1.RedisTrigger), nil\n}", "func (b Build) GetEvent() *api.Event {\n\treturn b.event\n}", "func (crawl *Crawl) GetHandler(name interface{}) Handler {\n\tcrawl.mutex.RLock()\n\tdefer crawl.mutex.RUnlock()\n\treturn crawl.handlers[name]\n}", "func derefEvent(e Event) Event {\n\tswitch e := e.(type) {\n\tcase *SwitchScenesEvent:\n\t\treturn *e\n\tcase *ScenesChangedEvent:\n\t\treturn *e\n\tcase *SceneCollectionChangedEvent:\n\t\treturn *e\n\tcase *SceneCollectionListChangedEvent:\n\t\treturn *e\n\tcase *SwitchTransitionEvent:\n\t\treturn *e\n\tcase *TransitionListChangedEvent:\n\t\treturn *e\n\tcase *TransitionDurationChangedEvent:\n\t\treturn *e\n\tcase *TransitionBeginEvent:\n\t\treturn *e\n\tcase *ProfileChangedEvent:\n\t\treturn *e\n\tcase *ProfileListChangedEvent:\n\t\treturn *e\n\tcase *StreamStartingEvent:\n\t\treturn *e\n\tcase *StreamStartedEvent:\n\t\treturn *e\n\tcase *StreamStoppingEvent:\n\t\treturn *e\n\tcase *StreamStoppedEvent:\n\t\treturn *e\n\tcase *StreamStatusEvent:\n\t\treturn *e\n\tcase *RecordingStartingEvent:\n\t\treturn *e\n\tcase *RecordingStartedEvent:\n\t\treturn *e\n\tcase *RecordingStoppingEvent:\n\t\treturn *e\n\tcase *RecordingStoppedEvent:\n\t\treturn *e\n\tcase *ReplayStartingEvent:\n\t\treturn *e\n\tcase *ReplayStartedEvent:\n\t\treturn *e\n\tcase *ReplayStoppingEvent:\n\t\treturn *e\n\tcase *ReplayStoppedEvent:\n\t\treturn *e\n\tcase *ExitingEvent:\n\t\treturn *e\n\tcase *HeartbeatEvent:\n\t\treturn *e\n\tcase *SourceOrderChangedEvent:\n\t\treturn *e\n\tcase *SceneItemAddedEvent:\n\t\treturn *e\n\tcase *SceneItemRemovedEvent:\n\t\treturn *e\n\tcase *SceneItemVisibilityChangedEvent:\n\t\treturn *e\n\tcase *PreviewSceneChangedEvent:\n\t\treturn *e\n\tcase *StudioModeSwitchedEvent:\n\t\treturn *e\n\tdefault:\n\t\treturn nil\n\t}\n}", "func GetKeyValueExpireViaName(iName string) (*KeyValueExpire, error) {\n\tvar _KeyValueExpire = &KeyValueExpire{Name: iName}\n\thas, err := Engine.Get(_KeyValueExpire)\n\tif has {\n\t\treturn _KeyValueExpire, err\n\t} else {\n\t\treturn nil, err\n\t}\n}", "func (b EmployeeDeletedEvent) EventName() string {\n\treturn b.Event\n}", "func (r *ProjectsMetricDescriptorsService) Get(name string) *ProjectsMetricDescriptorsGetCall {\n\tc := &ProjectsMetricDescriptorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (r *ProjectsLocationsProcessesRunsLineageEventsService) Get(name string) *ProjectsLocationsProcessesRunsLineageEventsGetCall {\n\tc := &ProjectsLocationsProcessesRunsLineageEventsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (s *CloudService) GetByName(name string) (*getting.Cloud, error) {\n\tcount := 0\n\tindex := 0\n\titems, err := s.GetAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor i, item := range items {\n\t\tif name == *item.Name {\n\t\t\tindex = i\n\t\t\tcount++\n\t\t}\n\t}\n\tif count == 0 {\n\t\treturn nil, errors.New(\"Cloud not found\")\n\t} else if count > 1 {\n\t\treturn nil, errors.New(\"More than one Cloud found by this name, use GetByID instead\")\n\t}\n\treturn items[index], nil\n}", "func (d *DI) Get(name string) interface{} {\n\td.mutex.RLock()\n\tv := d.store[name]\n\td.mutex.RUnlock()\n\treturn v\n}", "func getFieldValue(e reflect.Value, name string) interface{} {\n\tswitch e.Kind() {\n\tcase reflect.Ptr:\n\t\telem := e.Elem()\n\t\treturn getFieldValue(elem, name)\n\tcase reflect.Struct:\n\t\tf := e.FieldByName(strings.Title(name))\n\t\tif f.IsValid() {\n\t\t\treturn f.Interface()\n\t\t}\n\tcase reflect.Map:\n\t\tm, _ := e.Interface().(map[string]interface{})\n\t\treturn m[name]\n\t}\n\treturn nil\n}", "func (engine *ECE) RetrieveEvent(reqId string) *Event {\n\tengine.RLock()\n\te, exists := engine.Events[reqId]\n\tengine.RUnlock()\n\n\tif exists {\n\t\treturn e\n\t}\n\n\treturn nil\n}", "func (s targetNamespaceLister) Get(name string) (*v1alpha1.Target, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"target\"), name)\n\t}\n\treturn obj.(*v1alpha1.Target), nil\n}", "func Get(name string) *Logger {\n\treturn loggers[name]\n}", "func (t *Target) GetValue(name string) string {\n\treturn t.labels.Get(name)\n}", "func (c *FakeAWSSNSTargets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AWSSNSTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(awssnstargetsResource, c.ns, name), &v1alpha1.AWSSNSTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.AWSSNSTarget), err\n}", "func (e *EventParser) GetBitbucketCloudPullEventType(eventTypeHeader string, sha string, pr string) models.PullRequestEventType {\n\tswitch eventTypeHeader {\n\tcase bitbucketcloud.PullCreatedHeader:\n\t\tlastBitbucketSha.Add(pr, sha)\n\t\treturn models.OpenedPullEvent\n\tcase bitbucketcloud.PullUpdatedHeader:\n\t\tlastSha, _ := lastBitbucketSha.Get(pr)\n\t\tif sha == lastSha {\n\t\t\t// No change, ignore\n\t\t\treturn models.OtherPullEvent\n\t\t}\n\t\tlastBitbucketSha.Add(pr, sha)\n\t\treturn models.UpdatedPullEvent\n\tcase bitbucketcloud.PullFulfilledHeader, bitbucketcloud.PullRejectedHeader:\n\t\treturn models.ClosedPullEvent\n\t}\n\treturn models.OtherPullEvent\n}" ]
[ "0.72349846", "0.60446095", "0.5682909", "0.54533374", "0.5292888", "0.5286852", "0.52845055", "0.51380754", "0.51060545", "0.5100123", "0.49953666", "0.49781477", "0.4978093", "0.49507922", "0.49051094", "0.48928928", "0.4878934", "0.48690373", "0.48504093", "0.48341855", "0.48302954", "0.4774812", "0.47597277", "0.47561", "0.4737843", "0.47368854", "0.47326946", "0.47318193", "0.4702869", "0.47004792", "0.46971053", "0.46969885", "0.469356", "0.46752384", "0.4648671", "0.46459308", "0.46454394", "0.46365753", "0.46216327", "0.45898575", "0.4567365", "0.45666626", "0.45638457", "0.45501667", "0.45167488", "0.45086628", "0.44899186", "0.44868094", "0.44737318", "0.4464219", "0.44599128", "0.44492722", "0.4447878", "0.44311395", "0.44306734", "0.44193646", "0.44167453", "0.44123593", "0.4411542", "0.4396613", "0.43874782", "0.43808848", "0.43713176", "0.43671682", "0.4363337", "0.43624514", "0.43539387", "0.43509743", "0.4345924", "0.43457192", "0.43426266", "0.43399456", "0.43395478", "0.43394813", "0.43322703", "0.43315062", "0.43249848", "0.43246126", "0.43208012", "0.43195018", "0.43167838", "0.43166974", "0.43058062", "0.43052024", "0.42996928", "0.4294583", "0.4294274", "0.42930076", "0.42927662", "0.4288362", "0.4287482", "0.4287287", "0.428574", "0.42823574", "0.4277565", "0.42764813", "0.427329", "0.4269642", "0.42634568", "0.42626032" ]
0.7304512
0
List takes label and field selectors, and returns the list of CloudwatchEventTargets that match those selectors.
func (c *FakeCloudwatchEventTargets) List(opts v1.ListOptions) (result *v1alpha1.CloudwatchEventTargetList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(cloudwatcheventtargetsResource, cloudwatcheventtargetsKind, c.ns, opts), &v1alpha1.CloudwatchEventTargetList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1alpha1.CloudwatchEventTargetList{ListMeta: obj.(*v1alpha1.CloudwatchEventTargetList).ListMeta} for _, item := range obj.(*v1alpha1.CloudwatchEventTargetList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *FakeAWSSNSTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AWSSNSTargetList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(awssnstargetsResource, awssnstargetsKind, c.ns, opts), &v1alpha1.AWSSNSTargetList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.AWSSNSTargetList{ListMeta: obj.(*v1alpha1.AWSSNSTargetList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.AWSSNSTargetList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (w *Watcher) GetTargetNameList() ([]string) {\n\tmutableMutex.Lock()\n\tdefer mutableMutex.Unlock()\n\tif w.TargetMap == nil {\n\t\tw.TargetMap = make(map[string]*Target)\n\t}\n\ttargetNameList := make([]string, 0, len(w.TargetMap))\n\tfor tn := range w.TargetMap {\n\t\ttargetNameList = append(targetNameList, tn)\n\t}\n\treturn targetNameList\n}", "func (s *targetLister) List(selector labels.Selector) (ret []*v1alpha1.Target, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.Target))\n\t})\n\treturn ret, err\n}", "func (s *googleCloudStorageTargetLister) List(selector labels.Selector) (ret []*v1alpha1.GoogleCloudStorageTarget, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.GoogleCloudStorageTarget))\n\t})\n\treturn ret, err\n}", "func (c *FakeAzureEventHubsSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureEventHubsSourceList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(azureeventhubssourcesResource, azureeventhubssourcesKind, c.ns, opts), &v1alpha1.AzureEventHubsSourceList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.AzureEventHubsSourceList{ListMeta: obj.(*v1alpha1.AzureEventHubsSourceList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.AzureEventHubsSourceList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (es *EventService) List(q *EventListRequest) (el EventList, err error) {\n\t// GET: /events\n\tvar req *http.Request\n\treq, err = es.c.NewRequest(\"GET\", \"/events\", q)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = es.c.Do(req, &el)\n\treturn\n}", "func (c *RPCClient) ListTargets() ([]api.Target, error) {\n\tout := &ListTargetsOut{}\n\terr := c.call(\"ListTargets\", ListTargetsIn{}, out)\n\treturn out.Targets, err\n}", "func (h *Handler) ListByLabel(labels string) ([]*unstructured.Unstructured, error) {\n\tlistOptions := h.Options.ListOptions.DeepCopy()\n\tlistOptions.LabelSelector = labels\n\n\tif err := h.getGVRAndNamespaceScope(); err != nil {\n\t\treturn nil, err\n\t}\n\tif h.isNamespaced {\n\t\treturn extractList(h.dynamicClient.Resource(h.gvr).Namespace(h.namespace).List(h.ctx, *listOptions))\n\t}\n\treturn extractList(h.dynamicClient.Resource(h.gvr).List(h.ctx, *listOptions))\n}", "func (t *Target) List(verbose bool, nameWidth int) {\n\tif !verbose {\n\t\tif strings.HasPrefix(t.Name, \"_\") {\n\t\t\t// skip targets in non verbose mode as hidden.\n\t\t\treturn\n\t\t}\n\t\tpadWidth := nameWidth - len(t.Name)\n\t\tpaddedName := color.Yellow(t.Name)\n\t\tif padWidth > 0 {\n\t\t\tpaddedName += strings.Repeat(\" \", padWidth)\n\t\t}\n\t\tout := fmt.Sprintf(\"%s %s\\n\", paddedName, strings.TrimSpace(t.Description))\n\t\t_, err := t.W.Write([]byte(out))\n\t\tif err != nil {\n\t\t\tlog.Println(color.Red(err.Error()))\n\t\t}\n\t\treturn\n\t}\n\n\t// target name\n\tout := fmt.Sprintf(\"%s: \\n\", color.Yellow(t.Name))\n\n\t// target description\n\tif t.Description != \"\" {\n\t\tout += fmt.Sprintf(\" - description: %s\\n\", strings.TrimSpace(t.Description))\n\t}\n\n\t// target before\n\tif len(t.Before) > 0 {\n\t\tbeforeList := \" - before: \" + strings.Join(t.Before, \", \")\n\t\tout += fmt.Sprintln(beforeList)\n\t}\n\n\t// target after\n\tif len(t.After) > 0 {\n\t\tafterList := \" - after: \" + strings.Join(t.After, \", \")\n\t\tout += fmt.Sprintln(afterList)\n\t}\n\n\t// target command\n\tout += fmt.Sprintf(\" - cmd:\\n \")\n\tout += fmt.Sprintln(strings.Replace(t.Cmd, \"\\n\", \"\\n \", -1))\n\t_, err := t.W.Write([]byte(out))\n\tif err != nil {\n\t\tlog.Println(color.Red(err.Error()))\n\t}\n}", "func (c *FakeRedisTriggers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.RedisTriggerList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(redistriggersResource, redistriggersKind, c.ns, opts), &v1beta1.RedisTriggerList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1beta1.RedisTriggerList{ListMeta: obj.(*v1beta1.RedisTriggerList).ListMeta}\n\tfor _, item := range obj.(*v1beta1.RedisTriggerList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (c *FakeGoogleCloudPubSubSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GoogleCloudPubSubSourceList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(googlecloudpubsubsourcesResource, googlecloudpubsubsourcesKind, c.ns, opts), &v1alpha1.GoogleCloudPubSubSourceList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.GoogleCloudPubSubSourceList{ListMeta: obj.(*v1alpha1.GoogleCloudPubSubSourceList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.GoogleCloudPubSubSourceList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (c *FakeCloudwatchEventTargets) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(cloudwatcheventtargetsResource, c.ns, opts))\n\n}", "func (client *Client) ListTargets(request *ListTargetsRequest) (_result *ListTargetsResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &ListTargetsResponse{}\n\t_body, _err := client.ListTargetsWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func listTargetsHandler(w http.ResponseWriter, r *http.Request) {\n\n}", "func (c *AuditEventClient) List(ctx context.Context, opts *AuditEventListOptions) ([]*resource.AuditEvent, *Pager, error) {\n\tif opts == nil {\n\t\topts = NewAuditEventListOptions()\n\t}\n\tvar res resource.AuditEventList\n\terr := c.client.get(ctx, path.Format(\"/v3/audit_events?%s\", opts.ToQueryString()), &res)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tpager := NewPager(res.Pagination)\n\treturn res.Resources, pager, nil\n}", "func (client *Client) ListTargetsWithOptions(request *ListTargetsRequest, runtime *util.RuntimeOptions) (_result *ListTargetsResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = &ListTargetsResponse{}\n\t_body, _err := client.DoRequest(tea.String(\"listTargets\"), tea.String(\"HTTP\"), tea.String(\"POST\"), tea.String(\"/openapi/listTargets\"), nil, tea.ToMap(request), 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 (e *event) List() []string {\n\te.RLock()\n\tdefer e.RUnlock()\n\tlist := make([]string, 0, len(e.events))\n\tfor name := range e.events {\n\t\tlist = append(list, name)\n\t}\n\treturn list\n}", "func List() *Event {\n\treturn &Event{}\n}", "func (s googleCloudStorageTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.GoogleCloudStorageTarget, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.GoogleCloudStorageTarget))\n\t})\n\treturn ret, err\n}", "func (h *Handler) ListByLabel(labels string) ([]*corev1.Node, error) {\n\tlistOptions := h.Options.ListOptions.DeepCopy()\n\tlistOptions.LabelSelector = labels\n\tnodeList, err := h.clientset.CoreV1().Nodes().List(h.ctx, *listOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn extractList(nodeList), nil\n}", "func (c *FakeTraefikServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TraefikServiceList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(traefikservicesResource, traefikservicesKind, c.ns, opts), &v1alpha1.TraefikServiceList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.TraefikServiceList{ListMeta: obj.(*v1alpha1.TraefikServiceList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.TraefikServiceList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (tc *Configs) List(verbose bool, fuzzy string) {\n\tfilePrefix, fuzzyTarget := splitTarget(fuzzy)\nLOOP_FILES:\n\tfor _, tf := range tc.Files {\n\t\t// If a file prefix is provided check this file matches.\n\t\tif filePrefix != \"\" && tf.Basename() != filePrefix {\n\t\t\tcontinue LOOP_FILES\n\t\t}\n\n\t\ttargetNameWidth := 0\n\t\ttargetNames := []string{}\n\tLOOP_TARGETS:\n\t\tfor k := range tf.Targets {\n\t\t\tif len(k) > targetNameWidth {\n\t\t\t\ttargetNameWidth = len(k)\n\t\t\t}\n\t\t\tif fuzzyTarget != \"\" {\n\t\t\t\tif ok, _ := filepath.Match(fuzzyTarget, k); !ok {\n\t\t\t\t\tcontinue LOOP_TARGETS\n\t\t\t\t}\n\t\t\t}\n\t\t\ttargetNames = append(targetNames, k)\n\t\t}\n\t\tsort.Strings(targetNames)\n\t\tbasename := tf.Basename()\n\t\ttc.StdOut.Write([]byte(color.Green(fmt.Sprintf(\"(%s) %s\\n\", basename, tf.Filepath))))\n\t\tfor _, targetName := range targetNames {\n\t\t\tif target, ok := tc.Target(basename + \":\" + targetName); ok {\n\t\t\t\ttarget.List(verbose, targetNameWidth)\n\t\t\t}\n\t\t}\n\t\ttc.StdOut.Write([]byte(color.Green(\"---\\n\\n\")))\n\t}\n}", "func (c *CloudWatchEvents) ListTargetsByRuleRequest(input *ListTargetsByRuleInput) (req *request.Request, output *ListTargetsByRuleOutput) {\n\top := &request.Operation{\n\t\tName: opListTargetsByRule,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/\",\n\t}\n\n\tif input == nil {\n\t\tinput = &ListTargetsByRuleInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &ListTargetsByRuleOutput{}\n\treq.Data = output\n\treturn\n}", "func (nlbHandler *GCPNLBHandler) listTargetPools(regionID string, filter string) (*compute.TargetPoolList, error) {\n\n\t// path param\n\tprojectID := nlbHandler.Credential.ProjectID\n\n\tresp, err := nlbHandler.Client.TargetPools.List(projectID, regionID).Do()\n\tif err != nil {\n\t\treturn &compute.TargetPoolList{}, err\n\t}\n\n\tfor _, item := range resp.Items {\n\t\tcblogger.Info(item)\n\t}\n\n\treturn resp, nil\n\n}", "func (c *FakeListeners) List(ctx context.Context, opts v1.ListOptions) (result *networkextensionv1.ListenerList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(listenersResource, listenersKind, c.ns, opts), &networkextensionv1.ListenerList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &networkextensionv1.ListenerList{ListMeta: obj.(*networkextensionv1.ListenerList).ListMeta}\n\tfor _, item := range obj.(*networkextensionv1.ListenerList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (e *Event) List(c echo.Context, p *takrib.Pagination) ([]takrib.Event, error) {\n\tau := e.rbac.User(c)\n\tq, err := query.List(au)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn e.udb.List(e.db, q, p)\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 (s targetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Target, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.Target))\n\t})\n\treturn ret, err\n}", "func (CloudWatchEventSource) Values() []CloudWatchEventSource {\n\treturn []CloudWatchEventSource{\n\t\t\"EC2\",\n\t\t\"CODE_DEPLOY\",\n\t\t\"HEALTH\",\n\t\t\"RDS\",\n\t}\n}", "func (c *TestClient) ListTargetInstances(project, zone string, opts ...ListCallOption) ([]*compute.TargetInstance, error) {\n\tif c.ListTargetInstancesFn != nil {\n\t\treturn c.ListTargetInstancesFn(project, zone, opts...)\n\t}\n\treturn c.client.ListTargetInstances(project, zone, opts...)\n}", "func (n *GlobalNotification) Targets() []string {\r\n\treturn make([]string, 0)\r\n}", "func (d *Dao) AllTargets(c context.Context, state int) (res []*model.Target, err error) {\n\tvar rows *xsql.Rows\n\tif rows, err = d.db.Query(c, _allTargetsSQL, state); err != nil {\n\t\tlog.Error(\"d.AllTargets.Query error(%+v), sql(%s)\", err, _allTargetsSQL)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar t = &model.Target{}\n\t\tif err = rows.Scan(&t.ID, &t.SubEvent, &t.Event, &t.Product, &t.Source, &t.GroupIDs, &t.Threshold, &t.Duration, &t.State, &t.Ctime, &t.Mtime); err != nil {\n\t\t\tlog.Error(\"d.AllTargets.Scan error(%+v), sql(%s)\", err, _allTargetsSQL)\n\t\t\treturn\n\t\t}\n\t\tif t.GroupIDs != \"\" {\n\t\t\tvar gids []int64\n\t\t\tif gids, err = xstr.SplitInts(t.GroupIDs); err != nil {\n\t\t\t\tlog.Error(\"d.Product.SplitInts error(%+v), group ids(%s)\", err, t.GroupIDs)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif t.Groups, err = d.Groups(c, gids); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tres = append(res, t)\n\t}\n\terr = rows.Err()\n\treturn\n}", "func (e EmptyTargetsNotaryRepository) ListTargets(...data.RoleName) ([]*client.TargetWithRole, error) {\n\treturn []*client.TargetWithRole{}, nil\n}", "func list_targets(w rest.ResponseWriter, r *rest.Request) {\n\tarch := r.PathParam(\"arch\")\n\tsoftware := r.PathParam(\"software\")\n\tversion := r.PathParam(\"version\")\n\n\t// Doesn't need to be cached, as its calls are already cached.\n\ttargets := BasicResults{}\n\tlatest_date := time.Time{}\n\ttarget_path := get_target_path(arch, version)\n\tfiles := get_files(cache_instance, db, target_path)\n\tfor _, file := range files {\n\t\tarchive := new(Archive)\n\t\tarchive = archive.Init(file.Path)\n\t\tif archive.Software == software {\n\t\t\tparsed_time, err := time.Parse(\"2006-01-02\", archive.Date)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tparsed_time = time.Time{}\n\t\t\t}\n\t\t\tif parsed_time.After(latest_date) {\n\t\t\t\tlatest_date = parsed_time\n\t\t\t}\n\t\t\ttargets = append(targets, BasicResult{archive.Tag, archive.Date})\n\t\t}\n\t}\n\ttargets = append(targets, BasicResult{\"latest\", latest_date.Format(\"2006-01-02\")})\n\n\t// Sort the targets by date descending.\n\tsort.Sort(targets)\n\n\tw.WriteJson(targets)\n}", "func (r *EventTagsService) List(profileId int64) *EventTagsListCall {\n\tc := &EventTagsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\treturn c\n}", "func (c *FakeEndpointsServices) List(opts v1.ListOptions) (result *v1alpha1.EndpointsServiceList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(endpointsservicesResource, endpointsservicesKind, c.ns, opts), &v1alpha1.EndpointsServiceList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.EndpointsServiceList{ListMeta: obj.(*v1alpha1.EndpointsServiceList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.EndpointsServiceList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func eventFilterList(amount int) string {\n\tvar eventTypes []string\n\tfor i := 0; i < amount; i++ {\n\t\teventTypes = append(eventTypes, fmt.Sprintf(\":eventType%d\", i))\n\t}\n\treturn \"(\" + strings.Join(eventTypes, \", \") + \")\"\n}", "func (l LoadedNotaryRepository) ListTargets(roles ...data.RoleName) ([]*client.TargetWithRole, error) {\n\tfilteredTargets := []*client.TargetWithRole{}\n\tfor _, tgt := range loadedTargets {\n\t\tif len(roles) == 0 || (len(roles) > 0 && roles[0] == tgt.Role.Name) {\n\t\t\tfilteredTargets = append(filteredTargets, &client.TargetWithRole{Target: tgt.Target, Role: tgt.Role.Name})\n\t\t}\n\t}\n\treturn filteredTargets, nil\n}", "func (lw *EventListWatch) List(options api.ListOptions) (runtime.Object, error) {\n\treturn lw.ListFunc(options)\n}", "func (l LoadedWithNoSignersNotaryRepository) ListTargets(roles ...data.RoleName) ([]*client.TargetWithRole, error) {\n\tfilteredTargets := []*client.TargetWithRole{}\n\tfor _, tgt := range loadedTargets {\n\t\tif len(roles) == 0 || (len(roles) > 0 && roles[0] == tgt.Role.Name) {\n\t\t\tfilteredTargets = append(filteredTargets, &client.TargetWithRole{Target: tgt.Target, Role: tgt.Role.Name})\n\t\t}\n\t}\n\treturn filteredTargets, nil\n}", "func (e *EventAPI) List() ([]*EventType, error) {\n\teventTypes := []*EventType{}\n\terr := e.client.httpGET(e.backOffConf.create(), e.eventBaseURL(), &eventTypes, \"unable to request event types\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn eventTypes, nil\n}", "func (c *FakeECSDeployments) List(opts v1.ListOptions) (result *ecskube.ECSDeploymentList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(ecsdeploymentsResource, ecsdeploymentsKind, c.ns, opts), &ecskube.ECSDeploymentList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &ecskube.ECSDeploymentList{}\n\tfor _, item := range obj.(*ecskube.ECSDeploymentList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (re *stubRegistrationService) ListBySelector(ctx context.Context, request common.Selector) (reply common.RegistrationEntries, err error) {\n\treturn reply, err\n}", "func (c *EventService) List(params *EventParams) ([]Event, *http.Response, error) {\n\toutput := &struct {\n\t\tData []Event `json:\"data\"`\n\t}{}\n\tresp, err := doList(c.sling, c.endpoint, params, output)\n\treturn output.Data, resp, err\n}", "func (svc *Service) List(ownerID string, search string, maxResults int) ([]*calendar.Event, error) {\n\tmsEvents := &types.Events{}\n\turl := fmt.Sprintf(\"%s&$top=%v&$filter=startswith(subject,'%s')\", deltaLink(ownerID), maxResults, search)\n\t// fmt.Println(url)\n\t_, err := svc.client.Get(url, msEvents)\n\tif err != nil {\n\t\treturn []*calendar.Event{}, errors.Wrap(err, \"Unable to perform list\")\n\t}\n\n\tevents := []*calendar.Event{}\n\tfor _, msEvent := range msEvents.Events {\n\t\tevent := convertToGoogleEvent(msEvent)\n\t\tevents = append(events, event)\n\t}\n\n\treturn events, nil\n}", "func (c *FakeRobots) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RobotList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(robotsResource, robotsKind, c.ns, opts), &v1alpha1.RobotList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.RobotList{ListMeta: obj.(*v1alpha1.RobotList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.RobotList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (c *FakeRuleEndpoints) List(ctx context.Context, opts v1.ListOptions) (result *rulesv1.RuleEndpointList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(ruleendpointsResource, ruleendpointsKind, c.ns, opts), &rulesv1.RuleEndpointList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &rulesv1.RuleEndpointList{ListMeta: obj.(*rulesv1.RuleEndpointList).ListMeta}\n\tfor _, item := range obj.(*rulesv1.RuleEndpointList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func targetsForEndpoints(endpoints []util.Endpoint) []kongstate.Target {\n\ttargets := []kongstate.Target{}\n\tfor _, endpoint := range endpoints {\n\t\ttarget := kongstate.Target{\n\t\t\tTarget: kong.Target{\n\t\t\t\tTarget: kong.String(endpoint.Address + \":\" + endpoint.Port),\n\t\t\t},\n\t\t}\n\t\ttargets = append(targets, target)\n\t}\n\treturn targets\n}", "func (c *FakeIotDpses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IotDpsList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(iotdpsesResource, iotdpsesKind, c.ns, opts), &v1alpha1.IotDpsList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.IotDpsList{ListMeta: obj.(*v1alpha1.IotDpsList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.IotDpsList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (l Leftovers) List(filter string, regex bool) {\n\tl.logger.NoConfirm()\n\tvar deletables []common.Deletable\n\n\tfor _, r := range l.resources {\n\t\tlist, err := r.List(filter, regex)\n\t\tif err != nil {\n\t\t\tl.logger.Println(color.YellowString(err.Error()))\n\t\t}\n\n\t\tdeletables = append(deletables, list...)\n\t}\n\n\tfor _, d := range deletables {\n\t\tl.logger.Println(fmt.Sprintf(\"[%s: %s]\", d.Type(), d.Name()))\n\t}\n}", "func (l Leftovers) List(filter string, regex bool) {\n\tl.logger.NoConfirm()\n\n\tvar deletables []common.Deletable\n\n\tfor _, r := range l.resources {\n\t\tlist, err := r.List(filter, regex)\n\t\tif err != nil {\n\t\t\tl.logger.Println(color.YellowString(err.Error()))\n\t\t}\n\n\t\tdeletables = append(deletables, list...)\n\t}\n\n\tfor _, d := range deletables {\n\t\tl.logger.Println(fmt.Sprintf(\"[%s: %s]\", d.Type(), d.Name()))\n\t}\n}", "func (r *ProjectsLogServicesSinksService) List(projectsId string, logServicesId string) *ProjectsLogServicesSinksListCall {\n\treturn &ProjectsLogServicesSinksListCall{\n\t\ts: r.s,\n\t\tprojectsId: projectsId,\n\t\tlogServicesId: logServicesId,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks\",\n\t}\n}", "func (k *Client) ListActiveTargets(upstream string) (*TargetListResponse, error) {\n\tres, err := k.get(\"/upstreams/\"+upstream+\"/targets/active\", nil)\n\tif err != nil {\n\t\tlogrus.WithError(err).WithFields(logrus.Fields{\n\t\t\t\"upstream\": upstream,\n\t\t}).Error(\"unable to fetch upstream targets\")\n\t\treturn nil, err\n\t}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlogrus.WithError(err).WithFields(logrus.Fields{\n\t\t\t\"upstream\": upstream,\n\t\t}).Error(\"unable to fetch upstream targets\")\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode >= 400 {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"upstream\": upstream,\n\t\t}).Error(\"unable to fetch upstream targets\")\n\t\treturn nil, errors.New(res.Status)\n\t}\n\t// FIXME\n\t// We have to verify the result size before unmarshal\n\t// because Kong API is not consitent and return an empty\n\t// object instead of an empty array if no results.\n\tvar lightResult LightTargetListResponse\n\terr = json.Unmarshal(body, &lightResult)\n\tif err != nil {\n\t\tlogrus.WithError(err).WithFields(logrus.Fields{\n\t\t\t\"upstream\": upstream,\n\t\t}).Error(\"unable to decode response\")\n\t\treturn nil, err\n\t}\n\tvar result TargetListResponse\n\tif lightResult.Total == 0 {\n\t\tresult = TargetListResponse{\n\t\t\tTotal: 0,\n\t\t\tData: make([]TargetResponse, 0, 0),\n\t\t}\n\t} else {\n\t\terr = json.Unmarshal(body, &result)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).WithFields(logrus.Fields{\n\t\t\t\t\"upstream\": upstream,\n\t\t\t}).Error(\"unable to decode response\")\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &result, nil\n}", "func (*TagsService) List(tagsFields []TagsField, tagsArgs ...TagsArgument) Query {\n\tif len(tagsFields) == 0 {\n\t\treturn Query{\n\t\t\tname: \"tags\",\n\t\t\tfields: []field{\n\t\t\t\tTagsIDField().field,\n\t\t\t},\n\t\t}\n\t}\n\n\tvar fields []field\n\tfor _, tf := range tagsFields {\n\t\tfields = append(fields, tf.field)\n\t}\n\tvar args []argument\n\tfor _, ta := range tagsArgs {\n\t\targs = append(args, ta.arg)\n\t}\n\treturn Query{\n\t\tname: \"tags\",\n\t\tfields: fields,\n\t\targs: args,\n\t}\n}", "func (client *Client) Targets(kinds ...string) []Target {\n\tif len(kinds) == 0 {\n\t\tclient.mutex.Lock()\n\t\ttargets := make([]Target, len(client.targets))\n\t\tcopy(targets, client.targets)\n\t\tclient.mutex.Unlock()\n\n\t\treturn targets\n\t}\n\n\tclient.mutex.Lock()\n\ttargets := make([]Target, 0, len(client.targets))\n\tfor _, target := range client.targets {\n\t\tfor _, kind := range kinds {\n\t\t\tif target.Kind() == kind {\n\t\t\t\ttargets = append(targets, target)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tclient.mutex.Unlock()\n\n\treturn targets\n}", "func (c *CloudWatchEvents) ListRuleNamesByTargetRequest(input *ListRuleNamesByTargetInput) (req *request.Request, output *ListRuleNamesByTargetOutput) {\n\top := &request.Operation{\n\t\tName: opListRuleNamesByTarget,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/\",\n\t}\n\n\tif input == nil {\n\t\tinput = &ListRuleNamesByTargetInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &ListRuleNamesByTargetOutput{}\n\treq.Data = output\n\treturn\n}", "func SelectorLabels(name, instance string) map[string]string {\n\treturn map[string]string{\n\t\tApplicationNameLabelKey: name,\n\t\tApplicationInstanceLabelKey: instance,\n\t}\n}", "func (NotificationTarget) Values() []NotificationTarget {\n\treturn []NotificationTarget{\n\t\t\"EventBridge\",\n\t\t\"SNS\",\n\t\t\"SQS\",\n\t}\n}", "func Targets(t []string) RequestOption {\n\treturn func(o *RequestOptions) {\n\t\to.Targets = t\n\t}\n}", "func (s *tektonListenerLister) List(selector labels.Selector) (ret []*v1alpha1.TektonListener, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.TektonListener))\n\t})\n\treturn ret, err\n}", "func (s *eventProviderLister) List(selector labels.Selector) (ret []*v1alpha1.EventProvider, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.EventProvider))\n\t})\n\treturn ret, err\n}", "func (dtm *DfgetTaskManager) List(ctx context.Context, filter map[string]string) (dfgetTaskList []*types.DfGetTask, err error) {\n\treturn nil, nil\n}", "func findFirewallRulesByTarget(rules []*gkeCompute.Firewall, clusterName string) []*gkeCompute.Firewall {\n\tvar firewalls []*gkeCompute.Firewall\n\tfor _, r := range rules {\n\t\tif r != nil {\n\t\t\tif strings.Contains(r.Description, kubernetesIO) {\n\t\t\t\tfor _, tag := range r.TargetTags {\n\t\t\t\t\tlog.Debugf(\"firewall rule[%s] target tag: %s\", r.Name, tag)\n\t\t\t\t\tif strings.HasPrefix(tag, targetPrefix+clusterName) {\n\t\t\t\t\t\tlog.Debugf(\"append firewall list[%s]\", r.Name)\n\t\t\t\t\t\tfirewalls = append(firewalls, r)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn firewalls\n}", "func GetTargets(addrList string) []*Target {\r\n\taddrs := strings.Split(addrList, \",\")\r\n\ttargets := make([]*Target, len(addrs))\r\n\tfor i, addr := range addrs {\r\n\t\taddr = strings.TrimPrefix(addr, \"http://\") // convert to correct format\r\n\t\ttargets[i] = &Target{addr, \"http\"}\r\n\t}\r\n\treturn targets\r\n}", "func (d *Dao) TargetsByQuery(c context.Context, where string) (res []*model.Target, err error) {\n\tvar rows *xsql.Rows\n\tif rows, err = d.db.Query(c, _targetQuerySQL+where); err != nil {\n\t\tlog.Error(\"d.TargetsByQuery.Query error(%+v), sql(%s)\", err, _targetQuerySQL+where)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar t = &model.Target{}\n\t\tif err = rows.Scan(&t.ID, &t.SubEvent, &t.Event, &t.Product, &t.Source, &t.GroupIDs, &t.Threshold, &t.Duration, &t.State, &t.Ctime, &t.Mtime); err != nil {\n\t\t\tlog.Error(\"d.TargetsByQuery.Scan error(%+v), sql(%s)\", err, _targetQuerySQL+where)\n\t\t\treturn\n\t\t}\n\t\tif t.GroupIDs != \"\" {\n\t\t\tvar gids []int64\n\t\t\tif gids, err = xstr.SplitInts(t.GroupIDs); err != nil {\n\t\t\t\tlog.Error(\"d.Product.SplitInts error(%+v), group ids(%s)\", err, t.GroupIDs)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif t.Groups, err = d.Groups(c, gids); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tres = append(res, t)\n\t}\n\treturn\n}", "func getLabelSelectors() string {\n\treturn \"!ephemeral-enforcer\"\n}", "func (instance *Host) ListLabels(ctx context.Context) (_ map[string]string, ferr fail.Error) {\n\tdefer fail.OnPanic(&ferr)\n\n\tif instance == nil || valid.IsNil(instance) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif ctx == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"ctx\")\n\t}\n\n\tvar labelsV1 *propertiesv1.HostLabels\n\txerr := instance.Alter(ctx, func(_ data.Clonable, props *serialize.JSONProperties) fail.Error {\n\t\treturn props.Alter(hostproperty.LabelsV1, func(clonable data.Clonable) fail.Error {\n\t\t\tvar ok bool\n\t\t\tlabelsV1, ok = clonable.(*propertiesv1.HostLabels)\n\t\t\tif !ok {\n\t\t\t\treturn fail.InconsistentError(\"'*propertiesv1.HostTags' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\t})\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn labelsV1.ByID, nil\n}", "func GetTargetsList(baseURL string) {\n\ttargetURL := baseURL + \"?name=\" + tl.Name\n\tfmt.Println(\"==> GET\", targetURL)\n\n\t// Read beegosessionID from .cookie.yaml\n\tc, err := utils.CookieLoad()\n\tif err != nil {\n\t\tfmt.Println(\"Error:\", err)\n\t\treturn\n\t}\n\n\tutils.Request.Get(targetURL).\n\t\tSet(\"Cookie\", \"harbor-lang=zh-cn; beegosessionID=\"+c.BeegosessionID).\n\t\tEnd(utils.PrintStatus)\n}", "func (op *metadataLookup) selectList() error {\n\tqueryStmt := op.executeCtx.Query\n\tif queryStmt.AllFields {\n\t\tfields, err := op.metadata.GetAllFields(queryStmt.Namespace, queryStmt.MetricName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, fieldMeta := range fields {\n\t\t\top.planField(nil, fieldMeta)\n\t\t}\n\t\treturn nil\n\t}\n\tselectItems := queryStmt.SelectItems\n\tif len(selectItems) == 0 {\n\t\treturn constants.ErrEmptySelectList\n\t}\n\n\tfor _, selectItem := range selectItems {\n\t\top.field(nil, selectItem)\n\t\tif op.err != nil {\n\t\t\treturn op.err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *FakeKconfigs) List(opts v1.ListOptions) (result *v1alpha1.KconfigList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(kconfigsResource, kconfigsKind, c.ns, opts), &v1alpha1.KconfigList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.KconfigList{ListMeta: obj.(*v1alpha1.KconfigList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.KconfigList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (obs *Observer) List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error) {\n\treturn obs.client.Namespace(obs.namespace).List(opts)\n}", "func (s *NamespaceWebhook) ObjectSelector() *metav1.LabelSelector { return nil }", "func OnList(c *grumble.Context) error {\n\tlen := len(config.AppConfig.Plans)\n\tif len == 0 {\n\t\tfmt.Println(\"No plans available. Try \\\"read\\\".\")\n\t\treturn nil\n\t}\n\n\tfor i, plan := range config.AppConfig.Plans {\n\t\tfmt.Println(i+1, plan.Name)\n\t\tfor i, task := range plan.Tasks {\n\t\t\tif task.GetDescription() != \"\" {\n\t\t\t\tfmt.Println(\" \", strconv.Itoa(i+1)+\".\", task.GetDescription())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Client) ListEvents(namespace string, opts metav1.ListOptions) (*corev1.EventList, error) {\n\tif err := c.initClient(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.kubernetes.CoreV1().Events(namespace).List(opts)\n}", "func TargetsFromGroup(tg *targetgroup.Group, cfg *config.ScrapeConfig, noDefaultPort bool, targets []*Target, lb *labels.Builder) ([]*Target, []error) {\n\ttargets = targets[:0]\n\tfailures := []error{}\n\n\tfor i, tlset := range tg.Targets {\n\t\tlb.Reset(labels.EmptyLabels())\n\n\t\tfor ln, lv := range tlset {\n\t\t\tlb.Set(string(ln), string(lv))\n\t\t}\n\t\tfor ln, lv := range tg.Labels {\n\t\t\tif _, ok := tlset[ln]; !ok {\n\t\t\t\tlb.Set(string(ln), string(lv))\n\t\t\t}\n\t\t}\n\n\t\tlset, origLabels, err := PopulateLabels(lb, cfg, noDefaultPort)\n\t\tif err != nil {\n\t\t\tfailures = append(failures, errors.Wrapf(err, \"instance %d in group %s\", i, tg))\n\t\t}\n\t\tif !lset.IsEmpty() || !origLabels.IsEmpty() {\n\t\t\ttargets = append(targets, NewTarget(lset, origLabels, cfg.Params))\n\t\t}\n\t}\n\treturn targets, failures\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 (c *FakeTZCronJobs) List(opts v1.ListOptions) (result *v1alpha1.TZCronJobList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(tzcronjobsResource, tzcronjobsKind, c.ns, opts), &v1alpha1.TZCronJobList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.TZCronJobList{ListMeta: obj.(*v1alpha1.TZCronJobList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.TZCronJobList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func collectMatchingEvents(ctx context.Context, kubeClient *knativetest.KubeClient, namespace string, kinds map[string][]string) ([]*corev1.Event, error) {\n\tvar events []*corev1.Event\n\n\twatchEvents, err := kubeClient.CoreV1().Events(namespace).Watch(ctx, metav1.ListOptions{})\n\t// close watchEvents channel\n\tdefer watchEvents.Stop()\n\tif err != nil {\n\t\treturn events, err\n\t}\n\n\t// create timer to not wait for events longer than 5 seconds\n\ttimer := time.NewTimer(5 * time.Second)\n\n\tfor {\n\t\tselect {\n\t\tcase wevent := <-watchEvents.ResultChan():\n\t\t\tevent := wevent.Object.(*corev1.Event)\n\t\t\tif val, ok := kinds[event.InvolvedObject.Kind]; ok {\n\t\t\t\tfor _, expectedName := range val {\n\t\t\t\t\tif event.InvolvedObject.Name == expectedName {\n\t\t\t\t\t\tevents = append(events, event)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-timer.C:\n\t\t\treturn events, nil\n\t\t}\n\t}\n}", "func (r *ProjectsTraceSinksService) List(parent string) *ProjectsTraceSinksListCall {\n\tc := &ProjectsTraceSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\treturn c\n}", "func (r *Trail) EventSelectors() pulumi.ArrayOutput {\n\treturn (pulumi.ArrayOutput)(r.s.State[\"eventSelectors\"])\n}", "func (c *OperatorDNS) List() (srvRecords map[string][]SrvRecord, err error) {\n\treturn nil, ErrNotImplemented\n}", "func (s *redisTriggerLister) List(selector labels.Selector) (ret []*v1beta1.RedisTrigger, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1beta1.RedisTrigger))\n\t})\n\treturn ret, err\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 ListProjectEvents(id string) error {\n\tclient, err := NewExtPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tevents, _, err := client.Events.ListProjectEvents(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(events)\n\treturn e\n}", "func List(client *gophercloud.ServiceClient, stackName, stackID string, opts ListOptsBuilder) pagination.Pager {\n\turl := listURL(client, stackName, stackID)\n\tif opts != nil {\n\t\tquery, err := opts.ToStackEventListQuery()\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(client, url, func(r pagination.PageResult) pagination.Page {\n\t\tp := EventPage{pagination.MarkerPageBase{PageResult: r}}\n\t\tp.MarkerPageBase.Owner = p\n\t\treturn p\n\t})\n}", "func getLabelSelectorListOpts(m *v1alpha1.PerconaServerMongoDB, replset *v1alpha1.ReplsetSpec) *metav1.ListOptions {\n\tlabelSelector := labels.SelectorFromSet(labelsForPerconaServerMongoDB(m, replset)).String()\n\treturn &metav1.ListOptions{LabelSelector: labelSelector}\n}", "func (e *VisitorService) List(opts *ListOptions) ([]Visitor, *Response, error) {\n\tendpoint := \"/data/visitors\"\n\tvisitors := new([]Visitor)\n\tresp, err := e.client.getRequestListDecode(endpoint, visitors, opts)\n\treturn *visitors, resp, err\n}", "func (c *FakeTTemplates) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TTemplateList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(ttemplatesResource, ttemplatesKind, c.ns, opts), &v1alpha1.TTemplateList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.TTemplateList{ListMeta: obj.(*v1alpha1.TTemplateList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.TTemplateList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (c *CloudWatchEvents) ListTargetsByRule(input *ListTargetsByRuleInput) (*ListTargetsByRuleOutput, error) {\n\treq, out := c.ListTargetsByRuleRequest(input)\n\terr := req.Send()\n\treturn out, err\n}", "func (t *Target) runTargetList(targets []string) (int, string, error) {\n\tfor _, target := range targets {\n\t\tif target == t.Name {\n\t\t\tcontinue\n\t\t}\n\t\tif t, ok := t.targetConfigs.Target(target); ok {\n\t\t\tstatus, out, err := t.Run()\n\t\t\tif status != 0 || err != nil {\n\t\t\t\treturn status, out, err\n\t\t\t}\n\t\t}\n\t}\n\treturn 0, \"\", nil\n}", "func (a *EventsApiService) ListEvents(ctx _context.Context, localVarOptionals *ListEventsOpts) (EventsList, *_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 EventsList\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/events\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.SourceServicename.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source_servicename\", parameterToString(localVarOptionals.SourceServicename.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceHostid.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source_hostid\", parameterToString(localVarOptionals.SourceHostid.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EventType.IsSet() {\n\t\tlocalVarQueryParams.Add(\"event_type\", parameterToString(localVarOptionals.EventType.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ResourceType.IsSet() {\n\t\tlocalVarQueryParams.Add(\"resource_type\", parameterToString(localVarOptionals.ResourceType.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"resource_id\", parameterToString(localVarOptionals.ResourceId.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Level.IsSet() {\n\t\tlocalVarQueryParams.Add(\"level\", parameterToString(localVarOptionals.Level.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Since.IsSet() {\n\t\tlocalVarQueryParams.Add(\"since\", parameterToString(localVarOptionals.Since.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Before.IsSet() {\n\t\tlocalVarQueryParams.Add(\"before\", parameterToString(localVarOptionals.Before.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Page.IsSet() {\n\t\tlocalVarQueryParams.Add(\"page\", parameterToString(localVarOptionals.Page.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Limit.IsSet() {\n\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(localVarOptionals.Limit.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\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif localVarOptionals != nil && localVarOptionals.XAnchoreAccount.IsSet() {\n\t\tlocalVarHeaderParams[\"x-anchore-account\"] = parameterToString(localVarOptionals.XAnchoreAccount.Value(), \"\")\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\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 *Deployment) List(namespace string, labelSelector map[string]string) (*appsv1.DeploymentList, error) {\n\toptions := metav1.ListOptions{}\n\n\tif len(labelSelector) > 0 {\n\t\tkvs := make([]string, 0, len(labelSelector))\n\t\tfor key, value := range labelSelector {\n\t\t\tkvs = append(kvs, fmt.Sprintf(\"%s=%s\", key, value))\n\t\t}\n\n\t\tselector, err := labels.Parse(strings.Join(kvs, \",\"))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Errorf(\"failed to parse label selector, %v\", err)\n\t\t}\n\n\t\toptions.LabelSelector = selector.String()\n\t}\n\n\tdeployList, err := d.cs.AppsV1().Deployments(namespace).List(context.Background(), options)\n\tif err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\treturn nil, k8serror.ErrNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn deployList, nil\n}", "func (s *kogitoSourceLister) List(selector labels.Selector) (ret []*v1alpha1.KogitoSource, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.KogitoSource))\n\t})\n\treturn ret, err\n}", "func getTargets() ([]string, error) {\n\tclient := http.Client{}\n\treq, err := http.NewRequest(\n\t\t\"GET\",\n\t\t\"http://\"+endpoint+\"/targets\",\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tvar challenge Challenge\n\terr = json.Unmarshal(body, &challenge)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tdata, err := base64.StdEncoding.DecodeString(challenge.Challenge)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\treturn strings.Split(string(data), \"\\n\"), nil\n}", "func (t *TargetController) GetAll(c *gin.Context) {\n\tt.db.Init()\n\tdefer t.db.Free()\n\tpageSizeString := c.DefaultQuery(\"pageSize\", \"10\")\n\tpageIndexString := c.DefaultQuery(\"pageIndex\", \"0\")\n\tpageSize, err := strconv.ParseInt(pageSizeString, 10, 64)\n\tif err != nil || pageSize > 100 || pageSize < 1 {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"message\": \"Invalid page size.\",\n\t\t})\n\t\treturn\n\t}\n\tpageIndex, err := strconv.ParseInt(pageIndexString, 10, 64)\n\tif err != nil || pageIndex < 0 {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"message\": \"Invalid page index.\",\n\t\t})\n\t\treturn\n\t}\n\tcontains := c.Query(\"contains\")\n\tif contains != \"\" && !IsValidIDFragment(contains) {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"message\": \"Invalid contains expression.\",\n\t\t})\n\t\treturn\n\t}\n\ttargets, err := t.db.GetAllTargets(pageSize, pageIndex, contains)\n\tif err != nil {\n\t\tt.log.Error(err)\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"message\": \"Invalid operation. Try again.\",\n\t\t})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, []*types.Target(targets))\n}", "func SupportSelectors(flagSet *pflag.FlagSet, p *[]string) {\n\tflagSet.StringArrayVarP(p, \"selector\", \"l\", []string{}, \"filter results by a set of comma-separated label selectors\")\n}", "func (s *awsElasticsearchDomainLister) List(selector labels.Selector) (ret []*v1.AwsElasticsearchDomain, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.AwsElasticsearchDomain))\n\t})\n\treturn ret, err\n}", "func NewTargets(c *Configuration) ([]*Target, error) {\n\tfor _, rule := range c.Rules {\n\t\terr := rule.setup()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trule.tags = c.Tags\n\t}\n\n\ttargets := []*Target{}\n\tfor ruleName, addrs := range c.Targets {\n\t\trule, ok := c.Rules[ruleName]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unknown rule %s\", ruleName)\n\t\t}\n\t\tfor _, addr := range addrs {\n\t\t\ttargets = append(targets, &Target{\n\t\t\t\tName: addr,\n\t\t\t\tAddr: addr,\n\t\t\t\tRule: rule,\n\t\t\t})\n\t\t}\n\t}\n\treturn targets, nil\n}", "func (client *ClientImpl) ListEventTypes(ctx context.Context, args ListEventTypesArgs) (*[]EventTypeDescriptor, error) {\n\trouteValues := make(map[string]string)\n\tif args.PublisherId == nil || *args.PublisherId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.PublisherId\"}\n\t}\n\trouteValues[\"publisherId\"] = *args.PublisherId\n\n\tlocationId, _ := uuid.Parse(\"db4777cd-8e08-4a84-8ba3-c974ea033718\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"7.1-preview.1\", routeValues, nil, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue []EventTypeDescriptor\n\terr = client.Client.UnmarshalCollectionBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func (o OfflineNotaryRepository) ListTargets(...data.RoleName) ([]*client.TargetWithRole, error) {\n\treturn nil, storage.ErrOffline{}\n}" ]
[ "0.61464715", "0.56628346", "0.56543076", "0.54902506", "0.5228712", "0.52107954", "0.51932913", "0.5172048", "0.5141491", "0.51324284", "0.5112907", "0.5101192", "0.50956565", "0.5068237", "0.50504357", "0.50469285", "0.50433314", "0.502446", "0.49555793", "0.49431434", "0.4890991", "0.48637363", "0.48377275", "0.4837639", "0.48279905", "0.4820106", "0.4819277", "0.48138517", "0.47858772", "0.47808796", "0.47775558", "0.47714558", "0.47456992", "0.4741946", "0.47233582", "0.47221497", "0.47219318", "0.4720415", "0.471284", "0.47070622", "0.470582", "0.4701967", "0.46998334", "0.46949494", "0.469097", "0.46909356", "0.46846756", "0.46703893", "0.46664444", "0.46609202", "0.46569017", "0.46565476", "0.46399862", "0.46365407", "0.46266747", "0.46183187", "0.46066663", "0.45967364", "0.4593124", "0.4592424", "0.4580714", "0.45771426", "0.45750618", "0.45736378", "0.4553976", "0.4538368", "0.45294258", "0.452352", "0.45183286", "0.44921914", "0.44899762", "0.4488049", "0.44810113", "0.44742554", "0.44694737", "0.44682884", "0.44679326", "0.44665366", "0.4465299", "0.44428277", "0.44373694", "0.4436916", "0.44307053", "0.44261205", "0.44249293", "0.44227755", "0.4416238", "0.4409937", "0.44081956", "0.44050202", "0.44027027", "0.43999338", "0.43974254", "0.43959203", "0.43933827", "0.43892038", "0.4383154", "0.43764722", "0.43760303", "0.43742332" ]
0.77347326
0
Watch returns a watch.Interface that watches the requested cloudwatchEventTargets.
func (c *FakeCloudwatchEventTargets) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(cloudwatcheventtargetsResource, c.ns, opts)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *ConsulClient) Watch(ctx context.Context, wh *WatchConfig) (IWatcher, error) {\n\tregistryOperationCount.WithLabelValues(env, \"Watch\").Inc()\n\n\tstartTime := time.Now()\n\tdefer func() {\n\t\tregistryOperationTimeTaken.WithLabelValues(env, \"Watch\").Observe(time.Now().Sub(startTime).Seconds())\n\t}()\n\n\tparams := map[string]interface{}{}\n\n\tif wh.WatchType == \"key\" {\n\t\tparams[\"type\"] = wh.WatchType\n\t\tparams[\"key\"] = wh.WatchPath\n\t} else if wh.WatchType == \"keyprefix\" {\n\t\tparams[\"type\"] = wh.WatchType\n\t\tparams[\"prefix\"] = wh.WatchPath\n\t}\n\n\tplan, err := watch.Parse(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcwh := NewConsulWatcher(ctx, wh, plan, c.client)\n\n\treturn cwh, nil\n}", "func (c *FakeAWSSNSTargets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(awssnstargetsResource, c.ns, opts))\n\n}", "func Watch(ctx context.Context, watcher watch.Interface) (chan *Target, chan *Target, chan *Target) {\n\tadded := make(chan *Target)\n\tfinished := make(chan *Target)\n\tdeleted := make(chan *Target)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase e := <-watcher.ResultChan():\n\t\t\t\tif e.Object == nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tpod := e.Object.(*v1.Pod)\n\n\t\t\t\tswitch e.Type {\n\t\t\t\tcase watch.Added:\n\t\t\t\t\tif pod.Status.Phase != v1.PodRunning {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, container := range pod.Spec.Containers {\n\t\t\t\t\t\tadded <- NewTarget(pod.Namespace, pod.Name, container.Name)\n\t\t\t\t\t}\n\t\t\t\tcase watch.Modified:\n\t\t\t\t\tswitch pod.Status.Phase {\n\t\t\t\t\tcase v1.PodRunning:\n\t\t\t\t\t\tfor _, container := range pod.Spec.Containers {\n\t\t\t\t\t\t\tadded <- NewTarget(pod.Namespace, pod.Name, container.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\tcase v1.PodSucceeded, v1.PodFailed:\n\t\t\t\t\t\tfor _, container := range pod.Spec.Containers {\n\t\t\t\t\t\t\tfinished <- NewTarget(pod.Namespace, pod.Name, container.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase watch.Deleted:\n\t\t\t\t\tfor _, container := range pod.Spec.Containers {\n\t\t\t\t\t\tdeleted <- NewTarget(pod.Namespace, pod.Name, container.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tcase <-ctx.Done():\n\t\t\t\twatcher.Stop()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn added, finished, deleted\n}", "func (obs *Observer) Watch(opts metav1.ListOptions) (watch.Interface, error) {\n\treturn obs.client.Namespace(obs.namespace).Watch(opts)\n}", "func (k *kubernetes) Watch(opts ...router.WatchOption) (router.Watcher, error) {\n\treturn &watcher{\n\t\tevents: make(chan *router.Event),\n\t}, nil\n}", "func watch(k *kite.Client, eventType string, eventId string, interval time.Duration) error {\n\teventArgs := kloud.EventArgs([]kloud.EventArg{\n\t\tkloud.EventArg{\n\t\t\tType: eventType,\n\t\t\tEventId: eventId,\n\t\t},\n\t})\n\n\tfor {\n\t\tresp, err := k.TellWithTimeout(\"event\", defaultTellTimeout, eventArgs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar events []kloud.EventResponse\n\t\tif err := resp.Unmarshal(&events); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(events) == 0 {\n\t\t\treturn errors.New(\"incoming event response is not an array\")\n\t\t}\n\n\t\tif events[0].Error != nil {\n\t\t\treturn events[0].Error\n\t\t}\n\n\t\tDefaultUi.Info(fmt.Sprintf(\"%s ==> %s [Status: %s Percentage: %d]\",\n\t\t\tfmt.Sprint(time.Now())[:19],\n\t\t\tevents[0].Event.Message,\n\t\t\tevents[0].Event.Status,\n\t\t\tevents[0].Event.Percentage,\n\t\t))\n\n\t\tif events[0].Event.Error != \"\" {\n\t\t\terr := errors.New(events[0].Event.Error)\n\t\t\tDefaultUi.Error(err.Error())\n\t\t\treturn err\n\t\t}\n\n\t\tif events[0].Event.Percentage == 100 {\n\t\t\treturn nil\n\t\t}\n\n\t\ttime.Sleep(interval)\n\t}\n}", "func (c *googleCloudStorageSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"googlecloudstoragesources\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (c *FakeListeners) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(listenersResource, c.ns, opts))\n\n}", "func (t *FakeObjectTracker) Watch(gvr schema.GroupVersionResource, name string) (watch.Interface, error) {\n\tif t.fakingOptions.failAll != nil {\n\t\terr := t.fakingOptions.failAll.RunFakeInvocations()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn t.delegatee.Watch(gvr, name)\n}", "func (w *Watcher) Watch(\n\tctx context.Context,\n\teventCh chan<- Event,\n) error {\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\tdefer close(eventCh)\n\n\terrCh := make(chan error, 3)\n\ttaggedEventCh := make(chan Event)\n\n\tgo func() {\n\t\tif err := w.watchTagged(ctx, taggedEventCh); err != nil {\n\t\t\terrCh <- err\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tif err := w.watchTags(ctx, taggedEventCh, eventCh); err != nil {\n\t\t\terrCh <- err\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tif err := w.watchUnsorted(ctx, eventCh); err != nil {\n\t\t\terrCh <- err\n\t\t}\n\t}()\n\n\treturn <-errCh\n}", "func Watch(paths ...string) (*Watcher, error) {\n\tevent := make(chan EventItem)\n\terr := watch(paths, event)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Watcher{\n\t\tEvent: event,\n\t}, nil\n}", "func (c *kongs) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"kongs\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tWatch()\n}", "func (c *interacts) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"interacts\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tWatch()\n}", "func (k *Kubernetes) Watch(qname string) error {\n\treturn k.APIConn.Watch(qname)\n}", "func (s *ConfigService) Watch(d time.Duration)", "func Watch(ctx context.Context, i v1.PodInterface, podFilter *regexp.Regexp,\n\tcontainerFilter *regexp.Regexp, containerExcludeFilter *regexp.Regexp,\n\tcontainerState ContainerState, labelSelector labels.Selector) (chan *Target, chan *Target, error) {\n\n\tlogger := requestctx.Logger(ctx).WithName(\"pod-watch\").V(4)\n\n\tlogger.Info(\"create\")\n\twatcher, err := i.Watch(ctx, metav1.ListOptions{Watch: true, LabelSelector: labelSelector.String()})\n\tif err != nil {\n\t\tfmt.Printf(\"err.Error() = %+v\\n\", err.Error())\n\t\treturn nil, nil, errors.Wrap(err, \"failed to set up watch\")\n\t}\n\n\tadded := make(chan *Target)\n\tremoved := make(chan *Target)\n\n\tgo func() {\n\t\tlogger.Info(\"await events\")\n\t\tdefer func() {\n\t\t\tlogger.Info(\"event processing ends\")\n\t\t}()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase e := <-watcher.ResultChan():\n\t\t\t\tlogger.Info(\"received event\")\n\n\t\t\t\tif e.Object == nil {\n\t\t\t\t\tlogger.Info(\"event error, no object\")\n\t\t\t\t\t// Closed because of error\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tpod, ok := e.Object.(*corev1.Pod)\n\t\t\t\tif !ok {\n\t\t\t\t\tlogger.Info(\"event error, object not a pod\")\n\t\t\t\t\t// Not a Pod\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif !podFilter.MatchString(pod.Name) {\n\t\t\t\t\tlogger.Info(\"filtered\", \"pod\", pod.Name, \"filter\", podFilter.String())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tswitch e.Type {\n\t\t\t\tcase watch.Added, watch.Modified:\n\t\t\t\t\tlogger.Info(\"pod added/modified\", \"name\", pod.Name)\n\n\t\t\t\t\tvar statuses []corev1.ContainerStatus\n\t\t\t\t\tstatuses = append(statuses, pod.Status.InitContainerStatuses...)\n\t\t\t\t\tstatuses = append(statuses, pod.Status.ContainerStatuses...)\n\n\t\t\t\t\tfor _, c := range statuses {\n\t\t\t\t\t\tif !containerFilter.MatchString(c.Name) {\n\t\t\t\t\t\t\tlogger.Info(\"filtered\", \"container\", c.Name, \"filter\", containerFilter.String())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif containerExcludeFilter != nil && containerExcludeFilter.MatchString(c.Name) {\n\t\t\t\t\t\t\tlogger.Info(\"excluded\", \"container\", c.Name, \"exclude-filter\", containerExcludeFilter.String())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif c.State.Running != nil || c.State.Terminated != nil { // There are logs to read\n\t\t\t\t\t\t\tlogger.Info(\"report added\", \"container\", c.Name, \"pod\", pod.Name, \"namespace\", pod.Namespace)\n\t\t\t\t\t\t\tadded <- &Target{\n\t\t\t\t\t\t\t\tNamespace: pod.Namespace,\n\t\t\t\t\t\t\t\tPod: pod.Name,\n\t\t\t\t\t\t\t\tContainer: c.Name,\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\tcase watch.Deleted:\n\t\t\t\t\tlogger.Info(\"pod deleted\", \"name\", pod.Name)\n\n\t\t\t\t\tvar containers []corev1.Container\n\t\t\t\t\tcontainers = append(containers, pod.Spec.Containers...)\n\t\t\t\t\tcontainers = append(containers, pod.Spec.InitContainers...)\n\n\t\t\t\t\tfor _, c := range containers {\n\t\t\t\t\t\tif !containerFilter.MatchString(c.Name) {\n\t\t\t\t\t\t\tlogger.Info(\"filtered\", \"container\", c.Name, \"filter\", containerFilter.String())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif containerExcludeFilter != nil && containerExcludeFilter.MatchString(c.Name) {\n\t\t\t\t\t\t\tlogger.Info(\"excluded\", \"container\", c.Name, \"exclude-filter\", containerExcludeFilter.String())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlogger.Info(\"report removed\", \"container\", c.Name, \"pod\", pod.Name, \"namespace\", pod.Namespace)\n\t\t\t\t\t\tremoved <- &Target{\n\t\t\t\t\t\t\tNamespace: pod.Namespace,\n\t\t\t\t\t\t\tPod: pod.Name,\n\t\t\t\t\t\t\tContainer: c.Name,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlogger.Info(\"received stop request\")\n\t\t\t\twatcher.Stop()\n\t\t\t\tclose(added)\n\t\t\t\tclose(removed)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tlogger.Info(\"pass watch report channels\")\n\treturn added, removed, nil\n}", "func (r workloadEndpoints) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) {\r\n\treturn r.client.resources.Watch(ctx, opts, apiv3.KindWorkloadEndpoint, nil)\r\n}", "func (fk *FakeRouter) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {\n\tpanic(\"not implemented\")\n}", "func (s *svc) Watch(opts ...router.WatchOption) (router.Watcher, error) {\n\trsp, err := s.router.Watch(context.Background(), &pb.WatchRequest{}, s.callOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\toptions := router.WatchOptions{\n\t\tService: \"*\",\n\t}\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\treturn newWatcher(rsp, options)\n}", "func (c *externalInterfaces) Watch(opts metav1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"externalinterfaces\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch()\n}", "func (c *cronFederatedHPAs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"cronfederatedhpas\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (c *klusterlets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tResource(\"klusterlets\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (c *demos) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"demos\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch()\n}", "func (c *AnalyticsController) runWatches() {\n\tlastResourceVersion := big.NewInt(0)\n\tcurrentResourceVersion := big.NewInt(0)\n\twatchListItems := WatchFuncList(c.kclient, c.client)\n\tfor name := range watchListItems {\n\n\t\t// assign local variable (not in range operator above) so that each\n\t\t// goroutine gets the correct watch function required\n\t\twfnc := watchListItems[name]\n\t\tn := name\n\t\tbackoff := 1 * time.Second\n\n\t\tgo wait.Until(func() {\n\t\t\t// any return from this func only exits that invocation of the func.\n\t\t\t// wait.Until will call it again after its sync period.\n\t\t\twatchLog := log.WithFields(log.Fields{\n\t\t\t\t\"watch\": n,\n\t\t\t})\n\t\t\twatchLog.Infof(\"starting watch\")\n\t\t\tw, err := wfnc.watchFunc(metav1.ListOptions{})\n\t\t\tif err != nil {\n\t\t\t\twatchLog.Errorf(\"error creating watch: %v\", err)\n\t\t\t}\n\n\t\t\twatchLog.Debugf(\"backing off watch for %v seconds\", backoff)\n\t\t\ttime.Sleep(backoff)\n\t\t\tbackoff = backoff * 2\n\t\t\tif backoff > 60*time.Second {\n\t\t\t\tbackoff = 60 * time.Second\n\t\t\t}\n\n\t\t\tif w == nil {\n\t\t\t\twatchLog.Errorln(\"watch function nil, watch not created, returning\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase event, ok := <-w.ResultChan():\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\twatchLog.Warnln(\"watch channel closed unexpectedly, attempting to re-establish\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif event.Type == watch.Error {\n\t\t\t\t\t\twatchLog.Errorf(\"watch channel returned error: %s\", spew.Sdump(event))\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// success means the watch is working.\n\t\t\t\t\t// reset the backoff back to 1s for this watch\n\t\t\t\t\tbackoff = 1 * time.Second\n\n\t\t\t\t\tif event.Type == watch.Added || event.Type == watch.Deleted {\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\twatchLog.Errorf(\"Unable to create object meta for %v: %v\", event.Object, err)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tm, err := meta.Accessor(event.Object)\n\t\t\t\t\t\t// if both resource versions can be converted to numbers\n\t\t\t\t\t\t// and if the current resource version is lower than the\n\t\t\t\t\t\t// last recorded resource version for this resource type\n\t\t\t\t\t\t// then skip the event\n\t\t\t\t\t\tc.mutex.RLock()\n\t\t\t\t\t\tif _, ok := lastResourceVersion.SetString(c.watchResourceVersions[n], 10); ok {\n\t\t\t\t\t\t\tif _, ok = currentResourceVersion.SetString(m.GetResourceVersion(), 10); ok {\n\t\t\t\t\t\t\t\tif lastResourceVersion.Cmp(currentResourceVersion) == 1 {\n\t\t\t\t\t\t\t\t\twatchLog.Debugf(\"ResourceVersion %v is to old (%v)\",\n\t\t\t\t\t\t\t\t\t\tcurrentResourceVersion, c.watchResourceVersions[n])\n\t\t\t\t\t\t\t\t\tc.mutex.RUnlock()\n\t\t\t\t\t\t\t\t\tbreak\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\tc.mutex.RUnlock()\n\n\t\t\t\t\t\t// each watch is a separate go routine\n\t\t\t\t\t\tc.mutex.Lock()\n\t\t\t\t\t\tc.watchResourceVersions[n] = m.GetResourceVersion()\n\t\t\t\t\t\tc.mutex.Unlock()\n\n\t\t\t\t\t\tanalytic, err := newEvent(c.typer, event.Object, event.Type)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\twatchLog.Errorf(\"unexpected error creating analytic from watch event %#v\", event.Object)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// additional info will be set to the analytic and\n\t\t\t\t\t\t\t// an instance queued for all destinations\n\t\t\t\t\t\t\terr := c.AddEvent(analytic)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\twatchLog.Errorf(\"error adding event: %v - %v\", err, analytic)\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}, 1*time.Millisecond, c.stopChannel)\n\t}\n}", "func (c *cloudFormationTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"cloudformationtemplates\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tWatch()\n}", "func (h *HealthImpl) Watch(*v1.HealthCheckRequest, v1.Health_WatchServer) error {\n\treturn nil\n}", "func (s *V3Backend) Watch(ctx context.Context, key string) <-chan *args.ChangeEvent {\n\twatchChan := s.Client.Watch(ctx, key, etcd.WithPrefix())\n\ts.changeChan = make(chan *args.ChangeEvent)\n\ts.done = make(chan struct{})\n\n\ts.wg.Add(1)\n\tgo func() {\n\t\tvar resp etcd.WatchResponse\n\t\tvar ok bool\n\t\tdefer s.wg.Done()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase resp, ok = <-watchChan:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif resp.Canceled {\n\t\t\t\t\ts.changeChan <- NewChangeError(errors.Wrap(resp.Err(),\n\t\t\t\t\t\t\"V3Backend.Watch(): ETCD server cancelled watch\"))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfor _, event := range resp.Events {\n\t\t\t\t\ts.changeChan <- NewChangeEvent(event)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn s.changeChan\n}", "func (c *Client) Watch(gvr schema.GroupVersionResource, opts ...ListOption) (w watch.Interface, err error) {\n\trestClient, err := c.rest(gvr.GroupVersion())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tctx, cancel := context.WithTimeout(c.ctx, c.timeout)\n\tlistOpts := ListOptions{Raw: &metav1.ListOptions{Watch: true}}\n\tlistOpts.ApplyOptions(opts)\n\tw, err = restClient.Get().\n\t\tTimeout(c.timeout).\n\t\tNamespaceIfScoped(listOpts.Namespace, listOpts.Namespace != \"\").\n\t\tResource(gvr.Resource).\n\t\tVersionedParams(listOpts.AsListOptions(), scheme.ParameterCodec).\n\t\tWatch(ctx)\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, err\n\t}\n\treturn &watcher{Interface: w, cancel: cancel}, nil\n}", "func (c *nodes) Watch(opts api.ListOptions) (watch.Interface, error) {\n\treturn c.r.Get().\n\t\tPrefix(\"watch\").\n\t\tNamespace(api.NamespaceAll).\n\t\tResource(c.resourceName()).\n\t\tVersionedParams(&opts, api.ParameterCodec).\n\t\tWatch()\n}", "func (c *globalThreatFeeds) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tResource(\"globalthreatfeeds\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (h *HealthImpl) Watch(in *grpc_health_v1.HealthCheckRequest, stream grpc_health_v1.Health_WatchServer) error {\n\treturn nil\n}", "func (s *HealthServer) Watch(in *healthpb.HealthCheckRequest, srv healthpb.Health_WatchServer) error {\n\treturn status.Error(codes.Unimplemented, \"Watch is not implemented\")\n}", "func (c *scheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) {\n\treturn c.r.Get().\n\t\tPrefix(\"watch\").\n\t\tNamespace(c.ns).\n\t\tResource(\"scheduledjobs\").\n\t\tVersionedParams(&opts, api.ParameterCodec).\n\t\tWatch()\n}", "func (r *Registry) Watch(ctx context.Context, serviceName string) (registry.Watcher, error) {\n\treturn newWatcher(ctx, r.opt.Namespace, serviceName, r.consumer)\n}", "func (rr *Registry) Watch(ctx context.Context) ([]*WatchEvent, <-chan *WatchEvent, error) {\n\trr.mu.Lock()\n\tdefer rr.mu.Unlock()\n\n\tprefix := rr.prefixPath()\n\n\tgetRes, err := rr.kv.Get(ctx, prefix, etcdv3.WithPrefix())\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tcurrentEvents := make([]*WatchEvent, 0, len(getRes.Kvs))\n\tfor _, kv := range getRes.Kvs {\n\t\treg, err := rr.unmarshalRegistration(kv)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\twev := &WatchEvent{\n\t\t\tKey: string(kv.Key),\n\t\t\tReg: reg,\n\t\t\tType: Create,\n\t\t}\n\t\tcurrentEvents = append(currentEvents, wev)\n\t}\n\n\t// Channel to publish registry changes.\n\twatchEvents := make(chan *WatchEvent)\n\n\t// Write a change or exit the watcher.\n\tput := func(we *WatchEvent) {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase watchEvents <- we:\n\t\t}\n\t}\n\tputTerminalError := func(we *WatchEvent) {\n\t\tgo func() {\n\t\t\tdefer func() {\n\t\t\t\trecover()\n\t\t\t}()\n\t\t\tselect {\n\t\t\tcase <-time.After(10 * time.Minute):\n\t\t\tcase watchEvents <- we:\n\t\t\t}\n\t\t}()\n\t}\n\t// Create a watch-event from an event.\n\tcreateWatchEvent := func(ev *etcdv3.Event) *WatchEvent {\n\t\twev := &WatchEvent{Key: string(ev.Kv.Key)}\n\t\tif ev.IsCreate() {\n\t\t\twev.Type = Create\n\t\t} else if ev.IsModify() {\n\t\t\twev.Type = Modify\n\t\t} else {\n\t\t\twev.Type = Delete\n\t\t\t// Create base registration from just key.\n\t\t\treg := &Registration{}\n\t\t\tgraphType, graphName, err := rr.graphTypeAndNameFromKey(string(ev.Kv.Key))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\treg.Type = graphType\n\t\t\treg.Name = graphName\n\t\t\twev.Reg = reg\n\t\t\t// Need to return now because\n\t\t\t// delete events don't contain\n\t\t\t// any data to unmarshal.\n\t\t\treturn wev\n\t\t}\n\t\treg, err := rr.unmarshalRegistration(ev.Kv)\n\t\tif err != nil {\n\t\t\twev.Error = fmt.Errorf(\"%v: failed unmarshaling value: '%s'\", err, ev.Kv.Value)\n\t\t} else {\n\t\t\twev.Reg = reg\n\t\t}\n\t\treturn wev\n\t}\n\n\t// Watch deltas in etcd, with the give prefix, starting\n\t// at the revision of the get call above.\n\tdeltas := rr.client.Watch(ctx, prefix, etcdv3.WithPrefix(), etcdv3.WithRev(getRes.Header.Revision+1))\n\tgo func() {\n\t\tdefer close(watchEvents)\n\t\tfor {\n\t\t\tdelta, open := <-deltas\n\t\t\tif !open {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\tdefault:\n\t\t\t\t\tputTerminalError(&WatchEvent{Error: ErrWatchClosedUnexpectedly})\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif delta.Err() != nil {\n\t\t\t\tputTerminalError(&WatchEvent{Error: delta.Err()})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, event := range delta.Events {\n\t\t\t\tput(createWatchEvent(event))\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn currentEvents, watchEvents, nil\n}", "func (c *ioTConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"iotconfigs\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch()\n}", "func (c *concurrencyControls) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"concurrencycontrols\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (c *gitTracks) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"gittracks\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch()\n}", "func New() *CloudWatch {\n\treturn &CloudWatch{\n\t\tCacheTTL: config.Duration(time.Hour),\n\t\tRateLimit: 25,\n\t\tTimeout: config.Duration(time.Second * 5),\n\t\tBatchSize: 500,\n\t}\n}", "func (c *FakeRedisTriggers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(redistriggersResource, c.ns, opts))\n\n}", "func (s *CAServer) Watch(_ *ghc.HealthCheckRequest, _ ghc.Health_WatchServer) error {\n\treturn nil\n}", "func (c *snapshotRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"snapshotrules\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (c *previewFeatures) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tResource(\"previewfeatures\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (f Forwarder) Watch() {\n\thandler := func(i interface{}) {\n\t\tvar container string\n\t\tvar message string\n\t\tvar context map[string]interface{}\n\t\tdata := i.(map[string]interface{})\n\t\tmetadata := data[\"metadata\"].(map[string]interface{})\n\n\t\ttmp, ok := metadata[\"context\"]\n\t\tif ok {\n\t\t\tcontext = tmp.(map[string]interface{})\n\t\t}\n\n\t\ttmp, ok = context[\"container\"]\n\t\tif ok {\n\t\t\tcontainer = tmp.(string)\n\t\t}\n\n\t\t_, ok = f.Forwards[container]\n\t\tif ok {\n\t\t\ttmp, ok := metadata[\"message\"]\n\t\t\tif ok {\n\t\t\t\tmessage = tmp.(string)\n\t\t\t}\n\t\t\tswitch message {\n\t\t\tcase ContainerStarted:\n\t\t\t\tgo func() {\n\t\t\t\t\t// Wait a few seconds for the newly running container to get an IP address\n\t\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t\t\tf.ForwardContainer(container)\n\t\t\t\t}()\n\n\t\t\tcase ContainerStopped:\n\t\t\t\tf.ReverseContainer(container)\n\t\t\t}\n\t\t}\n\n\t}\n\n\tf.Monitor([]string{}, handler)\n}", "func (srv *HealthServer) Watch(*grpc_health_v1.HealthCheckRequest, grpc_health_v1.Health_WatchServer) error {\n\treturn nil\n}", "func Watch(ctx context.Context, cliEngine *engine.Engine, task string, t ox.Task) {\n\ttaskCtx, cancel := context.WithCancel(ctx)\n\n\tfiles, err := getWatcherFiles(t.Sources, t.Dir)\n\tif err != nil {\n\t\tutils.PrintError(err)\n\t\treturn\n\t}\n\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\tutils.PrintError(err)\n\t\treturn\n\t}\n\tdefer watcher.Close()\n\n\tfor _, file := range files {\n\t\terr = watcher.Add(file)\n\t\tif err != nil {\n\t\t\tutils.PrintError(err)\n\t\t\treturn\n\t\t}\n\t}\n\n\trunOnWatch := func() {\n\t\terr := cliEngine.Run(taskCtx, task)\n\t\tif err != nil {\n\t\t\tutils.PrintError(err)\n\t\t}\n\t}\n\n\tgo runOnWatch()\n\n\tfor {\n\t\tselect {\n\t\tcase event := <-watcher.Events:\n\t\t\tswitch {\n\t\t\tcase event.Op&fsnotify.Write == fsnotify.Write:\n\t\t\t\tfallthrough\n\t\t\tcase event.Op&fsnotify.Create == fsnotify.Create:\n\t\t\t\tfallthrough\n\t\t\tcase event.Op&fsnotify.Remove == fsnotify.Remove:\n\t\t\t\tfallthrough\n\t\t\tcase event.Op&fsnotify.Rename == fsnotify.Rename:\n\t\t\t\tcancel()\n\t\t\t\ttaskCtx, cancel = context.WithCancel(ctx)\n\t\t\t\tgo runOnWatch()\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\tcancel()\n\t\t\treturn\n\t\tcase err := <-watcher.Errors:\n\t\t\tutils.PrintError(err)\n\t\t\tcancel()\n\t\t\treturn\n\t\t}\n\t}\n}", "func (c *FakeTraefikServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(traefikservicesResource, c.ns, opts))\n\n}", "func New(s *session.Session) *CloudWatch {\n\treturn &CloudWatch{\n\t\tcwClient: cloudwatch.New(s),\n\t\trgClient: resourcegroups.New(s),\n\t}\n}", "func (w *TaskWatcher) Watch(ctx context.Context) <-chan *TaskEvent {\n\tc := make(chan *TaskEvent, w.cfg.ChannelSize)\n\tgo w.watch(ctx, c)\n\treturn c\n}", "func (c *sandboxes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tResource(\"sandboxes\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (g *Gulf) Watch(patterns []string, tasks ...string) {}", "func (s *Spec) Watch() error {\n\tif s.stopWatching != nil {\n\t\tlog.WithFields(s.Fields()).Debug(\"already watching\")\n\t\treturn nil\n\t}\n\n\tselectors := strings.Join(s.Details.Selector, \",\")\n\n\topts := metav1.ListOptions{}\n\topts.LabelSelector = selectors\n\twatcher, err := cluster.Client.CoreV1().Pods(s.Details.Namespace).Watch(opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.WithFields(s.Fields()).Debug(\"watching for updates\")\n\n\ts.stopWatching = make(chan bool)\n\tgo func() {\n\t\tdefer watcher.Stop()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-s.stopWatching:\n\t\t\t\tlog.WithFields(s.Fields()).Debug(\"stopping watch\")\n\t\t\t\treturn\n\n\t\t\tcase event := <-watcher.ResultChan():\n\t\t\t\t// For whatever reason under the sun, if the watcher looses the\n\t\t\t\t// connection with the cluster, it ends up sending empty events\n\t\t\t\t// as fast as possible. We want to just kill this when that's the\n\t\t\t\t// case.\n\t\t\t\tif event.Type == \"\" && event.Object == nil {\n\t\t\t\t\tlog.WithFields(s.Fields()).Error(\"lost connection to cluster\")\n\t\t\t\t\tSignalLoss <- true\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif event.Object == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif err := s.handleEvent(event); err != nil {\n\t\t\t\t\tlog.WithFields(s.Fields()).Error(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (c *FakeRuleEndpoints) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(ruleendpointsResource, c.ns, opts))\n\n}", "func (c *awsMediaStoreContainers) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsmediastorecontainers\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tWatch()\n}", "func (c *FakeGoogleCloudPubSubSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(googlecloudpubsubsourcesResource, c.ns, opts))\n\n}", "func NewWatch() *Watch {\n\tr := &Watch{\n\t\tActions: make(map[string]WatcherAction, 0),\n\t}\n\n\treturn r\n}", "func Watch(s Selector, a Action) (*Watcher, error) {\n\tfsw, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tw := &Watcher{\n\t\tfsw: fsw,\n\t\tcache: make(map[string]string),\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event, ok := <-w.fsw.Events:\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Println(\"There was an error in an event consumer [events].\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\te := Event{event}\n\t\t\t\tcached := w.getCache(e.Name)\n\t\t\t\tw.setCache(e.Name, a(e, cached))\n\t\t\tcase err, ok := <-w.fsw.Errors:\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Println(\"There was an error in an event consumer [errs].\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlog.Println(\"error:\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor _, name := range s() {\n\t\terr = w.fsw.Add(name)\n\t}\n\n\treturn w, err\n}", "func v1Trigger(c *gin.Context) {\n\t/**\n\t * @I Implement authentication of the caller\n\t * @I Does the id need any escaping?\n\t * @I Ensure the caller has the permissions to trigger evaluation of a Watch\n\t * @I Investigate whether we need our own response status codes\n\t */\n\n\t// The \"ids\" parameter is required. We allow for multiple comma-separated\n\t// string IDs, so we need to convert them to an array of integer IDs.\n\t// We want to make sure that the caller makes the request they want to without\n\t// mistakes, so we do not trigger any Watches if there is any error, even in\n\t// one of the IDs.\n\t// @I Refactor converting a comma-separated list of string IDs to an array of\n\t// integer IDs into a utility function\n\tsIDs := c.Param(\"ids\")\n\taIDsInt, err := util.StringToIntegers(sIDs, \",\")\n\tif err != nil {\n\t\tc.JSON(\n\t\t\thttp.StatusNotFound,\n\t\t\tgin.H{\n\t\t\t\t\"status\": http.StatusNotFound,\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\n\t// Get the Watches with the requested IDs from storage.\n\tstorage := c.MustGet(\"storage\").(storage.Storage)\n\n\tvar watches []*common.Watch\n\tfor iID := range aIDsInt {\n\t\twatch, err := storage.Get(iID)\n\t\tif err != nil {\n\t\t\t// Return a Not Found response if there is no Watch with such ID.\n\t\t\tif watch == nil {\n\t\t\t\tc.JSON(\n\t\t\t\t\thttp.StatusNotFound,\n\t\t\t\t\tgin.H{\n\t\t\t\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// We could trigger the Watch at this point, however we prefer to check\n\t\t// that all Watches exist first.\n\t\twatches = append(watches, watch)\n\t}\n\n\t// Trigger execution of the Watches.\n\t// We only need to acknowledge that the Watches were triggered; we don't have to\n\t// for the execution to finish as this can take time.\n\twatchAPIConfig := c.MustGet(\"config\").(config.Config)\n\tsdkConfig := sdk.Config{\n\t\twatchAPIConfig.ActionAPI.BaseURL,\n\t\twatchAPIConfig.ActionAPI.Version,\n\t}\n\tfor _, pointer := range watches {\n\t\tgo func() {\n\t\t\twatch := *pointer\n\t\t\tactionsIds := watch.Do()\n\t\t\tif len(actionsIds) == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// @I Trigger all Watch Actions in one request\n\t\t\tfor _, actionID := range actionsIds {\n\t\t\t\tgo func() {\n\t\t\t\t\terr := sdk.TriggerByID(actionID, sdkConfig)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t// @I Investigate log management strategy for all services\n\t\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t\t}\n\t\t}()\n\t}\n\n\t// All good.\n\tc.JSON(\n\t\thttp.StatusOK,\n\t\tgin.H{\n\t\t\t\"status\": http.StatusOK,\n\t\t},\n\t)\n}", "func (c *volumeSnapshotSchedules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"volumesnapshotschedules\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (m *Manager) Watch(mObj *models.CrudWatcherCreateArgs, client crude.Watcher) (string, error) {\n\tm.InWObj = mObj\n\treturn m.RetWID, m.RetWErr\n}", "func (s *Server) Watch(in *grpc_health_v1.HealthCheckRequest, server grpc_health_v1.Health_WatchServer) error {\n\tresp := &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_SERVING}\n\treturn server.Send(resp)\n}", "func Watch(strinput2 string, tc net.Conn, watcherport int, dest *string) {\n\tnetwork.SendDataMessage(&tc, 4, 8, watcherport, strinput2)\n\tgo ListentoWatcherport(watcherport, dest)\n}", "func (c *ClusterResourceClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {\n\treturn c.clientCache.ClusterOrDie(logicalcluster.Wildcard).Resource(c.resource).Watch(ctx, opts)\n}", "func (c *stewards) Watch(opts metav1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"stewards\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch()\n}", "func (c *aITrainingJobs) Watch(opts metav1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"aitrainingjobs\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch()\n}", "func (b *StatefulSetBox) Watch(namespace, labelSelector string, timeoutSeconds *int64) (watch.Interface, error) {\n\t// labelSelector: example \"app\", \"app=test-app\"\n\topt := metav1.ListOptions{TimeoutSeconds: timeoutSeconds, LabelSelector: labelSelector}\n\tw, err := b.clientset.AppsV1().StatefulSets(namespace).Watch(opt)\n\treturn w, err\n}", "func (s *Session) Watch(watchObject ...map[string]bool) {\n\tobjectString := \"\"\n\tif len(watchObject) == 1 {\n\t\tvar values []string\n\t\tfor k, v := range watchObject[0] {\n\t\t\tvalues = append(values, fmt.Sprintf(`\"%s\":%v`, k, v))\n\t\t}\n\t\tobjectString = fmt.Sprintf(`={%s}`, strings.Join(values, \",\"))\n\t}\n\ts.SendCommand(WatchCommand + objectString)\n}", "func watch(url string, etcdcli *etcdutil.EtcdClient) {\n\n\t// test given host provides a remote api.\n\ttestUrl := url + \"/images/json\"\n\tif _, ret := apiwatch.GetContent(testUrl); ret == false {\n\t\tglog.Errorf(\"cloud not access test endpoint %s. It might not provide a docker remote api.\", testUrl)\n\t\tos.Exit(1)\n\t}\n\n\t// watch http streaming on /events.\n\teventUrl := url + \"/events\"\n\tglog.Infof(\"start watching docker api: %s\", eventUrl)\n\n\tapiwatch.ReadStream(eventUrl, func(id string, status string) {\n\t\tinspectUrl := url + \"/containers/\" + id + \"/json\"\n\n\t\tswitch status {\n\t\tcase \"start\":\n\t\t\tglog.Infof(\"inspect: %s\\n\", inspectUrl)\n\t\t\tdata, _ := apiwatch.GetContent(inspectUrl)\n\t\t\tcontainerInfo := apiwatch.JsonToMap(data)\n\t\t\tconfig, _ := containerInfo[\"Config\"].(map[string]interface{})\n\n\t\t\tnetworkSettings, _ := containerInfo[\"NetworkSettings\"].(map[string]interface{})\n\t\t\tregisterIp(config[\"Hostname\"].(string), networkSettings[\"IPAddress\"].(string), etcdcli)\n\t\tcase \"stop\":\n\t\t\tglog.Infof(\"inspect: %s\\n\", inspectUrl)\n\t\t\tdata, _ := apiwatch.GetContent(inspectUrl)\n\t\t\tcontainerInfo := apiwatch.JsonToMap(data)\n\t\t\tconfig, _ := containerInfo[\"Config\"].(map[string]interface{})\n\n\t\t\tunregisterIp(config[\"Hostname\"].(string), etcdcli)\n\t\tdefault:\n\t\t}\n\t})\n}", "func New() ResourceWatcher {\n\treturn ResourceWatcher{\n\t\twatched: make(map[types.NamespacedName][]types.NamespacedName),\n\t}\n}", "func (mw *MultiWatcher) Watch(ctx context.Context) {\n\twg := sync.WaitGroup{}\n\twg.Add(len(mw.watchers))\n\tfor _, w := range mw.watchers {\n\t\tgo func(w *Watcher) {\n\t\t\tdefer wg.Done()\n\t\t\tw.Watch(ctx)\n\t\t}(w)\n\t}\n\twg.Wait()\n}", "func NewWatcher(conn Searcher, dur time.Duration, logger *log.Logger) (*Watcher, error) {\n\tif dur == 0 {\n\t\tdur = defaultDuration\n\t}\n\n\tif logger == nil {\n\t\tlogger = log.New(os.Stdout, \"\", log.LstdFlags)\n\t}\n\n\tw := Watcher{\n\t\tconn: conn,\n\t\tduration: dur,\n\t\tlogger: logger,\n\t\twatches: make([]*Watch, 0),\n\t}\n\n\treturn &w, nil\n}", "func (c *configAuditReports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"configauditreports\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (w *Watcher) Watch() {\n\tch := make(chan struct{})\n\tgo func(stopCh <-chan struct{}) {\n\t\tw.Informer.Informer().AddEventHandler(w.ResourceEventHandlerFuncs)\n\t\tw.Informer.Informer().Run(stopCh)\n\t}(ch)\n\t<-w.StopChannel\n\tclose(ch)\n\tlogrus.Info(\"stoping watcher for \", w.GroupVersionResource)\n}", "func (api *hostAPI) Watch(handler HostHandler) error {\n\tapi.ct.startWorkerPool(\"Host\")\n\treturn api.ct.WatchHost(handler)\n}", "func (m *MPD) Watch(ctx context.Context) Watch {\n\treturn goWatch(ctx, m.url)\n}", "func Watch(path ...string) (Watcher, error) {\n\treturn conf.Watch(path...)\n}", "func (self *manager) WatchForEvents(request *events.Request) (*events.EventChannel, error) {\n\treturn self.eventHandler.WatchEvents(request)\n}", "func (c *FakeProjects) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(core.NewWatchAction(projectsResource, c.ns, opts))\n\n}", "func (cs *checkoutService) Watch(req *healthpb.HealthCheckRequest, server healthpb.Health_WatchServer) error {\n\treturn nil\n}", "func (w *Watcher) Watch() {\n\tfor {\n\t\tselect {\n\t\tcase ev := <-w.watcher.Event:\n\t\t\tfor _, handler := range w.modifiedHandlers {\n\t\t\t\tif strings.HasPrefix(ev.Name, handler.path) {\n\t\t\t\t\tfmt.Println(handler)\n\t\t\t\t\thandler.callback(ev.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Println(\"event:\", ev)\n\t\t\tlog.Println(\"handlers:\", w.modifiedHandlers)\n\t\t\t//case addreq :=\n\t\tcase err := <-w.watcher.Error:\n\t\t\tlog.Println(\"error:\", err)\n\t\t}\n\t}\n}", "func (inn *LocalNode) consulWatch(conf *Config) error {\n\tfilter := map[string]interface{}{\n\t\t\"type\": \"service\",\n\t\t\"service\": conf.Consul.Service,\n\t}\n\n\tpl, err := consulwatch.Parse(filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpl.Handler = inn.serviceHandler\n\treturn pl.RunWithConfig(conf.Consul.Address, &conf.Consul.Config)\n}", "func (w *ClusterDynamicClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {\n\treturn w.dClient.Resource(w.resource).Namespace(w.namespace).Watch(w.ctx, opts)\n}", "func (c *awsServiceDiscoveryServices) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsservicediscoveryservices\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tWatch()\n}", "func (m *EtcdManager) Watch(key string, opts ...clientv3.OpOption) <-chan clientv3.WatchResponse {\n\treturn m.cli.Watch(context.Background(), key, opts...)\n}", "func (f *extendedPodFactory) ListWatch(customResourceClient interface{}, ns string, fieldSelector string) cache.ListerWatcher {\n\tclient := customResourceClient.(clientset.Interface)\n\treturn &cache.ListWatch{\n\t\tListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {\n\t\t\treturn client.CoreV1().Pods(ns).List(context.TODO(), opts)\n\t\t},\n\t\tWatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) {\n\t\t\treturn client.CoreV1().Pods(ns).Watch(context.TODO(), opts)\n\t\t},\n\t}\n}", "func (c *tiKVGroups) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"tikvgroups\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch()\n}", "func (st *fakeConn) Watch(ctx context.Context, filePath string) (current *WatchData, changes <-chan *WatchData, err error) {\n\treturn current, changes, err\n}", "func (c *rpcServices) Watch(opts metav1.ListOptions) (watch.Interface, error) {\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"rpcservices\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tWatch()\n}", "func (api *configurationsnapshotAPI) Watch(handler ConfigurationSnapshotHandler) error {\n\tapi.ct.startWorkerPool(\"ConfigurationSnapshot\")\n\treturn api.ct.WatchConfigurationSnapshot(handler)\n}", "func (c *staticFabricNetworkAttachments) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"staticfabricnetworkattachments\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (service *DaemonHeartbeat) Watch(*grpc_health_v1.HealthCheckRequest, grpc_health_v1.Health_WatchServer) error {\n\treturn nil\n}", "func (c *clusterVulnerabilityReports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tResource(\"clustervulnerabilityreports\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (c *backingservices) Watch(opts kapi.ListOptions) (watch.Interface, error) {\n\treturn c.r.Get().\n\t\tNamespace(c.ns).\n\t\tPrefix(\"watch\").\n\t\tResource(\"backingservices\").\n\t\tVersionedParams(&opts, kapi.ParameterCodec).\n\t\tWatch()\n}", "func (c *FakeECSDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(ecsdeploymentsResource, c.ns, opts))\n\n}", "func (s *stateManager) Watch(watcher *AllocationWatcher) func() {\n\tstopChan := make(chan interface{})\n\ts.stopChan = append(s.stopChan, stopChan)\n\tctx := context.Background()\n\n\tkey := fmt.Sprintf(\"%s/allocations\", etcdPrefix)\n\twatchChan := s.cli.Watch(ctx, key, clientv3.WithPrefix(), clientv3.WithPrevKV())\n\n\tstopFunc := func() {\n\t\tstopChan <- true\n\t}\n\n\t// Start a new thread and watch for changes in etcd\n\tgo s.watchChannel(watchChan, stopChan, watcher)\n\n\treturn stopFunc\n}", "func (c *kuberhealthyChecks) Watch(opts metav1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"khchecks\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(context.TODO())\n}", "func (cmw *SecretWatcher) watch() error {\n\tsec, err := cmw.kubeClient.Secrets(cmw.namespace).Get(cmw.name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsel := generic.ObjectMetaFieldsSet(&sec.ObjectMeta, true)\n\tw, err := cmw.kubeClient.Secrets(cmw.namespace).Watch(api.ListOptions{\n\t\tFieldSelector: sel.AsSelector(),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tcmw.w = w\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event, ok := <-w.ResultChan():\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif event.Type != watch.Added {\n\t\t\t\t\tcmw.OnEvent()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (m *Manager) Watch() error {\n\tfor req, channel := range m.changesChannels {\n\t\tif err := m.startWatchingFlow(req, channel); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (watcher *GitWatcher) watchLoop() {\n\tc := watcher.KubeClient\n\tns := watcher.Namespace\n\tw, err := c.Extensions().Deployments(ns).Watch(*watcher.ListOpts)\n\tif err != nil {\n\t\tprintError(err)\n\t}\n\tkubectl.WatchLoop(w, func(e watch.Event) error {\n\t\to := e.Object\n\t\tswitch o := o.(type) {\n\t\tcase *extensions.Deployment:\n\t\t\twatcher.CheckC <- o\n\t\tdefault:\n\t\t\tutil.Warnf(\"Unknown watch object type %v\\n\", o)\n\t\t}\n\t\treturn nil\n\t})\n}", "func (c *FakeKconfigs) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(kconfigsResource, c.ns, opts))\n\n}" ]
[ "0.5909597", "0.59083927", "0.5884586", "0.58768004", "0.58135056", "0.5808285", "0.5632079", "0.5628538", "0.5565414", "0.55580974", "0.5540909", "0.5540064", "0.55053604", "0.55044025", "0.55031914", "0.5497162", "0.54961246", "0.5490093", "0.5444556", "0.5431618", "0.5420408", "0.5418779", "0.54105276", "0.5396375", "0.53775835", "0.53772193", "0.536893", "0.5358953", "0.53499526", "0.5348972", "0.53407836", "0.5335128", "0.5327566", "0.5321739", "0.53141207", "0.5312987", "0.53027195", "0.53026253", "0.52891433", "0.52725303", "0.5255772", "0.5251981", "0.5247656", "0.52442753", "0.5221991", "0.52133435", "0.5199371", "0.5194138", "0.51865613", "0.5185779", "0.51644915", "0.5137732", "0.51328963", "0.5125818", "0.5118756", "0.5118321", "0.50858617", "0.5082259", "0.5078108", "0.5069619", "0.50672626", "0.50648123", "0.50585246", "0.50523853", "0.50375193", "0.50319135", "0.50229007", "0.50061774", "0.50026155", "0.4998762", "0.4995775", "0.49842614", "0.4981646", "0.49617863", "0.49551943", "0.4948122", "0.49477625", "0.4940457", "0.49367863", "0.4929746", "0.49285692", "0.49262688", "0.49203494", "0.49073344", "0.49000624", "0.48969886", "0.48964828", "0.48934254", "0.48887238", "0.4885322", "0.48805565", "0.48758", "0.4874977", "0.487414", "0.48731765", "0.48712346", "0.4862879", "0.48627776", "0.48619696", "0.4860093" ]
0.74523795
0
Create takes the representation of a cloudwatchEventTarget and creates it. Returns the server's representation of the cloudwatchEventTarget, and an error, if there is any.
func (c *FakeCloudwatchEventTargets) Create(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{}) if obj == nil { return nil, err } return obj.(*v1alpha1.CloudwatchEventTarget), err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewEventTarget(ctx *pulumi.Context,\n\tname string, args *EventTargetArgs, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tif args == nil || args.Arn == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Arn'\")\n\t}\n\tif args == nil || args.Rule == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Rule'\")\n\t}\n\tif args == nil {\n\t\targs = &EventTargetArgs{}\n\t}\n\tvar resource EventTarget\n\terr := ctx.RegisterResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (e *EventAPI) Create(eventType *EventType) error {\n\tconst errMsg = \"unable to create event type\"\n\n\tresponse, err := e.client.httpPOST(e.backOffConf.create(), e.eventBaseURL(), eventType, errMsg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusCreated {\n\t\tbuffer, err := io.ReadAll(response.Body)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"%s: unable to read response body\", errMsg)\n\t\t}\n\t\treturn decodeResponseToError(buffer, errMsg)\n\t}\n\n\treturn nil\n}", "func CreateCloudEvent(cloudEventVersion string) *event.Event {\n\tcloudEvent := event.New(cloudEventVersion)\n\tcloudEvent.SetID(EventId)\n\tcloudEvent.SetType(EventType)\n\tcloudEvent.SetSource(EventSource)\n\tcloudEvent.SetDataContentType(EventDataContentType)\n\tcloudEvent.SetSubject(EventSubject)\n\tcloudEvent.SetDataSchema(EventDataSchema)\n\tcloudEvent.SetExtension(constants.ExtensionKeyPartitionKey, PartitionKey)\n\t_ = cloudEvent.SetData(EventDataContentType, EventDataJson)\n\treturn &cloudEvent\n}", "func (s *TargetCRUD) Create(arg ...crud.Arg) (crud.Arg, error) {\n\tevent := eventFromArg(arg[0])\n\ttarget := targetFromStuct(event)\n\tprint.CreatePrintln(\"creating target\", *target.Target.Target,\n\t\t\"on upstream\", *target.Upstream.ID)\n\treturn target, nil\n}", "func (c *FakeCloudwatchEventTargets) Update(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (c *FakeCloudwatchEventTargets) Get(name string, options v1.GetOptions) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (c *FakeCloudwatchEventTargets) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{})\n\n\treturn err\n}", "func createEvent(action string) *Event {\n\treturn &Event{\n\t\tID: uuid.Generate().String(),\n\t\tTimestamp: time.Now(),\n\t\tAction: action,\n\t}\n}", "func (s *server) CreateEvent(context.Context, *pb.CreateEventRequest) (*pb.CreateEventResponse, error) {\n\treturn nil, nil\n}", "func (s *Service) CreateEvent(ctx context.Context, req *request.CreateEvent) (*response.Message, error) {\n\t// TODO\n\treturn nil, nil\n}", "func NewCloudPcAuditEvent()(*CloudPcAuditEvent) {\n m := &CloudPcAuditEvent{\n Entity: *NewEntity(),\n }\n return m\n}", "func (es *EntityEventService) Create(campID int, entID int, evt SimpleEntityEvent) (*EntityEvent, error) {\n\tvar err error\n\tend := EndpointCampaign\n\n\tif end, err = end.id(campID); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid Campaign ID: %w\", err)\n\t}\n\tend = end.concat(endpointEntity)\n\n\tif end, err = end.id(entID); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid Entity ID: %w\", err)\n\t}\n\tend = end.concat(es.end)\n\n\tb, err := json.Marshal(evt)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot marshal SimpleEntityEvent: %w\", err)\n\t}\n\n\tvar wrap struct {\n\t\tData *EntityEvent `json:\"data\"`\n\t}\n\n\tif err = es.client.post(end, bytes.NewReader(b), &wrap); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create EntityEvent for Campaign (ID: %d): %w\", campID, err)\n\t}\n\n\treturn wrap.Data, nil\n}", "func (h *eventServiceHTTPHandler) CreateEvent(c echo.Context) error {\n\tlogCtx := fmt.Sprintf(\"%T.CreateEvent\", *h)\n\n\tparams := model.CreateEventReq{}\n\tif err := c.Bind(&params); err != nil {\n\t\thelper.Log(logrus.ErrorLevel, err.Error(), logCtx, \"error_bind_params\")\n\t\treturn helper.NewResponse(http.StatusBadRequest, http.StatusBadRequest, err.Error(), nil).WriteResponse(c)\n\t}\n\n\tif err := sanitizer.ValidateCreateEvent(&params); err != nil {\n\t\thelper.Log(logrus.ErrorLevel, err.Error(), logCtx, \"error_validate_params\")\n\t\treturn helper.NewResponse(http.StatusBadRequest, http.StatusBadRequest, err.Error(), nil).WriteResponse(c)\n\t}\n\n\tresp, err := h.eventUseCase.CreateEvent(&params)\n\tif err != nil {\n\t\thelper.Log(logrus.ErrorLevel, err.Error(), logCtx, \"error_create_event\")\n\t\treturn helper.NewResponse(http.StatusInternalServerError, http.StatusInternalServerError, err.Error(), nil).WriteResponse(c)\n\t}\n\n\tdata := make(map[string]interface{})\n\tdata[\"event\"] = resp\n\treturn helper.NewResponse(http.StatusCreated, http.StatusCreated, \"Success\", data).WriteResponse(c)\n}", "func (c *EventClient) Create() *EventCreate {\n\tmutation := newEventMutation(c.config, OpCreate)\n\treturn &EventCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func CreateEvent(request protocols.Request, outputEvent output.InternalEvent, isResponseDebug bool) *output.InternalWrappedEvent {\n\treturn CreateEventWithAdditionalOptions(request, outputEvent, isResponseDebug, nil)\n}", "func CreateEvent(name string) *corev1.Event {\n\treturn &corev1.Event{\n\t\tTypeMeta: genTypeMeta(gvk.Event),\n\t\tObjectMeta: genObjectMeta(name, true),\n\t}\n}", "func (s service) Create(ctx context.Context, email, component, environment, message string, data map[string]string) (*models.Event, error) {\n\tval, _ := json.Marshal(data)\n\te := &models.Event{\n\t\tEmail: email,\n\t\tComponent: component,\n\t\tEnvironment: environment,\n\t\tMessage: message,\n\t\tData: datatypes.JSON([]byte(val)),\n\t}\n\tevent, err := e.Create(s.DB)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event, nil\n}", "func New(t Type, opts ...Option) (Event, error) {\n\tfactory, ok := eventFactories[t]\n\tif !ok {\n\t\treturn nil, errors.New(\"unknown event type\")\n\t}\n\n\treturn factory(opts...), nil\n}", "func GetEventTarget(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EventTargetState, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tvar resource EventTarget\n\terr := ctx.ReadResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewCloudEvent(req *CloudEvent, metadata map[string]string) (map[string]interface{}, error) {\n\tif contribContenttype.IsCloudEventContentType(req.DataContentType) {\n\t\treturn contribPubsub.FromCloudEvent(req.Data, req.Topic, req.Pubsub, req.TraceID, req.TraceState)\n\t}\n\n\t// certain metadata beginning with \"cloudevent.\" are considered overrides to the cloudevent envelope\n\t// we ignore any error here as the original cloud event envelope is still valid\n\t_ = mapstructure.WeakDecode(metadata, req) // allows ignoring of case\n\n\t// the final cloud event envelope contains both \"traceid\" and \"traceparent\" set to the same value (req.TraceID)\n\t// eventually \"traceid\" will be deprecated as it was superseded by \"traceparent\"\n\t// currently \"traceparent\" is not set by the pubsub component and can only set by the user via metadata override\n\t// therefore, if an override is set for \"traceparent\", we use it, otherwise we use the original or overridden \"traceid\" value\n\tif req.TraceParent != \"\" {\n\t\treq.TraceID = req.TraceParent\n\t}\n\treturn contribPubsub.NewCloudEventsEnvelope(req.ID, req.Source, req.Type,\n\t\t\"\", req.Topic, req.Pubsub, req.DataContentType, req.Data, req.TraceID, req.TraceState), nil\n}", "func (e *Event) Create(c echo.Context, req takrib.Event) (*takrib.Event, error) {\n\treturn e.udb.Create(e.db, req)\n}", "func (s *Server) CreateEvent(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\tb, err := ioutil.ReadAll(r.Body)\n\tdefer r.Body.Close()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tvar event Event\n\tif err = json.Unmarshal(b, &event); err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\teventUUID, err := uuid.NewUUID()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\teventID := eventUUID.String()\n\n\tevent.ID = eventID\n\n\terr1 := s.database.CreateEvent(ctx, &event)\n\tif httperr.HandleError(w, err, http.StatusInternalServerError) {\n\t\ts.logger.For(ctx).Error(\"request failed\", zap.Error(err1))\n\t\treturn\n\t}\n\n\tresponse := CreatePostResponse{\"success\"}\n\tjsonResponse, err := json.Marshal(response)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(jsonResponse)\n}", "func (c *EventService) Create(input *EventCreateInput) (CreateResult, *http.Response, error) {\n\treturn doCreate(c.sling, c.endpoint, input)\n}", "func (s *gRPCServer) Create(ctx context.Context, req *pb.CreateEventRequest) (*pb.CreateEventResponse, error) {\n\t_, resp, err := s.create.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.(*pb.CreateEventResponse), nil\n}", "func (ec *EventController) Create(ctx context.Context, event *Event) error {\n\t_, err := ec.collection.InsertOne(ctx, *event)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Client) CreateEvent(event *corev1.Event) (*corev1.Event, error) {\n\tif err := c.initClient(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.kubernetes.CoreV1().Events(event.Namespace).Create(event)\n}", "func NewEvent(timestampMs int64, message string) *Event {\n\tevent := &Event{\n\t\tInputLogEvent: &cloudwatchlogs.InputLogEvent{\n\t\t\tTimestamp: aws.Int64(timestampMs),\n\t\t\tMessage: aws.String(message)},\n\t}\n\treturn event\n}", "func (c *FakeCloudwatchEventTargets) List(opts v1.ListOptions) (result *v1alpha1.CloudwatchEventTargetList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(cloudwatcheventtargetsResource, cloudwatcheventtargetsKind, c.ns, opts), &v1alpha1.CloudwatchEventTargetList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.CloudwatchEventTargetList{ListMeta: obj.(*v1alpha1.CloudwatchEventTargetList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.CloudwatchEventTargetList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func New(message, detail interface{}) (CustomEvent, error) {\n\tvar event CustomEvent\n\tvar jsObj js.Value\n\n\tif objGo, ok := detail.(baseobject.ObjectFrom); ok {\n\t\tjsObj = objGo.JSObject()\n\t} else {\n\t\tjsObj = js.ValueOf(detail)\n\t}\n\n\tif eventi := GetInterface(); !eventi.IsNull() {\n\t\tevent.BaseObject = event.SetObject(eventi.New(js.ValueOf(message), js.ValueOf(map[string]interface{}{\"detail\": jsObj})))\n\t\treturn event, nil\n\t}\n\treturn event, ErrNotImplemented\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 New() Event {\n\treturn Event{}\n}", "func New(eventType Type, srv server.Server, bootType, script string, params map[string]interface{}) Event {\n\tvar event Event\n\n\tevent.Type = eventType\n\tevent.Date = time.Now()\n\tevent.Server = srv\n\tevent.BootType = bootType\n\tevent.Script = script\n\tevent.Params = params\n\n\tevent.setMessage()\n\n\treturn event\n}", "func (a *Auditor) NewEvent(tenantID, userID, eventName, eventResult, resourceCategory, resourceType, resourceID, resourceName string, body string) {\n\ttenantName := tenantID\n\tuserName, err := cas.GetUserNameByID(userID)\n\tif err != nil {\n\t\tuserName = userID\n\t\tklog.Errorf(\"cannot get username with id %s: %+v\", userID, err)\n\t}\n\te := event{\n\t\tdata: AutoGenerated{\n\t\t\tTenantID: tenantID,\n\t\t\tTenantName: tenantName,\n\t\t\tUserID: userID,\n\t\t\tUserName: userName,\n\t\t\tRecordTime: time.Now().Format(\"2006-01-02 15:04:05\"),\n\t\t\tEventName: eventName,\n\t\t\tEventResult: eventResult,\n\t\t\tResourceCategory: resourceCategory,\n\t\t\tResourceType: resourceType,\n\t\t\tResourceID: resourceID,\n\t\t\tResourceName: resourceName,\n\t\t\tRequestBody: body,\n\t\t},\n\t\tretry: 2,\n\t}\n\tklog.V(5).Infof(\"new audit log: %+v\", e.data)\n\ta.queue <- e\n}", "func (s *eventServer) Create(ctx context.Context, in *eventPb.CreateRequest) (*eventPb.CreateReply, error) {\n\tid := uuid.Must(uuid.NewV4()).String()\n\n\tidentity := &identityPb.Identity{}\n\tproto.Unmarshal(in.Data, identity)\n\tdata[in.ProcessId] = identity\n\tfmt.Printf(\"Create Event Called %s: %s\\n\", id, data[in.ProcessId].PhoneNumber)\n\treturn &eventPb.CreateReply{Id: id}, nil\n}", "func newEvent(name string, args ...interface{}) (*Event, error) {\n\tid, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\theader := &EventHeader{Id: id.String(), Version: ProtocolVersion}\n\n\te := Event{\n\t\tHeader: header,\n\t\tName: name,\n\t\tArgs: args,\n\t}\n\n\treturn &e, nil\n}", "func (c *RabbitEventStoreClient) CreateEvent(event framework.Event) (newEvent framework.Event, err error) {\n\terr = c.client.Send(Request{\n\t\tAction: \"CreateEvent\",\n\t\tData: event,\n\t}, &newEvent)\n\n\treturn newEvent, err\n}", "func NewEvent(data map[string]interface{}) (Event, error) {\n\treturn parseToEventType(data)\n}", "func (c *FakeAWSSNSTargets) Create(ctx context.Context, aWSSNSTarget *v1alpha1.AWSSNSTarget, opts v1.CreateOptions) (result *v1alpha1.AWSSNSTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(awssnstargetsResource, c.ns, aWSSNSTarget), &v1alpha1.AWSSNSTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.AWSSNSTarget), err\n}", "func NewEvent(host, token string) *EventCollectorClient {\n\te := &EventCollectorClient{}\n\n\t// Start generating the new request\n\treq, err := http.NewRequest(\"POST\", host+\"/services/collector/event\", nil)\n\tif err != nil {\n\t\tfmt.Printf(err.Error())\n\t\treturn e\n\t}\n\treq.Header.Set(\"User-Agent\", \"Go-Splunk/\"+Version)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Authorization\", \"Splunk \"+token)\n\n\t// Set the request within Client\n\te.Request = req\n\treturn e\n}", "func (c *FakeCloudwatchEventTargets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(cloudwatcheventtargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (b Build) CreateEvent(c *gin.Context) {\n\tbuild, err := b.unauthOne(c)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif !b.canPostEvent(c, build) {\n\t\tc.AbortWithStatus(403)\n\t\treturn\n\t}\n\n\tevent := models.PostBatchEvent{}\n\tc.BindJSON(&event)\n\n\tif !sugar.ValidateRequest(c, event) {\n\t\treturn\n\t}\n\n\tcurrentStatus := build.Status()\n\n\tif !models.CanTransition(currentStatus, event.Status) {\n\t\tsugar.ErrResponse(c, 400, fmt.Sprintf(\"%s not valid when current status is %s\", event.Status, currentStatus))\n\t\treturn\n\t}\n\n\t_, isUser := middleware.CheckUser(c)\n\tif event.Status == models.StatusTerminated && isUser {\n\t\tsugar.ErrResponse(c, 400, fmt.Sprintf(\"Users cannot post TERMINATED events, please upgrade to reco v0.3.1 or above\"))\n\t}\n\n\tnewEvent, err := BatchService{AWS: b.AWS}.AddEvent(&build.BatchJob, event)\n\n\tif event.Status == \"CREATING_IMAGE\" {\n\t\terr = db.Model(&build).Update(\"FPGAImage\", event.Message).Error\n\t}\n\n\tif err != nil {\n\t\tsugar.InternalError(c, err)\n\t\treturn\n\t}\n\teventMessage := \"Build entered state:\" + event.Status\n\tsugar.EnqueueEvent(b.Events, c, eventMessage, build.Project.UserID, map[string]interface{}{\"build_id\": build.ID, \"project_name\": build.Project.Name, \"message\": event.Message})\n\tsugar.SuccessResponse(c, 200, newEvent)\n}", "func (x *fastReflection_EventCreateClass) New() protoreflect.Message {\n\treturn new(fastReflection_EventCreateClass)\n}", "func EventCreate(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\teventId, _ := strconv.ParseInt(vars[\"eventId\"], 10, 64)\n\n\tevent, err := event.EventGetById(userId)\n\n\tif err == nil {\n\t\tresponse.Success(w, event)\n\t} else {\n\t\tresponse.Fail(w, http.StatusNotFound, err.Error())\n\t}\n}", "func NewEvent(action string, version int8, parent uuid.UUID, key []byte, data []byte) Event {\n\tid := uuid.Must(uuid.NewV4())\n\tif key == nil {\n\t\tkey = id.Bytes()\n\t}\n\n\t// Fix: unexpected end of JSON input\n\tif len(data) == 0 {\n\t\tdata = []byte(\"null\")\n\t}\n\n\tevent := Event{\n\t\tParent: parent,\n\t\tID: id,\n\t\tHeaders: make(map[string]string),\n\t\tAction: action,\n\t\tData: data,\n\t\tKey: key,\n\t\tStatus: StatusOK,\n\t\tVersion: version,\n\t\tCtx: context.Background(),\n\t}\n\n\treturn event\n}", "func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToListenerCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\t_, r.Err = c.Post(rootURL(c), b, &r.Body, &golangsdk.RequestOpts{\n\t\tOkCodes: []int{200},\n\t})\n\treturn\n}", "func New(client kubernetes.Interface) *Event {\n\tbroadcaster := record.NewBroadcaster()\n\tbroadcaster.StartLogging(glog.V(4).Infof)\n\tbroadcaster.StartRecordingToSink(&corev1.EventSinkImpl{Interface: corev1.New(client.CoreV1().RESTClient()).Events(namespace)})\n\treturn &Event{\n\t\trecorder: broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: component}),\n\t}\n}", "func (s *WebhooksServiceOp) Create(webhook Webhook, options ...interface{}) (Webhook, error) {\n\tvar webhookResponse GetWebhookResponse\n\tjsonBody, err := json.Marshal(webhook)\n\tif err != nil {\n\t\treturn webhookResponse.Data, err\n\t}\n\treqBody := bytes.NewReader(jsonBody)\n\tbody, reqErr := s.client.DoRequest(http.MethodPost, \"/v3/hooks\", reqBody)\n\tif reqErr != nil {\n\t\treturn webhookResponse.Data, reqErr\n\t}\n\n\tjsonErr := json.Unmarshal(body, &webhookResponse)\n\tif jsonErr != nil {\n\t\treturn webhookResponse.Data, jsonErr\n\t}\n\n\treturn webhookResponse.Data, nil\n}", "func (els *EventLocalStore) Create(e *entities.Event) error {\n\tels.mutex.Lock()\n\tels.events[e.ID] = e\n\tels.mutex.Unlock()\n\n\treturn nil\n}", "func HandleCreateEvent(w rest.ResponseWriter, req *rest.Request) {\n\tif err := RequireWriteKey(w, req); err != nil {\n\t\trest.Error(w, err.Error(), err.(StatusError).Code)\n\t\treturn\n\t}\n\n\tproject := currentProject(req)\n\tevent := req.PathParam(\"event_name\")\n\n\tvar data CreateSingleEventParams\n\tvar err error\n\tif err = eventData(req, &data); err != nil {\n\t\trest.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tevents := make(map[string][]interface{})\n\tevents[event] = []interface{}{data}\n\n\tresult, err := createEvent(project, event, data)\n\n\tif err != nil {\n\t\trest.Error(w, err.Error(), http.StatusBadRequest)\n\t} else {\n\t\tw.WriteJson(result)\n\t}\n}", "func New(secret string, h Func) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tb, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Error(\"reading body\")\n\t\t\tresponse.InternalServerError(w)\n\t\t\treturn\n\t\t}\n\n\t\tsignature := r.Header.Get(\"Stripe-Signature\")\n\t\te, err := webhook.ConstructEvent(b, signature, secret)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Error(\"constructing event\")\n\t\t\tresponse.InternalServerError(w)\n\t\t\treturn\n\t\t}\n\n\t\tctx := log.WithFields(log.Fields{\n\t\t\t\"event_id\": e.ID,\n\t\t\t\"event_type\": e.Type,\n\t\t})\n\n\t\tctx.Info(\"handling stripe event\")\n\t\tif err := h(&e); err != nil {\n\t\t\tctx.WithError(err).Error(\"handling stripe event\")\n\t\t\tresponse.InternalServerError(w)\n\t\t\treturn\n\t\t}\n\n\t\tctx.Info(\"handled stripe event\")\n\t\tresponse.OK(w)\n\t})\n}", "func CreateEvent(client *http.Client, c *config.Config) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Verify the JWT token since it's a protected route.\n\t\ttokenCookie, err := r.Cookie(c.Jwt.CookieName)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to get cookie: %v\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\t_, err = jwt.VerifyToken(tokenCookie.Value, &c.Jwt)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to verify token: %v\", err)\n\t\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\t\t// Create the request that's gonna call our event service.\n\t\treq, err := http.NewRequest(http.MethodPost, fmt.Sprintf(\"http://%v:%v\", c.Service.Event.Host, c.Service.Event.Port), r.Body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to create new request: %v\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\t// Make the request.\n\t\tres, err := client.Do(req)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to do request: %v\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Read the response body (the created event if the request was successful).\n\t\tb, err := ioutil.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to read response body: %v\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Respond with the received response (the status code is hopefully 201 Status Created).\n\t\tw.Header().Set(CONTENT_TYPE, res.Header.Get(CONTENT_TYPE))\n\t\tw.WriteHeader(res.StatusCode)\n\t\tw.Write(b)\n\t}\n}", "func (pgs *PGStorage) CreateEvent(e event.Event) (event.Event, error) {\n\tsql := `insert into events(uuid, title, datetime, duration, description, userid, notify) \n\t\tvalues(:uuid, :title, :datetime, :duration, :description, :userid, :notify)`\n\teventUUID := uuid.New()\n\t_, err := pgs.DB.NamedExecContext(pgs.Ctx, sql, map[string]interface{}{\n\t\t\"uuid\": eventUUID.String(),\n\t\t\"title\": e.Title,\n\t\t\"datetime\": e.Datetime,\n\t\t\"duration\": e.Duration,\n\t\t\"description\": e.Desc,\n\t\t\"userid\": e.User,\n\t\t\"notify\": e.Notify,\n\t})\n\tif err != nil {\n\t\treturn event.Event{}, err\n\t}\n\te.UUID = eventUUID\n\treturn e, nil\n}", "func (c Create) BuildEvent(context.Context) (goes.EventData, interface{}, error) {\n\treturn CreatedV1{\n\t\tID: \"0563019f-ade9-4cb1-81a7-4f1bb3213cb0\",\n\t\tFirstName: c.FirstName,\n\t\tLastName: c.LastName,\n\t}, nil, nil\n}", "func (w *WebhookServiceOp) Create(webhook Webhook) (*Webhook, error) {\n\tpath := fmt.Sprintf(\"%s\", webhooksBasePath)\n\tresource := new(Webhook)\n\terr := w.client.Post(path, webhook, &resource)\n\treturn resource, err\n}", "func (s *baseStore[T, E, TPtr, EPtr]) Create(ctx context.Context, object TPtr) error {\n\teventPtr := s.newObjectEvent(ctx, CreateEvent)\n\teventPtr.SetObject(*object)\n\tif err := s.createObjectEvent(ctx, eventPtr); err != nil {\n\t\treturn err\n\t}\n\t*object = eventPtr.Object()\n\treturn nil\n}", "func (s *DirectMessageService) EventsCreate(event *DirectMessageEventMessage) (*DirectMessageEventsCreateResponse, *http.Response, error) {\n\tapiParams := &directMessageEventsCreateParams{\n\t\tEvent: &directMessageEventsCreateEvent{\n\t\t\tType: \"message_create\",\n\t\t\tMessage: &directMessageEventsCreateMessage{\n\t\t\t\tTarget: &directMessageEventsCreateTarget{\n\t\t\t\t\tRecipientID: event.Target.RecipientID,\n\t\t\t\t},\n\t\t\t\tData: &directMessageEventsCreateData{\n\t\t\t\t\tText: event.Data.Text,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tapiError := new(APIError)\n\teventResponse := new(DirectMessageEventsCreateResponse)\n\tresp, err := s.sling.New().Post(\"events/new.json\").BodyJSON(apiParams).Receive(eventResponse, apiError)\n\treturn eventResponse, resp, relevantError(err, *apiError)\n}", "func EventCreate(ctx *gin.Context) {\n\tvar user *model.User\n\tif userInterface, exists := ctx.Get(\"User\"); !exists {\n\t\tmisc.ReturnStandardError(ctx, http.StatusForbidden, \"you have to be a registered user to create event\")\n\t\treturn\n\t} else {\n\t\tuser = userInterface.(*model.User)\n\t}\n\tevent := &model.Event{}\n\tphysicalLocation := &model.PhysicalLocation{}\n\tonlineLocation := &model.OnlineLocation{}\n\tif err := jsonapi.UnmarshalPayload(ctx.Request.Body, event); err != nil {\n\t\tmisc.ReturnStandardError(ctx, http.StatusBadRequest, \"cannot unmarshal JSON of request: \"+err.Error())\n\t\treturn\n\t} else if event.Title == nil ||\n\t\tevent.TimeBegin == nil ||\n\t\tevent.TimeEnd == nil ||\n\t\tevent.Type == nil ||\n\t\treflect.ValueOf(event.Location).IsNil() {\n\t\tmisc.ReturnStandardError(ctx, http.StatusBadRequest, \"not all fields required are provided\")\n\t\treturn\n\t} else if eventType, exists := event.Location.(map[string]interface{})[\"type\"]; !exists || (eventType != \"physical\" && eventType != \"online\") {\n\t\tmisc.ReturnStandardError(ctx, http.StatusBadRequest, \"illegal event type\")\n\t\treturn\n\t} else if eventType == \"physical\" &&\n\t\t(mapstructure.Decode(event.Location, physicalLocation) != nil ||\n\t\t\tphysicalLocation.Address == \"\" ||\n\t\t\tphysicalLocation.ZipCode == \"\") {\n\t\tmisc.ReturnStandardError(ctx, http.StatusBadRequest, \"illegal physical location\")\n\t\treturn\n\t} else if eventType == \"online\" &&\n\t\t(mapstructure.Decode(event.Location, onlineLocation) != nil ||\n\t\t\tonlineLocation.Platform == \"\" ||\n\t\t\tonlineLocation.Link == \"\") {\n\t\tmisc.ReturnStandardError(ctx, http.StatusBadRequest, \"illegal online location\")\n\t\treturn\n\t}\n\tevent.OrganizerID = &user.ID\n\tevent.Organizer = user\n\timages := event.Images\n\tdb := ctx.MustGet(\"DB\").(*gorm.DB)\n\ttx := db.Begin()\n\t// we must omit images as inspection has to be gone through before they are linked\n\tif err := tx.Omit(\"Images\").Save(event).Error; err != nil {\n\t\tmisc.ReturnStandardError(ctx, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\t// link images to this event\n\teventString := \"events\"\n\tfor _, image := range images {\n\t\tif image.ID <= 0 {\n\t\t\tmisc.ReturnStandardError(ctx, http.StatusBadRequest, \"invalid image file ID\")\n\t\t} else if err := db.Where(image).Find(image).Error; errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\tmisc.ReturnStandardError(ctx, http.StatusNotFound, \"image specified not found\")\n\t\t} else if err != nil {\n\t\t\tmisc.ReturnStandardError(ctx, http.StatusInternalServerError, err.Error())\n\t\t} else if *image.Status != \"active\" || *image.Type != \"images\" {\n\t\t\tmisc.ReturnStandardError(ctx, http.StatusBadRequest, \"image specified is not active or is not an image\")\n\t\t} else if image.LinkType != nil {\n\t\t\tmisc.ReturnStandardError(ctx, http.StatusBadRequest, \"image has been linked to some other resource object\")\n\t\t} else if err := db.Model(&image).Updates(model.File{LinkID: &event.ID, LinkType: &eventString}).Error; err != nil {\n\t\t\tmisc.ReturnStandardError(ctx, http.StatusInternalServerError, err.Error())\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\t\t// roll back the action of event creation if any of the images cannot pass integrity check\n\t\ttx.Rollback()\n\t\treturn\n\t}\n\tif err := tx.Commit().Error; err != nil {\n\t\ttx.Rollback()\n\t\tmisc.ReturnStandardError(ctx, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tctx.Status(http.StatusCreated)\n\tif err := jsonapi.MarshalPayload(ctx.Writer, event); err != nil {\n\t\tmisc.ReturnStandardError(ctx, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n}", "func newEvent(id string, img model.Image) Event {\n\treturn Event{\n\t\tSource: \"kyma-showcase\",\n\t\tSpecVersion: \"1.0\",\n\t\tEventTypeVersion: \"v1\",\n\t\tData: img.ID,\n\t\tId: id,\n\t\tDataContentType: \"application/json\",\n\t\tEventType: eventType,\n\t}\n}", "func NewEvent(id, eventType string, version int, payload []byte) *Event {\n\tpayloadStr := string(payload)\n\treturn &Event{\n\t\tAggregateID: id,\n\t\tEventType: eventType,\n\t\tVersion: version,\n\t\tEventAt: time.Now(),\n\t\tPayload: &payloadStr,\n\t}\n}", "func (s *server) createEvent(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tdefer r.Body.Close()\n\n\t// Read the body out into a buffer.\n\tbuf, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"%s\", err)\n\t\treturn\n\t}\n\n\t// Read the body as generic JSON, so we can perform JDDF validation on it.\n\t//\n\t// If the request body is invalid JSON, send the user a 400 Bad Request.\n\tvar eventRaw interface{}\n\tif err := json.Unmarshal(buf, &eventRaw); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Fprintf(w, \"%s\", err)\n\t\treturn\n\t}\n\n\t// Validate the event (in eventRaw) against our schema for JDDF events.\n\t//\n\t// In practice, there will never be errors arising here -- see the jddf-go\n\t// docs for details, but basically jddf.Validator.Validate can only error if\n\t// you use \"ref\" in a cyclic manner in your schemas.\n\t//\n\t// Therefore, we ignore the possibility of an error here.\n\tvalidator := jddf.Validator{}\n\tvalidationResult, _ := validator.Validate(s.EventSchema, eventRaw)\n\n\t// If there were validation errors, then we write them out to the response\n\t// body, and send the user a 400 Bad Request.\n\tif len(validationResult.Errors) != 0 {\n\t\tencoder := json.NewEncoder(w)\n\t\tif err := encoder.Encode(validationResult.Errors); err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, \"%s\", err)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// If we made it here, the request body contained JSON that passed our schema.\n\t// Let's now write it into the database.\n\t//\n\t// The events table has a \"payload\" column of type \"jsonb\". In Golang-land,\n\t// you can send that to Postgres by just using []byte. The user's request\n\t// payload is already in that format, so we'll use that.\n\t_, err = s.DB.ExecContext(r.Context(), `\n\t\tinsert into events (payload) values ($1)\n\t`, buf)\n\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, \"%s\", err)\n\t\treturn\n\t}\n\n\t// We're done!\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintf(w, \"%s\", buf)\n}", "func (wh *Webhook) Create(accountId string, data map[string]interface{}, extraHeaders map[string]string) (map[string]interface{}, error) {\n\tif accountId != \"\" {\n\t\turl := fmt.Sprintf(\"/%s%s/%s%s\", constants.VERSION_V2, constants.ACCOUNT_URL, url.PathEscape(accountId), constants.WEBHOOK)\n\t\treturn wh.Request.Post(url, data, extraHeaders)\n\t}\n\turl := fmt.Sprintf(\"/%s%s\", constants.VERSION_V1, constants.WEBHOOK)\n\treturn wh.Request.Post(url, data, extraHeaders)\n}", "func (command HelloWorldResource) Create(ctx context.Context, awsConfig awsv2.Config,\n\tevent *CloudFormationLambdaEvent,\n\tlogger *zerolog.Logger) (map[string]interface{}, error) {\n\trequest := HelloWorldResourceRequest{}\n\trequestPropsErr := json.Unmarshal(event.ResourceProperties, &request)\n\tif requestPropsErr != nil {\n\t\treturn nil, requestPropsErr\n\t}\n\tlogger.Info().Msgf(\"create: Hello %s\", request.Message)\n\treturn map[string]interface{}{\n\t\t\"Resource\": \"Created message: \" + request.Message,\n\t}, nil\n}", "func NewEvent(x, y float64, button, event string) Event {\n\treturn Event{\n\t\tPoint2: floatgeom.Point2{x, y},\n\t\tButton: button,\n\t\tEvent: event,\n\t}\n}", "func NewCustomEvent(eventType model.EventType, marshaler easyjson.Marshaler, tags ...string) *CustomEvent {\n\treturn NewCustomEventLazy(eventType, func() easyjson.Marshaler {\n\t\treturn marshaler\n\t}, tags...)\n}", "func (c *Client) TimestampCreate(ctx context.Context, hash string, options *CreateOptions) (*TimestampResponse, error) {\n\n\ttype createRequest struct {\n\t\tComment string `json:\"comment,omitempty\"`\n\t\tHash string `json:\"hash\"`\n\t\tNotifications []Notification `json:\"notifications,omitempty\"`\n\t\tURL string `json:\"url,omitempty\"`\n\t}\n\n\tcReq := &createRequest{\n\t\tHash: hash,\n\t}\n\n\tif options != nil {\n\t\tcReq.Comment = options.Comment\n\t\tcReq.URL = options.URL\n\t\tcReq.Notifications = options.Notifications\n\t}\n\n\tpayload, err := json.Marshal(cReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoint := path.Join(\"timestamp\", \"create\")\n\twrapper, err := c.Request(ctx, http.MethodPost, endpoint, bytes.NewReader(payload))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &TimestampResponse{}\n\terr = json.Unmarshal(wrapper.Data, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "func (c *EcomClient) CreateWebhook(ctx context.Context, p *CreateWebhookRequest) (*WebhookResponse, error) {\n\trequest, err := json.Marshal(&p)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: client: json marshal\", err)\n\t}\n\n\turl := c.endpoint + \"/webhooks\"\n\tbody := strings.NewReader(string(request))\n\tres, err := c.request(http.MethodPost, url, body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: request\", err)\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode >= 400 {\n\t\tvar e badRequestResponse\n\t\tdec := json.NewDecoder(res.Body)\n\t\tdec.DisallowUnknownFields()\n\t\tif err := dec.Decode(&e); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%w: client decode\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"status: %d, code: %s, message: %s\", e.Status, e.Code, e.Message)\n\t}\n\n\tvar webhook WebhookResponse\n\tif err = json.NewDecoder(res.Body).Decode(&webhook); err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: decode\", err)\n\t}\n\treturn &webhook, nil\n}", "func (t *TargetToExtent) Create(server *Server) (*http.Response, error) {\n\tendpoint := \"/api/v1.0/services/iscsi/targettoextent/\"\n\tvar targetToExtent TargetToExtent\n\tvar e interface{}\n\tresp, err := server.getSlingConnection().Post(endpoint).BodyJSON(t).Receive(&targetToExtent, &e)\n\tif err != nil {\n\t\tglog.Warningln(err)\n\t\treturn resp, err\n\t}\n\n\tif resp.StatusCode != 201 {\n\t\tbody, _ := json.Marshal(e)\n\t\treturn resp, fmt.Errorf(\"Error creating TargetToExtent for %+v - message: %s, status: %d\", *t, string(body), resp.StatusCode)\n\t}\n\n\tt.CopyFrom(&targetToExtent)\n\n\treturn resp, nil\n}", "func CreateLambdaCloudwatchAlarm(region string, functionName string, metricName string, namespace string, threshold float64, action string) bool {\n\tawsSession, _ := InitAwsSession(region)\n\tsvc := cloudwatch.New(awsSession)\n\tinput := &cloudwatch.PutMetricAlarmInput{\n\t\tAlarmName: aws.String(fmt.Sprintf(\"%v on %v\", metricName, functionName)),\n\t\tComparisonOperator: aws.String(cloudwatch.ComparisonOperatorGreaterThanOrEqualToThreshold),\n\t\tEvaluationPeriods: aws.Int64(1),\n\t\tMetricName: aws.String(metricName),\n\t\tNamespace: aws.String(namespace),\n\t\tPeriod: aws.Int64(60),\n\t\tStatistic: aws.String(cloudwatch.StatisticSum),\n\t\tThreshold: aws.Float64(threshold),\n\t\tActionsEnabled: aws.Bool(true),\n\t\tAlarmDescription: aws.String(fmt.Sprintf(\"%v on %v greater than %v\", metricName, functionName, threshold)),\n\n\t\tDimensions: []*cloudwatch.Dimension{\n\t\t\t{\n\t\t\t\tName: aws.String(\"FunctionName\"),\n\t\t\t\tValue: aws.String(functionName),\n\t\t\t},\n\t\t},\n\n\t\tAlarmActions: []*string{\n\t\t\taws.String(action),\n\t\t},\n\t}\n\n\t// Debug input\n\t// fmt.Println(input)\n\n\t_, err := svc.PutMetricAlarm(input)\n\tif err != nil {\n\t\tfmt.Println(\"Error\", err)\n\t\treturn false\n\t}\n\n\treturn true\n}", "func NewEvent(x, y float64, button Button, event string) Event {\n\treturn Event{\n\t\tPoint2: floatgeom.Point2{x, y},\n\t\tButton: button,\n\t\tEvent: event,\n\t}\n}", "func (a *Client) CreateAnomalyDetectionMetricEvent(params *CreateAnomalyDetectionMetricEventParams, authInfo runtime.ClientAuthInfoWriter) (*CreateAnomalyDetectionMetricEventCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateAnomalyDetectionMetricEventParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createAnomalyDetectionMetricEvent\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/anomalyDetection/metricEvents\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateAnomalyDetectionMetricEventReader{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.(*CreateAnomalyDetectionMetricEventCreated)\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 createAnomalyDetectionMetricEvent: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func NewWebhook(url string, filterFnString string, timeout uint64) (*Webhook, error) {\n\n\tvar err error\n\n\tif url == \"\" {\n\t\terr = errors.New(\"url parameter must be defined for webhook events.\")\n\t\treturn nil, err\n\t}\n\n\twh := &Webhook{\n\t\turl: url,\n\t}\n\tif filterFnString != \"\" {\n\t\twh.filter = NewJSEventFunction(filterFnString)\n\t}\n\n\tif timeout != 0 {\n\t\twh.timeout = time.Duration(timeout) * time.Second\n\t} else {\n\t\twh.timeout = time.Duration(kDefaultWebhookTimeout) * time.Second\n\t}\n\n\treturn wh, err\n}", "func (pr *PrMock) CreatePullRequestEvent(action string) *gogh.PullRequestEvent {\n\treturn &gogh.PullRequestEvent{\n\t\tAction: utils.String(action),\n\t\tNumber: pr.PullRequest.Number,\n\t\tPullRequest: pr.PullRequest,\n\t\tRepo: pr.PullRequest.Base.Repo,\n\t\tSender: pr.PullRequest.User,\n\t}\n}", "func (b *bridge) createEvent(action string) *Event {\n\tevent := createEvent(action)\n\tevent.Source = b.source\n\tevent.Actor = b.actor\n\tevent.Request = b.request\n\n\treturn event\n}", "func (c *SmartThingsClient) DeviceCreateEvent(deviceID string, command ...DeviceEvent) error {\n\ts := make([]DeviceEvent, 0)\n\tfor _, c := range command {\n\t\ts = append(s, c)\n\t}\n\tb := &DeviceEventList{\n\t\tDeviceEvents: s,\n\t}\n\treq, err := c.newRequest(http.MethodPost, fmt.Sprintf(\"/v1/devices/%s/events\", deviceID), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.do(req, nil)\n\treturn err\n}", "func (a *mongoDbAdapter) makeCloudEvent(data bson.M) (*cloudevents.Event, error) {\n\t// Create Event.\n\tevent := cloudevents.NewEvent(cloudevents.VersionV1)\n\n\t// Set cloud event specs and attributes. TODO: issue #43\n\t// \t\tID -> id of mongo change object\n\t// \t\tSource -> database/collection.\n\t// \t\tType -> type of change either insert, delete or update.\n\t//\t\tData -> data payload containing either id only for\n\t// deletion or full object for other changes.\n\tevent.SetID(data[\"_id\"].(bson.M)[\"_data\"].(string))\n\tevent.SetSource(a.ceSource)\n\t// event.SetSource(data[\"ns\"].(bson.M)[\"db\"].(string) + \"/\" + data[\"ns\"].(bson.M)[\"coll\"].(string))\n\tevent.SetType(data[\"operationType\"].(string))\n\n\t// Add payload if replace or insert, else add document key.\n\tif data[\"operationType\"].(string) == \"delete\" {\n\t\tevent.SetData(cloudevents.ApplicationJSON, data[\"documentKey\"].(bson.M))\n\t} else {\n\t\tevent.SetData(cloudevents.ApplicationJSON, data[\"fullDocument\"].(bson.M))\n\t}\n\treturn &event, nil\n}", "func CreateEventRecorder(kubeClient kubernetes.Interface) kube_record.EventRecorder {\n\teventBroadcaster := kube_record.NewBroadcaster()\n\teventBroadcaster.StartLogging(glog.Infof)\n\n\tif _, isfake := kubeClient.(*fake.Clientset); !isfake {\n\t\teventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: v1core.New(kubeClient.Core().RESTClient()).Events(\"\")})\n\t}\n\treturn eventBroadcaster.NewRecorder(api.Scheme, clientv1.EventSource{Component: \"hostport-manager\"})\n}", "func NewCustomEvent(userID, sessionID, context string) CustomEvent {\n\treturn CustomEvent{\n\t\tUserID: userID,\n\t\tSessionID: sessionID,\n\t\tContext: context,\n\t}\n}", "func (w Webhook) Create(ctx context.Context, webhook *postmand.Webhook) error {\n\tquery, args := insertQuery(\"webhooks\", webhook)\n\t_, err := w.db.ExecContext(ctx, query, args...)\n\treturn err\n}", "func NewCustomEvent(tp EventType, structure *Structure) *Event {\n\te := C.gst_event_new_custom(C.GstEventType(tp), structure.g())\n\tif e == nil {\n\t\treturn nil\n\t}\n\tr := new(Event)\n\tr.SetPtr(glib.Pointer(e))\n\treturn r\n}", "func (c *FakeCloudwatchEventTargets) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(cloudwatcheventtargetsResource, c.ns, opts))\n\n}", "func (service EventService) CreateEvent(Event models.EventModel) ([]byte, error) {\n\texisting := service.repository.CheckEventExists(Event)\n\tif existing.ID == 0 {\n\t\tnewEvent := service.repository.CreateEvent(Event)\n\t\treturn json.Marshal(newEvent)\n\t}\n\treturn []byte(\"\"), exceptions.EventExistsException()\n}", "func NewTektonCloudEventData(taskRun *v1alpha1.TaskRun) TektonCloudEventData {\n\treturn TektonCloudEventData{\n\t\tTaskRun: taskRun,\n\t}\n}", "func (r *PropertiesConversionEventsService) Create(parent string, googleanalyticsadminv1alphaconversionevent *GoogleAnalyticsAdminV1alphaConversionEvent) *PropertiesConversionEventsCreateCall {\n\tc := &PropertiesConversionEventsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.googleanalyticsadminv1alphaconversionevent = googleanalyticsadminv1alphaconversionevent\n\treturn c\n}", "func (c *gitlabClient) CreateEvents(context.Context, string, []interface{}) ([]sdk.VCSCreateEvent, error) {\n\treturn nil, fmt.Errorf(\"Not implemented on Gitlab\")\n}", "func New(name string, data M) *BasicEvent {\n\treturn NewBasic(name, data)\n}", "func (o *CloudTargetCreateParams) WithHTTPClient(client *http.Client) *CloudTargetCreateParams {\n\to.SetHTTPClient(client)\n\treturn o\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 Create(c *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToServerCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\t_, r.Err = c.Post(createURL(c), b, &r.Body, &eclcloud.RequestOpts{\n\t\tOkCodes: []int{200},\n\t})\n\treturn\n}", "func createRecorder(kubecli *kubernetes.Clientset) record.EventRecorder {\n\t// Create a new broadcaster which will send events we generate to the apiserver\n\teventBroadcaster := record.NewBroadcaster()\n\teventBroadcaster.StartLogging(glog.Infof)\n\teventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{\n\t\tInterface: v1core.New(kubecli.CoreV1().RESTClient()).Events(apiv1.NamespaceAll),\n\t})\n\t// this EventRecorder can be used to send events to this EventBroadcaster\n\t// with the given event source.\n\treturn eventBroadcaster.NewRecorder(scheme.Scheme, apiv1.EventSource{Component: \"kubeturbo\"})\n}", "func NewEvent(args interface{}) Event {\n\tea := reflect.Indirect(reflect.ValueOf(args))\n\treturn Event{\n\t\tName: ea.Type().Name(),\n\t\tAt: time.Now().UTC(),\n\t\tArgs: ea.Interface(),\n\t}\n}", "func NewCloudEventResource(r *PipelineResource) (*CloudEventResource, error) {\n\tif r.Spec.Type != PipelineResourceTypeCloudEvent {\n\t\treturn nil, fmt.Errorf(\"CloudEventResource: Cannot create a Cloud Event resource from a %s Pipeline Resource\", r.Spec.Type)\n\t}\n\tvar targetURI string\n\tvar targetURISpecified bool\n\n\tfor _, param := range r.Spec.Params {\n\t\tif strings.EqualFold(param.Name, \"TargetURI\") {\n\t\t\ttargetURI = param.Value\n\t\t\tif param.Value != \"\" {\n\t\t\t\ttargetURISpecified = true\n\t\t\t}\n\t\t}\n\t}\n\n\tif !targetURISpecified {\n\t\treturn nil, fmt.Errorf(\"CloudEventResource: Need URI to be specified in order to create a CloudEvent resource %s\", r.Name)\n\t}\n\treturn &CloudEventResource{\n\t\tName: r.Name,\n\t\tType: r.Spec.Type,\n\t\tTargetURI: targetURI,\n\t}, nil\n}", "func (c *ApiService) CreateWebhook(ServiceSid string, params *CreateWebhookParams) (*VerifyV2Webhook, error) {\n\tpath := \"/v2/Services/{ServiceSid}/Webhooks\"\n\tpath = strings.Replace(path, \"{\"+\"ServiceSid\"+\"}\", ServiceSid, -1)\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tif params != nil && params.FriendlyName != nil {\n\t\tdata.Set(\"FriendlyName\", *params.FriendlyName)\n\t}\n\tif params != nil && params.EventTypes != nil {\n\t\tfor _, item := range *params.EventTypes {\n\t\t\tdata.Add(\"EventTypes\", item)\n\t\t}\n\t}\n\tif params != nil && params.WebhookUrl != nil {\n\t\tdata.Set(\"WebhookUrl\", *params.WebhookUrl)\n\t}\n\tif params != nil && params.Status != nil {\n\t\tdata.Set(\"Status\", *params.Status)\n\t}\n\tif params != nil && params.Version != nil {\n\t\tdata.Set(\"Version\", *params.Version)\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 := &VerifyV2Webhook{}\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 (f *Person) createEvent(name string, year int) models.Event {\n\tvar city external.City\n\tif len(f.events) == 0 {\n\t\tcity = external.RandomCity()\n\t} else {\n\t\trecentEvent := f.events[len(f.events)-1]\n\t\tcity = external.RandomCloseCity(recentEvent.Latitude, recentEvent.Longitude)\n\t}\n\tevent := models.Event{\n\t\tEventID: util.RandomID(),\n\t\tPersonID: f.model.PersonID,\n\t\tLatitude: city.Latitude,\n\t\tLongitude: city.Longitude,\n\t\tCountry: city.Country,\n\t\tCity: city.City,\n\t\tEventType: name,\n\t\tYear: year,\n\t}\n\tf.events = append(f.events, event)\n\treturn event\n}", "func createRecorder(kubecli *kubernetes.Clientset) record.EventRecorder {\n\t// Create a new broadcaster which will send events we generate to the apiserver\n\teventBroadcaster := record.NewBroadcaster()\n\teventBroadcaster.StartLogging(glog.Infof)\n\teventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{\n\t\tInterface: v1core.New(kubecli.Core().RESTClient()).Events(apiv1.NamespaceAll)})\n\t// this EventRecorder can be used to send events to this EventBroadcaster\n\t// with the given event source.\n\treturn eventBroadcaster.NewRecorder(scheme.Scheme, apiv1.EventSource{Component: \"kubeturbo\"})\n}", "func (s *WebhookServiceOp) Create(ctx context.Context, webhook Webhook) (*Webhook, error) {\n\tpath := fmt.Sprintf(\"%s.json\", webhooksBasePath)\n\twrappedData := WebhookResource{Webhook: &webhook}\n\tresource := new(WebhookResource)\n\terr := s.client.Post(ctx, path, wrappedData, resource)\n\treturn resource.Webhook, err\n}", "func (r *ProjectsLogServicesSinksService) Create(projectsId string, logServicesId string, logsink *LogSink) *ProjectsLogServicesSinksCreateCall {\n\treturn &ProjectsLogServicesSinksCreateCall{\n\t\ts: r.s,\n\t\tprojectsId: projectsId,\n\t\tlogServicesId: logServicesId,\n\t\tlogsink: logsink,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks\",\n\t}\n}", "func (c *V2) Create(endpoint string, model models.Model) (*http.Response, *gabs.Container, error) {\n\tjsonPayload, err := c.PrepareModel(model)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlog.Println(\"[DEBUG] CREATE Payload: \", jsonPayload.String())\n\n\treq, err := c.PrepareRequest(http.MethodPost, endpoint, jsonPayload, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresponse, err := c.Do(req)\n\tif err != nil {\n\t\treturn response, nil, err\n\t}\n\n\tcontainer, err := GetContainer(response)\n\tif err != nil {\n\t\treturn response, nil, err\n\t}\n\treturn response, container, nil\n}", "func (c *DefaultApiService) CreateSinkValidate(Sid string, params *CreateSinkValidateParams) (*EventsV1SinkSinkValidate, error) {\n\tpath := \"/v1/Sinks/{Sid}/Validate\"\n\tpath = strings.Replace(path, \"{\"+\"Sid\"+\"}\", Sid, -1)\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tif params != nil && params.TestId != nil {\n\t\tdata.Set(\"TestId\", *params.TestId)\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 := &EventsV1SinkSinkValidate{}\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 hNewEvent(c echo.Context) error {\n\tvar e httpError\n\n\tif (len(c.FormValue(\"code\")) == 0) || (len(c.FormValue(\"title\")) == 0) {\n\t\treturn c.JSON(http.StatusNotAcceptable, \"input information is not valid\")\n\t}\n\tuserCODE := c.FormValue(\"code\")\n\n\t// read from token user id\n\tvar tokenUserID int64\n\ttokenUserID = 1\n\n\tu, errGet := blog.GetUserByCode(tokenUserID, userCODE)\n\tif errGet != nil {\n\t\te.TheError = \"user code \" + userCODE + \" not found.\"\n\t\treturn c.JSON(http.StatusNotFound, e)\n\t}\n\tvar ev Event\n\tev.OpenedByUserID = u.ID\n\tev.Contents = c.FormValue(\"content\")\n\tev.Title = c.FormValue(\"title\")\n\n\terrAdd := blog.AddEvent(&ev)\n\tif errAdd != nil {\n\t\te.TheError = errAdd.Error()\n\t\treturn c.JSON(http.StatusInternalServerError, e)\n\t}\n\tfname, errUpload := lowlevelUploadFile(c, u.ID, ev.ID)\n\tif errUpload != nil {\n\t\te.TheError = \"could not upload file: \" + errUpload.Error()\n\t\treturn c.JSON(http.StatusInternalServerError, e)\n\t}\n\te.TheError = \"OK\" + \" - \" + fname\n\treturn c.JSON(http.StatusOK, e)\n}", "func (x *fastReflection_EventCreateBatch) New() protoreflect.Message {\n\treturn new(fastReflection_EventCreateBatch)\n}" ]
[ "0.687223", "0.5633696", "0.5631251", "0.538129", "0.5321042", "0.529999", "0.5294296", "0.5265981", "0.5259876", "0.5250571", "0.52373767", "0.52258664", "0.52252287", "0.52154547", "0.5198454", "0.5183503", "0.5154956", "0.5070703", "0.50693345", "0.5064346", "0.5045063", "0.5028351", "0.50175047", "0.501624", "0.49743232", "0.49694666", "0.4968072", "0.49677986", "0.49392426", "0.48700213", "0.48367006", "0.48077118", "0.47747523", "0.4771383", "0.4767434", "0.4753219", "0.47443905", "0.47423786", "0.47312295", "0.47311044", "0.471264", "0.4699825", "0.46918404", "0.4678747", "0.4672303", "0.46663183", "0.46660897", "0.46656394", "0.46649957", "0.46617705", "0.4650362", "0.4633898", "0.46184286", "0.46116936", "0.46049657", "0.45986843", "0.45841494", "0.45840976", "0.4562924", "0.452426", "0.45241666", "0.45202488", "0.4513365", "0.44966713", "0.44960818", "0.44864455", "0.44771236", "0.44731748", "0.44709426", "0.4467563", "0.44583565", "0.44539988", "0.44533214", "0.44519097", "0.44517222", "0.44484675", "0.44336203", "0.44324479", "0.44161308", "0.4410667", "0.44099662", "0.4400633", "0.43890125", "0.4387581", "0.43837088", "0.4371499", "0.43670204", "0.43663692", "0.43553016", "0.43543574", "0.43443355", "0.43440518", "0.43435705", "0.43382955", "0.43343925", "0.43303156", "0.43218884", "0.43075365", "0.43029174", "0.43024352" ]
0.7889584
0
Update takes the representation of a cloudwatchEventTarget and updates it. Returns the server's representation of the cloudwatchEventTarget, and an error, if there is any.
func (c *FakeCloudwatchEventTargets) Update(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{}) if obj == nil { return nil, err } return obj.(*v1alpha1.CloudwatchEventTarget), err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *FakeCloudwatchEventTargets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(cloudwatcheventtargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (c *Collection) UpdateEvent(\n\tkey, typ string, ts time.Time, ordinal int64, value interface{},\n) (*Event, error) {\n\theaders := map[string]string{\"Content-Type\": \"application/json\"}\n\treturn c.innerUpdateEvent(key, typ, ts, ordinal, value, headers)\n}", "func (e *Event) Update(c echo.Context, req *Update) (*takrib.Event, error) {\n\t// if err := e.rbac.EnforceEvent(c, req.ID); err != nil {\n\t// \treturn nil, err\n\t// }\n\n\tevent, err := e.udb.View(e.db, req.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstructs.Merge(event, req)\n\tif err := e.udb.Update(e.db, event); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn event, nil\n}", "func (e *EventAPI) Update(eventType *EventType) error {\n\tconst errMsg = \"unable to update event type\"\n\n\tresponse, err := e.client.httpPUT(e.backOffConf.create(), e.eventURL(eventType.Name), eventType, errMsg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\tbuffer, err := io.ReadAll(response.Body)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"%s: unable to read response body\", errMsg)\n\t\t}\n\t\treturn decodeResponseToError(buffer, \"unable to update event type\")\n\t}\n\n\treturn nil\n}", "func UpdateEvent(c *gin.Context) {\n\tvar inp model.Event\n\n\tc.BindJSON(&inp)\n\tc.JSON(http.StatusOK, serviceEvent.UpdateEvent(&inp))\n}", "func (e *PrecisionTiming) Update(e2 Event) error {\n\tif e.Type() != e2.Type() {\n\t\treturn fmt.Errorf(\"statsd event type conflict: %s vs %s \", e.String(), e2.String())\n\t}\n\tp := e2.Payload().(PrecisionTiming)\n\te.Count += p.Count\n\te.Value += p.Value\n\te.Min = time.Duration(minInt64(int64(e.Min), int64(p.Min)))\n\te.Max = time.Duration(maxInt64(int64(e.Max), int64(p.Min)))\n\treturn nil\n}", "func (r *DeviceManagementAutopilotEventRequest) Update(ctx context.Context, reqObj *DeviceManagementAutopilotEvent) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (c *FakeCloudwatchEventTargets) Get(name string, options v1.GetOptions) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (r *DeviceManagementTroubleshootingEventRequest) Update(ctx context.Context, reqObj *DeviceManagementTroubleshootingEvent) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (r *EventTagsService) Update(profileId int64, eventtag *EventTag) *EventTagsUpdateCall {\n\tc := &EventTagsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.eventtag = eventtag\n\treturn c\n}", "func (s *TargetCRUD) Update(arg ...crud.Arg) (crud.Arg, error) {\n\tevent := eventFromArg(arg[0])\n\ttarget := targetFromStuct(event)\n\toldTarget, ok := event.OldObj.(*state.Target)\n\tif !ok {\n\t\tpanic(\"unexpected type, expected *state.Target\")\n\t}\n\tprint.DeletePrintln(\"deleting target\", *oldTarget.Target.Target,\n\t\t\"from upstream\", *oldTarget.Upstream.ID)\n\tprint.CreatePrintln(\"creating target\", *target.Target.Target,\n\t\t\"on upstream\", *target.Upstream.ID)\n\treturn target, nil\n}", "func (es *EntityEventService) Update(campID int, entID int, evtID int, evt SimpleEntityEvent) (*EntityEvent, error) {\n\tvar err error\n\tend := EndpointCampaign\n\n\tif end, err = end.id(campID); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid Campaign ID: %w\", err)\n\t}\n\tend = end.concat(endpointEntity)\n\n\tif end, err = end.id(entID); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid Entity ID: %w\", err)\n\t}\n\tend = end.concat(es.end)\n\n\tif end, err = end.id(evtID); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid EntityEvent ID: %w\", err)\n\t}\n\n\tb, err := json.Marshal(evt)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot marshal SimpleEntityEvent: %w\", err)\n\t}\n\n\tvar wrap struct {\n\t\tData *EntityEvent `json:\"data\"`\n\t}\n\n\tif err = es.client.put(end, bytes.NewReader(b), &wrap); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot update EntityEvent for Campaign (ID: %d): '%w'\", campID, err)\n\t}\n\n\treturn wrap.Data, nil\n}", "func (c *Collection) innerUpdateEvent(\n\tkey, typ string, ts time.Time, ordinal int64, value interface{},\n\theaders map[string]string,\n) (*Event, error) {\n\tevent := &Event{\n\t\tCollection: c,\n\t\tKey: key,\n\t\tOrdinal: ordinal,\n\t\tTimestamp: ts,\n\t\tType: typ,\n\t}\n\n\t// Encode the JSON message into a raw value that we can return to the\n\t// client if necessary.\n\tif rawMsg, err := json.Marshal(value); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tevent.Value = json.RawMessage(rawMsg)\n\t}\n\n\t// Perform the actual PUT\n\tpath := fmt.Sprintf(\"%s/%s/events/%s/%d/%d\", c.Name, key, typ,\n\t\tts.UnixNano()/1000000, ordinal)\n\tresp, err := c.client.emptyReply(\"PUT\", path, headers,\n\t\tbytes.NewBuffer(event.Value), 204)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get the Location header and parse it. The Header will give us the\n\t// Ordinal.\n\tlocation := resp.Header.Get(\"Location\")\n\tif location == \"\" {\n\t\treturn nil, fmt.Errorf(\"Missing Location header.\")\n\t} else if parts := strings.Split(location, \"/\"); len(parts) != 8 {\n\t\treturn nil, fmt.Errorf(\"Malformed Location header.\")\n\t} else if ts, err := strconv.ParseInt(parts[6], 10, 64); err != nil {\n\t\treturn nil, fmt.Errorf(\"Malformed Timestamp in the Location header.\")\n\t} else if ord, err := strconv.ParseInt(parts[7], 10, 64); err != nil {\n\t\treturn nil, fmt.Errorf(\"Malformed Ordinal in the Location header.\")\n\t} else {\n\t\tsecs := ts / 1000\n\t\tnsecs := (ts % 1000) * 1000000\n\t\tevent.Timestamp = time.Unix(secs, nsecs)\n\t\tevent.Ordinal = ord\n\t}\n\n\t// Get the Ref via the Etag header.\n\tif etag := resp.Header.Get(\"Etag\"); etag == \"\" {\n\t\treturn nil, fmt.Errorf(\"Missing ETag header.\")\n\t} else if parts := strings.Split(etag, `\"`); len(parts) != 3 {\n\t\treturn nil, fmt.Errorf(\"Malformed ETag header.\")\n\t} else {\n\t\tevent.Ref = parts[1]\n\t}\n\n\t// Success\n\treturn event, nil\n}", "func (s *S3Sink) UpdateEvents(eNew *v1.Event, eOld *v1.Event) {\n\ts.eventCh.In() <- NewEventData(eNew, eOld)\n}", "func GetEventTarget(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EventTargetState, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tvar resource EventTarget\n\terr := ctx.ReadResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c *FakeCloudwatchEventTargets) UpdateStatus(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (*v1alpha1.CloudwatchEventTarget, error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateSubresourceAction(cloudwatcheventtargetsResource, \"status\", c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (e *Timing) Update(e2 Event) error {\n\tif e.Type() != e2.Type() {\n\t\treturn fmt.Errorf(\"statsd event type conflict: %s vs %s \", e.String(), e2.String())\n\t}\n\tp := e2.Payload().(map[string]float64)\n\te.Value += p[\"val\"]\n\te.Values = append(e.Values, p[\"val\"])\n\tif e.Count == 0 { // Count will only be 0 after Reset()\n\t\te.Min = p[\"min\"]\n\t\te.Max = p[\"max\"]\n\t} else {\n\t\te.Min = minFloat64(e.Min, p[\"min\"])\n\t\te.Max = maxFloat64(e.Max, p[\"max\"])\n\t}\n\te.Count += p[\"cnt\"]\n\te.Tags = []string{}\n\treturn nil\n}", "func (c *FakeCloudwatchEventTargets) Create(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (o *UpdateEventParams) WithHTTPClient(client *http.Client) *UpdateEventParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (c *k8sClient) OnUpdate(oldObj, newObj interface{}) {\n\tif !isResourceChanged(oldObj, newObj) {\n\t\treturn\n\t}\n\n\tselect {\n\tcase c.eventCh <- newObj:\n\tdefault:\n\t}\n}", "func (es *EventService) Update(eventID string, e *Event) error {\n\t// PUT: /event/:eventID\n\tif e == nil {\n\t\treturn fmt.Errorf(\"nil Event\")\n\t}\n\treq, err := es.c.NewRequest(\"PUT\", \"/event/\"+eventID, e)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: return any response?\n\treturn es.c.Do(req, nil)\n}", "func (svc *Service) Update(ownerID string, event *calendar.Event) (*calendar.Event, error) {\n\tmsEvent := convertToOutlookEvent(event)\n\t_, err := svc.client.Patch(fmt.Sprintf(\"%s/%s\", eventsURL(ownerID), event.Id), msEvent)\n\tif err != nil {\n\t\treturn &calendar.Event{}, errors.Wrap(err, \"Unable to perform Update\")\n\t}\n\treturn event, nil\n}", "func NewEventTarget(ctx *pulumi.Context,\n\tname string, args *EventTargetArgs, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tif args == nil || args.Arn == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Arn'\")\n\t}\n\tif args == nil || args.Rule == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Rule'\")\n\t}\n\tif args == nil {\n\t\targs = &EventTargetArgs{}\n\t}\n\tvar resource EventTarget\n\terr := ctx.RegisterResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func UpdateEvent(event *entity.Event) (*entity.Event, error){\n\touput,err:= json.MarshalIndent(event,\"\",\"\\t\\t\")\n\t\n\tclient := &http.Client{}\n\tURL := fmt.Sprintf(\"%s%s/%d\",baseEventURL,\"update\",event.ID)\n\treq,_ := http.NewRequest(\"PUT\",URL,bytes.NewBuffer(ouput))\n\n\t//DO return an http response\n\tres,err := client.Do(req)\n\t\n\tif err != nil {\n\t\treturn nil,err\n\t}\n\teventt := &entity.Event{}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(body,eventt)\n\tif err != nil{\n\t\treturn nil,err\n\t}\n\treturn eventt,nil\n}", "func (c *FakeCloudwatchEventTargets) List(opts v1.ListOptions) (result *v1alpha1.CloudwatchEventTargetList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(cloudwatcheventtargetsResource, cloudwatcheventtargetsKind, c.ns, opts), &v1alpha1.CloudwatchEventTargetList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.CloudwatchEventTargetList{ListMeta: obj.(*v1alpha1.CloudwatchEventTargetList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.CloudwatchEventTargetList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (c *FakeCloudwatchEventTargets) Delete(name string, options *v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{})\n\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\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 (s *baseStore[T, E, TPtr, EPtr]) Update(ctx context.Context, object T) error {\n\teventPtr := s.newObjectEvent(ctx, UpdateEvent)\n\teventPtr.SetObject(object)\n\treturn s.createObjectEvent(ctx, eventPtr)\n}", "func (t *FakeObjectTracker) Update(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error {\n\tvar err error\n\tif t.fakingOptions.failAll != nil {\n\t\terr = t.fakingOptions.failAll.RunFakeInvocations()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif t.fakingOptions.failAt != nil {\n\t\tif gvr.Resource == \"nodes\" {\n\t\t\terr = t.fakingOptions.failAt.Node.Update.RunFakeInvocations()\n\t\t} else if gvr.Resource == \"machines\" {\n\t\t\terr = t.fakingOptions.failAt.Machine.Update.RunFakeInvocations()\n\t\t} else if gvr.Resource == \"machinedeployments\" {\n\t\t\terr = t.fakingOptions.failAt.MachineDeployment.Update.RunFakeInvocations()\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\terr = t.delegatee.Update(gvr, obj, ns)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif t.FakeWatcher == nil {\n\t\treturn errors.New(\"error sending event on a tracker with no watch support\")\n\t}\n\n\tif t.IsStopped() {\n\t\treturn errors.New(\"error sending event on a stopped tracker\")\n\t}\n\n\tt.FakeWatcher.Modify(obj)\n\treturn nil\n}", "func UpdateEvent(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\tif key, ok := vars[\"eventId\"]; ok {\n\t\tvar event Event\n\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\terr := decoder.Decode(&event)\n\n\t\t// Get EID from request URL\n\t\tif string(event.EID) != key {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tfmt.Fprintf(w, `{\"error\": \"Bad Request\"}`)\n\t\t\treturn\n\t\t}\n\n\t\tif err != nil {\n\t\t\tLogError(w, err)\n\t\t\treturn\n\t\t}\n\n\t\t// Validate input\n\t\tif err := event.Validate(); err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tfmt.Fprintf(w, `{\"error\": \"Bad Request\"}`)\n\t\t\treturn\n\t\t}\n\n\t\tif err := event.Save(); err != nil {\n\t\t\tLogError(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusAccepted)\n\t\tfmt.Fprintf(w, `{\"eid\": %d}`, event.EID)\n\t} else {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tfmt.Fprintf(w, `{\"error\": \"Not Found\"}`)\n\t}\n}", "func (c *FakeCloudwatchEventTargets) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(cloudwatcheventtargetsResource, c.ns, opts))\n\n}", "func (c *EventClient) Update() *EventUpdate {\n\tmutation := newEventMutation(c.config, OpUpdate)\n\treturn &EventUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (i *IpScheduler) OnUpdate(old, new interface{}) {}", "func (endpointgroup *EndpointGroup) Update() error {\n\t// Get a representation of the object's original state so we can find what\n\t// to update.\n\toriginal := new(EndpointGroup)\n\terr := original.UnmarshalJSON(endpointgroup.rawData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treadWriteFields := []string{\n\t\t\"AccessState\",\n\t\t\"Endpoints\",\n\t\t\"GroupType\",\n\t\t\"Preferred\",\n\t\t\"TargetEndpointGroupIdentifier\",\n\t}\n\n\toriginalElement := reflect.ValueOf(original).Elem()\n\tcurrentElement := reflect.ValueOf(endpointgroup).Elem()\n\n\treturn endpointgroup.Entity.Update(originalElement, currentElement, readWriteFields)\n}", "func (e *EventHandler) OnUpdate(oldObj, newObj interface{}) {\n\tu := event.UpdateEvent{}\n\n\tif o, ok := oldObj.(client.Object); ok {\n\t\tu.ObjectOld = o\n\t} else {\n\t\tlog.Error(nil, \"OnUpdate missing ObjectOld\",\n\t\t\t\"object\", oldObj, \"type\", fmt.Sprintf(\"%T\", oldObj))\n\t\treturn\n\t}\n\n\t// Pull Object out of the object\n\tif o, ok := newObj.(client.Object); ok {\n\t\tu.ObjectNew = o\n\t} else {\n\t\tlog.Error(nil, \"OnUpdate missing ObjectNew\",\n\t\t\t\"object\", newObj, \"type\", fmt.Sprintf(\"%T\", newObj))\n\t\treturn\n\t}\n\n\tfor _, p := range e.predicates {\n\t\tif !p.Update(u) {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Invoke update handler\n\tctx, cancel := context.WithCancel(e.ctx)\n\tdefer cancel()\n\te.handler.Update(ctx, u, e.queue)\n}", "func (c *runtimeTypedObjectClient) Update(\n\tctx context.Context, obj APIObject) error {\n\treturn c.rtc.Update(ctx, obj)\n}", "func (r *UserExperienceAnalyticsMetricRequest) Update(ctx context.Context, reqObj *UserExperienceAnalyticsMetric) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (f UpdateHandlerFunc) Handle(ctx context.Context, u tg.UpdatesClass) error {\n\treturn f(ctx, u)\n}", "func (els *EventLocalStore) Update(e *entities.Event) error {\n\tels.mutex.Lock()\n\tdefer els.mutex.Unlock()\n\n\tif _, ok := els.events[e.ID]; ok {\n\t\tels.events[e.ID].Author = e.Author\n\t\tels.events[e.ID].Title = e.Title\n\t\tels.events[e.ID].Description = e.Description\n\t\tels.events[e.ID].Start = e.Start\n\t\tels.events[e.ID].End = e.End\n\n\t\treturn nil\n\t}\n\n\treturn event.ErrEventNotFound\n}", "func (c *peer) Update(obj *api.Peer) error {\n\tobj.UpdatedAt = time.Now().UTC().Format(time.RFC3339)\n\tjsonData, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.store.Set(path.Join(c.prefix, obj.UID), jsonData)\n}", "func UpdateEvent(q Query, c chan error) {\n\tresult, err := Session.Run(`\n\t\tMATCH(n:EVENT)\n\t\tWHERE n.`+q.Key+`=$val\n\t\tSET n.`+q.ChangeKey+`=$val1\n\t\tRETURN n.`+q.ChangeKey+`\n\t`, map[string]interface{}{\n\t\t\"val\": q.Value,\n\t\t\"val1\": q.ChangeValue,\n\t})\n\n\tif err != nil {\n\t\tc <- err\n\t\treturn\n\t}\n\tc <- nil\n\n\tresult.Next()\n\tlog.Printf(\"Updated %s to %s\", q.Key, result.Record().GetByIndex(0).(string))\n\n\tif err = result.Err(); err != nil {\n\t\tc <- err\n\t\treturn\n\t}\n}", "func (pgs *PGStorage) UpdateEvent(eventUUID uuid.UUID, e event.Event) (event.Event, error) {\n\tsql := `update events set \n\t\ttitle = :title, \n\t\tdatetime = :datetime, \n\t\tduration = :duration, \n\t\tdescription = :description, \n\t\tuserid = :userid, \n\t\tnotify = :notify\n\twhere uuid = :uuid`\n\t_, err := pgs.DB.NamedExecContext(pgs.Ctx, sql, map[string]interface{}{\n\t\t\"uuid\": eventUUID.String(),\n\t\t\"title\": e.Title,\n\t\t\"datetime\": e.Datetime,\n\t\t\"duration\": e.Duration,\n\t\t\"description\": e.Desc,\n\t\t\"userid\": e.User,\n\t\t\"notify\": e.Notify,\n\t})\n\tif err != nil {\n\t\treturn event.Event{}, err\n\t}\n\treturn e, nil\n}", "func (es *EventSyncer) handleUpdateEvent(old, new interface{}) {\n\tnewEvent := new.(*corev1.Event)\n\toldEvent := old.(*corev1.Event)\n\tif newEvent.ResourceVersion == oldEvent.ResourceVersion {\n\t\t// Periodic resync will send update events for all known Deployments.\n\t\t// Two different versions of the same Deployment will always have different RVs.\n\t\treturn\n\t}\n\n\tes.addKindAndVersion(newEvent)\n\n\tgo syncToNode(watch.Modified, util.ResourceEvent, newEvent)\n\n\tsyncToStorage(es.ctx, watch.Modified, util.ResourceEvent, newEvent)\n}", "func (c *Client) Update() goa.Endpoint {\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\tinv := goagrpc.NewInvoker(\n\t\t\tBuildUpdateFunc(c.grpccli, c.opts...),\n\t\t\tEncodeUpdateRequest,\n\t\t\tnil)\n\t\tres, err := inv.Invoke(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, goa.Fault(err.Error())\n\t\t}\n\t\treturn res, nil\n\t}\n}", "func (c *Client) Update(id string, event Event, target string, enabled string, conditions []Condition) error {\n\treq := CreateBody{Event: string(event), Target: target, Enabled: enabled, Conditions: conditions}\n\tbody, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treadbody := bytes.NewReader(body)\n\t_, err = c.put(c.url.String()+\"/\"+id, readbody)\n\treturn err\n}", "func (cs *CSRSyncer) handleUpdateEvent(old, new interface{}) {\n\tnewCSR := new.(*v1beta1.CertificateSigningRequest)\n\toldCSR := old.(*v1beta1.CertificateSigningRequest)\n\tif newCSR.ResourceVersion == oldCSR.ResourceVersion {\n\t\t// Periodic resync will send update events for all known Deployments.\n\t\t// Two different versions of the same Deployment will always have different RVs.\n\t\treturn\n\t}\n\n\tcs.addKindAndVersion(newCSR)\n\tklog.V(4).Infof(\"update csr: %s\", newCSR.Name)\n\n\tgo syncToNode(watch.Modified, util.ResourceCSR, newCSR)\n\n\tsyncToStorage(cs.ctx, watch.Modified, util.ResourceCSR, newCSR)\n}", "func Update(k8sClient client.Client, obj client.Object) error {\n\treturn k8sClient.Update(\n\t\tcontext.TODO(),\n\t\tobj,\n\t)\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}", "func (StatusUpdatePredicate) Update(e event.UpdateEvent) bool {\n\tlog := log.Logger(context.Background(), \"controllers.common\", \"Update\")\n\n\tif e.ObjectOld == nil {\n\t\tlog.Error(nil, \"Update event has no old runtime object to update\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.ObjectNew == nil {\n\t\tlog.Error(nil, \"Update event has no new runtime object for update\", \"event\", e)\n\t\treturn false\n\t}\n\n\t//Better way to do it is to get GVK from ObjectKind but Kind is dropped during decode.\n\t//For more details, check the status of the issue here\n\t//https://github.com/kubernetes/kubernetes/issues/80609\n\n\t// Try to type caste to WavefrontAlert first if it doesn't work move to namespace type casting\n\tif oldWFAlertObj, ok := e.ObjectOld.(*alertmanagerv1alpha1.WavefrontAlert); ok {\n\t\tnewWFAlertObj := e.ObjectNew.(*alertmanagerv1alpha1.WavefrontAlert)\n\t\tif !reflect.DeepEqual(oldWFAlertObj.Status, newWFAlertObj.Status) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif oldAlertsConfigObj, ok := e.ObjectOld.(*alertmanagerv1alpha1.AlertsConfig); ok {\n\t\tnewAlertsConfigObj := e.ObjectNew.(*alertmanagerv1alpha1.AlertsConfig)\n\t\tif !reflect.DeepEqual(oldAlertsConfigObj.Status, newAlertsConfigObj.Status) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (p *PersistableEvent) Update(objectstorage.StorableObject) {\n\tpanic(\"should not be updated\")\n}", "func (s *Dao) Update(ctx context.Context, kv *model.KVDoc) error {\n\tkeyKv := key.KV(kv.Domain, kv.Project, kv.ID)\n\tresp, err := etcdadpt.Get(ctx, keyKv)\n\tif err != nil {\n\t\topenlog.Error(err.Error())\n\t\treturn err\n\t}\n\tif resp == nil {\n\t\treturn datasource.ErrRecordNotExists\n\t}\n\n\tvar old model.KVDoc\n\terr = json.Unmarshal(resp.Value, &old)\n\tif err != nil {\n\t\topenlog.Error(err.Error())\n\t\treturn err\n\t}\n\told.LabelFormat = kv.LabelFormat\n\told.Value = kv.Value\n\told.Status = kv.Status\n\told.Checker = kv.Checker\n\told.UpdateTime = kv.UpdateTime\n\told.UpdateRevision = kv.UpdateRevision\n\n\tbytes, err := json.Marshal(old)\n\tif err != nil {\n\t\topenlog.Error(err.Error())\n\t\treturn err\n\t}\n\terr = etcdadpt.PutBytes(ctx, keyKv, bytes)\n\tif err != nil {\n\t\topenlog.Error(err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Service) Update(ctx context.Context, cusVisitAssoc types.CusVisitAssoc) error {\n\tif err := validation.ValidateStruct(&cusVisitAssoc,\n\t\tvalidation.Field(&cusVisitAssoc.ID, validation.Required),\n\t\tvalidation.Field(&cusVisitAssoc.VisitID, validation.Required),\n\t); err != nil {\n\t\treturn err\n\t} // not empty\n\treturn s.repo.Update(ctx, cusVisitAssoc)\n}", "func (ue *UserEvent) Update(ctx context.Context) *spanner.Mutation {\n\tvalues, _ := ue.columnsToValues(UserEventWritableColumns())\n\treturn spanner.Update(\"UserEvent\", UserEventWritableColumns(), values)\n}", "func (s *GenericWatchStorage) Update(obj runtime.Object) error {\n\ts.watcher.Suspend(watcher.FileEventModify)\n\treturn s.Storage.Update(obj)\n}", "func (c *endpointCache) Update(event Event) {\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\n\t// Happy path.\n\tif event.Err == nil {\n\t\tc.updateCache(event.Instances)\n\t\tc.err = nil\n\t\treturn\n\t}\n\n\t// Sad path. Something's gone wrong in sd.\n\tc.logger.Log(\"err\", event.Err)\n\tif !c.options.invalidateOnError {\n\t\treturn // keep returning the last known endpoints on error\n\t}\n\tif c.err != nil {\n\t\treturn // already in the error state, do nothing & keep original error\n\t}\n\tc.err = event.Err\n\t// set new deadline to invalidate Endpoints unless non-error Event is received\n\tc.invalidateDeadline = c.timeNow().Add(c.options.invalidateTimeout)\n\treturn\n}", "func (sn *ViewUpdateNotification) Handle(elem interface{}) {\n\tif elemEvent, ok := elem.(ViewUpdate); ok {\n\t\tif sn.validation != nil && sn.validation(elemEvent) {\n\t\t\tsn.do(func() {\n\t\t\t\tfor _, sub := range sn.subs {\n\t\t\t\t\tsub.Receive(elemEvent)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\treturn\n\t\t}\n\n\t\tsn.do(func() {\n\t\t\tfor _, sub := range sn.subs {\n\t\t\t\tsub.Receive(elemEvent)\n\t\t\t}\n\t\t})\n\t}\n}", "func (w *watcher) sendEvent(evType kvstore.WatchEventType, key string, value []byte, version int64) {\n\tf := w.f\n\n\tobj, err := f.codec.Decode(value, nil)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to decode %v with error %v\", string(value), err)\n\t\tw.sendError(err)\n\t\treturn\n\t}\n\n\terr = f.objVersioner.SetVersion(obj, uint64(version))\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to set version %v with error: %v\", version, err)\n\t\tw.sendError(err)\n\t\treturn\n\t}\n\n\te := &kvstore.WatchEvent{\n\t\tType: evType,\n\t\tObject: obj,\n\t\tKey: key,\n\t}\n\n\tif len(w.outCh) == outCount {\n\t\tlog.Warnf(\"Number of buffered watch events hit max count of %v\", outCount)\n\t}\n\n\tselect {\n\tcase w.outCh <- e:\n\tcase <-w.ctx.Done():\n\t}\n}", "func (uu UpdateUser) UpdatedEvent(userID uuid.UUID) event.Event {\n\tparams := EventParamsUpdated{\n\t\tUserID: userID,\n\t\tUpdateUser: UpdateUser{\n\t\t\tEnabled: uu.Enabled,\n\t\t},\n\t}\n\n\trawParams, err := params.Marshal()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn event.Event{\n\t\tSource: EventSource,\n\t\tType: EventUpdated,\n\t\tRawParams: rawParams,\n\t}\n}", "func SendCloudEvent(sinkURI, eventID, eventSourceURI string, data []byte, eventType TektonEventType, logger *zap.SugaredLogger, cloudEventClient CEClient) (cloudevents.Event, error) {\n\tvar event cloudevents.Event\n\n\tcloudEventSource := types.ParseURLRef(eventSourceURI)\n\tif cloudEventSource == nil {\n\t\tlogger.Errorf(\"Invalid eventSourceURI: %s\", eventSourceURI)\n\t\treturn event, fmt.Errorf(\"invalid eventSourceURI: %s\", eventSourceURI)\n\t}\n\n\tevent = cloudevents.Event{\n\t\tContext: cloudevents.EventContextV02{\n\t\t\tID: eventID,\n\t\t\tType: string(eventType),\n\t\t\tSource: *cloudEventSource,\n\t\t\tTime: &types.Timestamp{Time: time.Now()},\n\t\t\tExtensions: nil,\n\t\t}.AsV02(),\n\t\tData: data,\n\t}\n\tctxt := cecontext.WithTarget(context.TODO(), sinkURI)\n\t_, err := cloudEventClient.Send(ctxt, event)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error sending the cloud-event: %s\", err)\n\t\treturn event, err\n\t}\n\treturn event, nil\n}", "func (h *DaprHandler) ObjectUpdated(old interface{}, new interface{}) {\n}", "func (r *ProjectsLogServicesSinksService) Update(projectsId string, logServicesId string, sinksId string, logsink *LogSink) *ProjectsLogServicesSinksUpdateCall {\n\treturn &ProjectsLogServicesSinksUpdateCall{\n\t\ts: r.s,\n\t\tprojectsId: projectsId,\n\t\tlogServicesId: logServicesId,\n\t\tsinksId: sinksId,\n\t\tlogsink: logsink,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}\",\n\t}\n}", "func (a *apiEndpoint) Update() error {\n\ta.e.mutex.RLock()\n\ta.SetEntry(\"server\", api.String(a.e.poolEntry.Desc))\n\ta.SetEntry(\"status\", api.String(a.e.status.String()))\n\tif a.e.lastErr != nil {\n\t\ta.SetEntry(\"last_error\", api.String(a.e.lastErr.Error()))\n\t\ta.SetEntry(\"last_error_time\", api.String(a.e.lastErrTime.Format(time.RFC3339)))\n\t} else {\n\t\ta.SetEntry(\"last_error\", api.Null)\n\t\ta.SetEntry(\"last_error_time\", api.Null)\n\t}\n\ta.SetEntry(\"pendingPayloads\", api.Number(a.e.NumPending()))\n\ta.SetEntry(\"publishedLines\", api.Number(a.e.LineCount()))\n\ta.SetEntry(\"averageLatency\", api.Float(a.e.AverageLatency()/time.Millisecond))\n\ta.e.mutex.RUnlock()\n\n\treturn nil\n}", "func (er *EventRouter) updateEvent(objOld interface{}, objNew interface{}) {\n\teOld := objOld.(*v1.Event)\n\teNew := objNew.(*v1.Event)\n\tprometheusEvent(eNew, er)\n\tif eOld.ResourceVersion != eNew.ResourceVersion {\n\t\terr := store.DefaultMongoStore.Insert(er.Clustername, eNew)\n\t\tif nil != err {\n\t\t\tlog.Warn(\"insert event %s error %s\", eNew.Name, err.Error())\n\t\t}\n\t}\n}", "func (s serviceimpl) UpdateEvent(srv *calendar.Service, calendarID string, eventID string, name string, dateRange ...*DateRange) (*calendar.Event, error) {\n\tevt, err := srv.Events.Get(calendarID, eventID).Do()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\tevt.Summary = name\n\tif len(dateRange) > 0 {\n\t\tevt.Start.DateTime = dateRange[0].Start\n\t\tevt.End.DateTime = dateRange[0].End\n\t}\n\n\tevt, err = srv.Events.Update(calendarID, eventID, evt).Do()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil, err\n\t}\n\n\treturn evt, nil\n}", "func (o Occurrence) Updated(occurrence model.Occurrence) event.Domain {\n\treturn *event.NewDomainEvent(event.DomainArgs{\n\t\tCaller: tracker,\n\t\tAggregateName: occurrenceName,\n\t\tAction: update,\n\t\tAggregateID: occurrence.ID,\n\t\tBody: occurrence,\n\t})\n}", "func (api *objectAPI) Update(obj *objstore.Object) error {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = apicl.ObjstoreV1().Object().Update(context.Background(), obj)\n\t\treturn err\n\t}\n\n\tapi.ct.handleObjectEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Updated})\n\treturn nil\n}", "func (ch *ClickHouse) Update(object map[string]interface{}) error {\n\treturn ch.SyncStore(nil, []map[string]interface{}{object}, \"\", true)\n}", "func (w *WebhookServiceOp) Update(webhook *Webhook) (*Webhook, error) {\n\tpath := fmt.Sprintf(\"%s/%d\", webhooksBasePath, webhook.ID)\n\tresource := new(Webhook)\n\terr := w.client.Put(path, webhook, &resource)\n\n\treturn resource, err\n}", "func UpdateTargetHandler(w http.ResponseWriter, r *http.Request) {\n\tenv := envFromRequest(r)\n\n\tip, _, err := net.SplitHostPort(r.RemoteAddr)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := r.ParseForm(); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tmac, scriptName, environment, params := parsePostForm(r.PostForm)\n\tif mac == \"\" || scriptName == \"\" {\n\t\thttp.Error(w, \"MAC address and target must not be empty\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tserver := server.New(mac, ip, \"\")\n\tinputErr, err := polling.UpdateTarget(\n\t\tenv.Logger, env.ServerStates, env.Templates, env.EventLog, env.BaseURL, server,\n\t\tscriptName, environment, params)\n\n\tif err != nil {\n\t\tif inputErr {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t} else {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\n}", "func (s *GRPCServer) WatchUpdate(context.Context, *dashboard.WatchRequest) (*dashboard.Empty, error) {\n\tpanic(\"not implemented\")\n}", "func (s *Store) UpdateEvent(ctx context.Context, event *corev2.Event) (*corev2.Event, *corev2.Event, error) {\n\tif event == nil || event.Check == nil {\n\t\treturn nil, nil, &store.ErrNotValid{Err: errors.New(\"event has no check\")}\n\t}\n\n\tif err := event.Check.Validate(); err != nil {\n\t\treturn nil, nil, &store.ErrNotValid{Err: err}\n\t}\n\n\tif err := event.Entity.Validate(); err != nil {\n\t\treturn nil, nil, &store.ErrNotValid{Err: err}\n\t}\n\n\tctx = store.NamespaceContext(ctx, event.Entity.Namespace)\n\n\tprevEvent, err := s.GetEventByEntityCheck(\n\t\tctx, event.Entity.Name, event.Check.Name,\n\t)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Maintain check history.\n\tif prevEvent != nil {\n\t\tif !prevEvent.HasCheck() {\n\t\t\treturn nil, nil, &store.ErrNotValid{Err: errors.New(\"invalid previous event\")}\n\t\t}\n\n\t\tevent.Check.MergeWith(prevEvent.Check)\n\t}\n\n\tupdateOccurrences(event.Check)\n\n\tpersistEvent := event\n\n\tif event.HasMetrics() {\n\t\t// Taking pains to not modify our input, set metrics to nil so they are\n\t\t// not persisted.\n\t\tnewEvent := *event\n\t\tpersistEvent = &newEvent\n\t\tpersistEvent.Metrics = nil\n\t}\n\n\t// Truncate check output if the output is larger than MaxOutputSize\n\tif size := event.Check.MaxOutputSize; size > 0 && int64(len(event.Check.Output)) > size {\n\t\t// Taking pains to not modify our input, set a bound on the check\n\t\t// output size.\n\t\tnewEvent := *persistEvent\n\t\tpersistEvent = &newEvent\n\t\tcheck := *persistEvent.Check\n\t\tcheck.Output = check.Output[:size]\n\t\tpersistEvent.Check = &check\n\t}\n\n\tif persistEvent.Timestamp == 0 {\n\t\t// If the event is being created for the first time, it may not include\n\t\t// a timestamp. Use the current time.\n\t\tpersistEvent.Timestamp = time.Now().Unix()\n\t}\n\n\t// Handle expire on resolve silenced entries\n\tif err := handleExpireOnResolveEntries(ctx, persistEvent, s); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// update the history\n\t// marshal the new event and store it.\n\teventBytes, err := proto.Marshal(persistEvent)\n\tif err != nil {\n\t\treturn nil, nil, &store.ErrEncode{Err: err}\n\t}\n\n\tcmp := namespaceExistsForResource(event.Entity)\n\treq := clientv3.OpPut(getEventPath(event), string(eventBytes))\n\tres, err := s.client.Txn(ctx).If(cmp).Then(req).Commit()\n\tif err != nil {\n\t\treturn nil, nil, &store.ErrInternal{Message: err.Error()}\n\t}\n\tif !res.Succeeded {\n\t\treturn nil, nil, &store.ErrNamespaceMissing{Namespace: event.Entity.Namespace}\n\t}\n\n\treturn event, prevEvent, nil\n}", "func (f *EventFilter) Update(from *EventFilter, fields ...string) error {\n\tfor _, field := range fields {\n\t\tswitch field {\n\t\tcase \"Action\":\n\t\t\tf.Action = from.Action\n\t\tcase \"When\":\n\t\t\tf.When = from.When\n\t\tcase \"Expressions\":\n\t\t\tf.Expressions = append(f.Expressions[0:0], from.Expressions...)\n\t\tcase \"RuntimeAssets\":\n\t\t\tf.RuntimeAssets = append(f.RuntimeAssets[0:0], from.RuntimeAssets...)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unsupported field: %q\", f)\n\t\t}\n\t}\n\treturn nil\n}", "func (r ResourceEventHandlerFuncs) OnUpdate(oldObj, newObj interface{}) {\n\tif r.UpdateFunc != nil {\n\t\tr.UpdateFunc(oldObj, newObj)\n\t}\n}", "func (ctrler CtrlDefReactor) OnObjectUpdate(oldObj *Object, newObj *objstore.Object) error {\n\tlog.Info(\"OnObjectUpdate is not implemented\")\n\treturn nil\n}", "func newValueMetric(e *events.Envelope) *Event {\n\tvar m = e.GetValueMetric()\n\tvar r = LabelSet{\n\t\t\"cf_origin\": \"firehose\",\n\t\t\"deployment\": e.GetDeployment(),\n\t\t\"event_type\": e.GetEventType().String(),\n\t\t\"job\": e.GetJob(),\n\t\t\"job_index\": e.GetIndex(),\n\t\t\"origin\": e.GetOrigin(),\n\t}\n\tmsg := fmt.Sprintf(\"%s = %g (%s)\", m.GetName(), m.GetValue(), m.GetUnit())\n\treturn &Event{\n\t\tLabels: r,\n\t\tMsg: msg,\n\t}\n}", "func (handler *ObjectWebHandler) Update(w http.ResponseWriter, r *http.Request) {\n\trespondWithError(w, http.StatusNotImplemented, \"Not implemented\", nil)\n}", "func (h GuildMemberUpdateHandler) Event() api.GatewayEventType {\n\treturn api.GatewayEventGuildMemberUpdate\n}", "func (c *DefaultApiService) UpdateSink(Sid string, params *UpdateSinkParams) (*EventsV1Sink, error) {\n\tpath := \"/v1/Sinks/{Sid}\"\n\tpath = strings.Replace(path, \"{\"+\"Sid\"+\"}\", Sid, -1)\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\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 getProxyUpdateEvent(msg events.PubSubMessage) *proxyUpdateEvent {\n\tswitch msg.Kind {\n\tcase\n\t\t//\n\t\t// K8s native resource events\n\t\t//\n\t\t// Endpoint event\n\t\tannouncements.EndpointAdded, announcements.EndpointDeleted, announcements.EndpointUpdated,\n\t\t// k8s Ingress event\n\t\tannouncements.IngressAdded, announcements.IngressDeleted, announcements.IngressUpdated,\n\t\t//\n\t\t// OSM resource events\n\t\t//\n\t\t// Egress event\n\t\tannouncements.EgressAdded, announcements.EgressDeleted, announcements.EgressUpdated,\n\t\t// IngressBackend event\n\t\tannouncements.IngressBackendAdded, announcements.IngressBackendDeleted, announcements.IngressBackendUpdated,\n\t\t// MulticlusterService event\n\t\tannouncements.MultiClusterServiceAdded, announcements.MultiClusterServiceDeleted, announcements.MultiClusterServiceUpdated,\n\t\t//\n\t\t// SMI resource events\n\t\t//\n\t\t// SMI HTTPRouteGroup event\n\t\tannouncements.RouteGroupAdded, announcements.RouteGroupDeleted, announcements.RouteGroupUpdated,\n\t\t// SMI TCPRoute event\n\t\tannouncements.TCPRouteAdded, announcements.TCPRouteDeleted, announcements.TCPRouteUpdated,\n\t\t// SMI TrafficSplit event\n\t\tannouncements.TrafficSplitAdded, announcements.TrafficSplitDeleted, announcements.TrafficSplitUpdated,\n\t\t// SMI TrafficTarget event\n\t\tannouncements.TrafficTargetAdded, announcements.TrafficTargetDeleted, announcements.TrafficTargetUpdated,\n\t\t//\n\t\t// Proxy events\n\t\t//\n\t\tannouncements.ProxyUpdate:\n\t\treturn &proxyUpdateEvent{\n\t\t\tmsg: msg,\n\t\t\ttopic: announcements.ProxyUpdate.String(),\n\t\t}\n\n\tcase announcements.MeshConfigUpdated:\n\t\tprevMeshConfig, okPrevCast := msg.OldObj.(*v1alpha1.MeshConfig)\n\t\tnewMeshConfig, okNewCast := msg.NewObj.(*v1alpha1.MeshConfig)\n\t\tif !okPrevCast || !okNewCast {\n\t\t\tlog.Error().Msgf(\"Expected MeshConfig type, got previous=%T, new=%T\", okPrevCast, okNewCast)\n\t\t\treturn nil\n\t\t}\n\n\t\tprevSpec := prevMeshConfig.Spec\n\t\tnewSpec := newMeshConfig.Spec\n\t\t// A proxy config update must only be triggered when a MeshConfig field that maps to a proxy config\n\t\t// changes.\n\t\tif prevSpec.Traffic.EnableEgress != newSpec.Traffic.EnableEgress ||\n\t\t\tprevSpec.Traffic.EnablePermissiveTrafficPolicyMode != newSpec.Traffic.EnablePermissiveTrafficPolicyMode ||\n\t\t\tprevSpec.Observability.Tracing != newSpec.Observability.Tracing ||\n\t\t\tprevSpec.Traffic.InboundExternalAuthorization.Enable != newSpec.Traffic.InboundExternalAuthorization.Enable ||\n\t\t\t// Only trigger an update on InboundExternalAuthorization field changes if the new spec has the 'Enable' flag set to true.\n\t\t\t(newSpec.Traffic.InboundExternalAuthorization.Enable && (prevSpec.Traffic.InboundExternalAuthorization != newSpec.Traffic.InboundExternalAuthorization)) ||\n\t\t\tprevSpec.FeatureFlags != newSpec.FeatureFlags {\n\t\t\treturn &proxyUpdateEvent{\n\t\t\t\tmsg: msg,\n\t\t\t\ttopic: announcements.ProxyUpdate.String(),\n\t\t\t}\n\t\t}\n\t\treturn nil\n\n\tcase announcements.PodUpdated:\n\t\t// Only trigger a proxy update for proxies associated with this pod based on the proxy UUID\n\t\tprevPod, okPrevCast := msg.OldObj.(*corev1.Pod)\n\t\tnewPod, okNewCast := msg.NewObj.(*corev1.Pod)\n\t\tif !okPrevCast || !okNewCast {\n\t\t\tlog.Error().Msgf(\"Expected *Pod type, got previous=%T, new=%T\", okPrevCast, okNewCast)\n\t\t\treturn nil\n\t\t}\n\t\tprevMetricAnnotation := prevPod.Annotations[constants.PrometheusScrapeAnnotation]\n\t\tnewMetricAnnotation := newPod.Annotations[constants.PrometheusScrapeAnnotation]\n\t\tif prevMetricAnnotation != newMetricAnnotation {\n\t\t\tproxyUUID := newPod.Labels[constants.EnvoyUniqueIDLabelName]\n\t\t\treturn &proxyUpdateEvent{\n\t\t\t\tmsg: msg,\n\t\t\t\ttopic: GetPubSubTopicForProxyUUID(proxyUUID),\n\t\t\t}\n\t\t}\n\t\treturn nil\n\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (o *UpdateEventParams) WithBody(body *models.Event) *UpdateEventParams {\n\to.SetBody(body)\n\treturn o\n}", "func (manager *Manager) OnUpdateEndpoint(endpoint *k8sTypes.CiliumEndpoint) {\n\tid := types.NamespacedName{\n\t\tName: endpoint.GetName(),\n\t\tNamespace: endpoint.GetNamespace(),\n\t}\n\n\tmanager.pendingEndpointEventsLock.Lock()\n\tmanager.pendingEndpointEvents[id] = endpoint\n\tmanager.pendingEndpointEventsLock.Unlock()\n\n\tmanager.endpointEventsQueue.Add(id)\n}", "func (r *ImpossibleTravelRiskEventRequest) Update(ctx context.Context, reqObj *ImpossibleTravelRiskEvent) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (c Client) Update(input *UpdateWebhookInput) (*UpdateWebhookResponse, error) {\n\treturn c.UpdateWithContext(context.Background(), input)\n}", "func (o *UpdateEventParams) WithContext(ctx context.Context) *UpdateEventParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (s *Stream) Update(ctx context.Context, c Collector) (err error) {\n\tupdate := newTaskLogger(s.stdout).Task(fmt.Sprintf(\"DRIVE %s\", s.drive)).Task(\"UPDATE\")\n\n\tupdate.Log(\"Started %s\\n\", time.Now().Format(time.RFC3339))\n\tdefer func(e *error) {\n\t\tif *e != nil {\n\t\t\tupdate.Log(\"ERROR: %v\\n\", *e)\n\t\t\tupdate.Log(\"Aborted %s | %s\\n\", time.Now().Format(time.RFC3339), update.Duration())\n\t\t} else {\n\t\t\tupdate.Log(\"Finished %s | %s\\n\", time.Now().Format(time.RFC3339), update.Duration())\n\t\t}\n\t}(&err)\n\n\tif err = s.collect(ctx, c, update); err != nil {\n\t\treturn err\n\t}\n\n\treturn s.buildCommits(ctx, update)\n}", "func UpdateEvent(id bson.ObjectId, event Event) Event {\n\tsession, _ := mgo.Dial(\"127.0.0.1\")\n\tdefer session.Close()\n\tsession.SetMode(mgo.Monotonic, true)\n\tdb := session.DB(\"insapp\").C(\"event\")\n\teventID := bson.M{\"_id\": id}\n\tchange := bson.M{\"$set\": bson.M{\n\t\t\"name\"\t\t\t\t\t:\tevent.Name,\n\t\t\"description\"\t\t:\tevent.Description,\n\t\t\"status\"\t\t\t\t:\tevent.Status,\n\t\t\"image\"\t\t\t\t\t:\tevent.Image,\n\t\t\"palette\"\t\t\t\t:\tevent.Palette,\n\t\t\"selectedcolor\"\t:\tevent.SelectedColor,\n\t\t\"datestart\"\t\t\t:\tevent.DateStart,\n\t\t\"dateend\"\t\t\t\t:\tevent.DateEnd,\n\t\t\"bgcolor\"\t\t\t\t:\tevent.BgColor,\n\t\t\"fgcolor\"\t\t\t\t: event.FgColor,\n\t}}\n\tdb.Update(eventID, change)\n\tvar result Event\n\tdb.Find(bson.M{\"_id\": id}).One(&result)\n\treturn result\n}", "func (t *Target) Update(newTarget *Target) {\n\tmutableMutex.Lock()\n defer mutableMutex.Unlock()\n\tt.Protocol = newTarget.Protocol\n\tt.Dest = newTarget.Dest\n\tt.TCPTLS = newTarget.TCPTLS\n\tt.HTTPMethod = newTarget.HTTPMethod\n\tt.HTTPStatusList = newTarget.HTTPStatusList\n\tt.Regexp = newTarget.Regexp\n\tt.ResSize = newTarget.ResSize\n\tt.Retry = newTarget.Retry\n\tt.RetryWait = newTarget.RetryWait\n\tt.Timeout = newTarget.Timeout\n\tt.TLSSkipVerify = newTarget.TLSSkipVerify\n}", "func (command HelloWorldResource) Update(ctx context.Context, awsConfig awsv2.Config,\n\tevent *CloudFormationLambdaEvent,\n\tlogger *zerolog.Logger) (map[string]interface{}, error) {\n\trequest := HelloWorldResourceRequest{}\n\trequestPropsErr := json.Unmarshal(event.ResourceProperties, &request)\n\tif requestPropsErr != nil {\n\t\treturn nil, requestPropsErr\n\t}\n\tlogger.Info().Msgf(\"update: %s\", request.Message)\n\treturn nil, nil\n}", "func (br *BGPReflector) Update(event controller.Event, txn controller.UpdateOperations) (changeDescription string, err error) {\n\n\tif bgpRouteUpdate, isBGPRouteUpdate := event.(*BGPRouteUpdate); isBGPRouteUpdate {\n\t\tbr.Log.Debugf(\"BGP route update: %v\", bgpRouteUpdate)\n\n\t\t// add / delete route on VPP\n\t\tkey, route := br.vppRoute(bgpRouteUpdate.DstNetwork, bgpRouteUpdate.GwAddr)\n\t\tif bgpRouteUpdate.Type == RouteAdd {\n\t\t\ttxn.Put(key, route)\n\t\t\tchangeDescription = \"BGP route Add\"\n\t\t} else {\n\t\t\ttxn.Delete(key)\n\t\t\tchangeDescription = \"BGP route Delete\"\n\t\t}\n\t}\n\treturn\n}", "func (r *PodsIncomingReflector) HandleEvent(e interface{}) {\n\tevent := e.(watch.Event)\n\tpod, ok := event.Object.(*corev1.Pod)\n\tif !ok {\n\t\tklog.Error(\"INCOMING REFLECTION: cannot cast object to pod\")\n\t\treturn\n\t}\n\n\tif pod == nil {\n\t\tklog.V(4).Info(\"INCOMING REFLECTION: received nil pod to process\")\n\t\treturn\n\t}\n\n\tklog.V(3).Infof(\"INCOMING REFLECTION: received %v for pod %v\", event.Type, pod.Name)\n\n\tr.PushToInforming(pod)\n}", "func (f *Flow) Update(packet *Packet, opts *Opts) {\n\tnow := UnixMilli(packet.GoPacket.Metadata().CaptureInfo.Timestamp)\n\tf.Last = now\n\tf.Metric.Last = now\n\n\tif opts.LayerKeyMode == L3PreferredKeyMode {\n\t\t// use the ethernet length as we want to get the full size and we want to\n\t\t// rely on the l3 address order.\n\t\tlength := packet.Length\n\t\tif length == 0 {\n\t\t\tif ethernetPacket := getLinkLayer(packet); ethernetPacket != nil {\n\t\t\t\tlength = getLinkLayerLength(ethernetPacket)\n\t\t\t}\n\t\t}\n\n\t\tf.updateMetricsWithNetworkLayer(packet, length)\n\t} else {\n\t\tif updated := f.updateMetricsWithLinkLayer(packet); !updated {\n\t\t\tf.updateMetricsWithNetworkLayer(packet, 0)\n\t\t}\n\t}\n\n\tf.updateRTT(packet)\n\n\t// depends on options\n\tif f.TCPMetric != nil {\n\t\tf.updateTCPMetrics(packet)\n\t}\n\tif (opts.ExtraLayers & DNSLayer) != 0 {\n\t\tif layer := packet.Layer(layers.LayerTypeDNS); layer != nil {\n\t\t\tf.updateDNSLayer(layer, packet.GoPacket.Metadata().CaptureInfo.Timestamp)\n\t\t}\n\t}\n}", "func (r *ProjectsLogsSinksService) Update(projectsId string, logsId string, sinksId string, logsink *LogSink) *ProjectsLogsSinksUpdateCall {\n\treturn &ProjectsLogsSinksUpdateCall{\n\t\ts: r.s,\n\t\tprojectsId: projectsId,\n\t\tlogsId: logsId,\n\t\tsinksId: sinksId,\n\t\tlogsink: logsink,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}\",\n\t}\n}", "func Update(c client.Client, obj runtime.Object) error {\n\tkind := obj.GetObjectKind().GroupVersionKind().Kind\n\n\t// Only allow updates on specic kinds.\n\tif kind != \"ConfigMap\" {\n\t\treturn errors.New(\"update not supported for this object kind\")\n\t}\n\n\tif err := c.Update(context.Background(), obj); err != nil {\n\t\treturn fmt.Errorf(\"failed to update %s: %v\", kind, err)\n\t}\n\treturn nil\n}", "func (s *store) OnUpdate(oldObj, newObj interface{}) {\n\toldPod, ok1 := oldObj.(*api.Pod)\n\tnewPod, ok2 := newObj.(*api.Pod)\n\tif !ok1 || !ok2 {\n\t\tlog.Errorf(\"Expected Pod but OnUpdate handler received %+v %+v\", oldObj, newObj)\n\t\treturn\n\t}\n\n\tif oldPod.Status.PodIP != newPod.Status.PodIP {\n\t\ts.OnDelete(oldPod)\n\t\ts.OnAdd(newPod)\n\t}\n}", "func (s *WebhooksServiceOp) Update(webhook Webhook, options ...interface{}) (Webhook, error) {\n\tvar webhookResponse GetWebhookResponse\n\tjsonBody, err := json.Marshal(webhook)\n\tif err != nil {\n\t\treturn webhookResponse.Data, err\n\t}\n\treqBody := bytes.NewReader(jsonBody)\n\tbody, reqErr := s.client.DoRequest(http.MethodPut, fmt.Sprintf(\"/v3/hooks/%d\", webhook.ID), reqBody)\n\tif reqErr != nil {\n\t\treturn webhookResponse.Data, reqErr\n\t}\n\n\tjsonErr := json.Unmarshal(body, &webhookResponse)\n\tif jsonErr != nil {\n\t\treturn webhookResponse.Data, jsonErr\n\t}\n\n\treturn webhookResponse.Data, nil\n}", "func (sp *ServiceProcessor) Update(event controller.Event) error {\n\tif ksChange, isKSChange := event.(*controller.KubeStateChange); isKSChange {\n\t\treturn sp.propagateDataChangeEv(ksChange)\n\t}\n\n\tif addPod, isAddPod := event.(*podmanager.AddPod); isAddPod {\n\t\treturn sp.ProcessNewPod(addPod.Pod.Namespace, addPod.Pod.Name)\n\t}\n\tif deletePod, isDeletePod := event.(*podmanager.DeletePod); isDeletePod {\n\t\treturn sp.ProcessDeletingPod(deletePod.Pod.Namespace, deletePod.Pod.Name)\n\t}\n\n\tif _, isNodeUpdate := event.(*nodesync.NodeUpdate); isNodeUpdate {\n\t\treturn sp.renderNodePorts()\n\t}\n\n\treturn nil\n}", "func (pe *WzPingEvent) Update(msg *wzlib_transport.WzGenericMessage) {\n\tuid := msg.Payload[wzlib_transport.PAYLOAD_SYSTEM_ID].(string)\n\tif pe.uid != uid {\n\t\treturn\n\t}\n\n\tpingId, ok := msg.Payload[wzlib_transport.PAYLOAD_PING_ID]\n\tif !ok {\n\t\tpe.GetLogger().Errorln(\"Ping message contains no 'ping.id' section!\")\n\t} else {\n\t\tpingStatItf, ok := pe.pings.Get(pingId.(string))\n\t\tpingStat := pingStatItf.(*WzPingStat)\n\t\tif !ok {\n\t\t\tpe.GetLogger().Errorln(\"Unable to find ping ID for\", pingId)\n\t\t} else {\n\t\t\tpingStat.Ticks = time.Now().Unix() - pingStat.Ticks\n\t\t\tpingStat.Responded = true\n\t\t}\n\t}\n}", "func (c *MetricCollector) Update(ctx context.Context, metric *Metric) (*Metric, error) {\n\tc.collectionsMutex.Lock()\n\tdefer c.collectionsMutex.Unlock()\n\n\tkey := NewMetricKey(metric.Namespace, metric.Name)\n\tif collection, exists := c.collections[key]; exists {\n\t\tcollection.metric = metric\n\t\treturn collection.metric.DeepCopy(), nil\n\t}\n\treturn nil, k8serrors.NewNotFound(kpa.Resource(\"Metrics\"), key)\n}", "func (r *DeviceHealthScriptDeviceStateRequest) Update(ctx context.Context, reqObj *DeviceHealthScriptDeviceState) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (r *DeviceHealthScriptDeviceStateRequest) Update(ctx context.Context, reqObj *DeviceHealthScriptDeviceState) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}" ]
[ "0.5389559", "0.5306597", "0.51904404", "0.515413", "0.5118005", "0.5084545", "0.50144255", "0.49988312", "0.4901944", "0.48523718", "0.483984", "0.48148668", "0.4811473", "0.47936144", "0.47582054", "0.47557688", "0.4751602", "0.47373387", "0.46917793", "0.46882197", "0.4630409", "0.45665073", "0.45600775", "0.45559874", "0.44874272", "0.4484724", "0.44804913", "0.4476848", "0.4467734", "0.446562", "0.44222078", "0.43961412", "0.43947494", "0.43847638", "0.43725422", "0.43682176", "0.43459013", "0.43257058", "0.4323969", "0.43237996", "0.43177798", "0.4274234", "0.4265449", "0.42307928", "0.42283267", "0.42193687", "0.4217768", "0.42141625", "0.41826412", "0.41670316", "0.4146307", "0.41429093", "0.4135115", "0.4131156", "0.40986776", "0.4097153", "0.40946868", "0.40942353", "0.40916345", "0.40864825", "0.40832", "0.407994", "0.40794954", "0.4073989", "0.4064043", "0.406131", "0.4058489", "0.40425506", "0.40402585", "0.40319553", "0.40302578", "0.40268233", "0.40226558", "0.40144104", "0.4008464", "0.40071732", "0.4006675", "0.4003437", "0.3997828", "0.39976394", "0.39919174", "0.39886042", "0.39852947", "0.3979595", "0.39789408", "0.397639", "0.3975948", "0.39642754", "0.39576438", "0.39441174", "0.39405307", "0.3940058", "0.39385852", "0.39352337", "0.39318398", "0.39318076", "0.39307123", "0.39261103", "0.39250004", "0.39250004" ]
0.7178435
0
UpdateStatus was generated because the type contains a Status member. Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeCloudwatchEventTargets) UpdateStatus(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (*v1alpha1.CloudwatchEventTarget, error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(cloudwatcheventtargetsResource, "status", c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{}) if obj == nil { return nil, err } return obj.(*v1alpha1.CloudwatchEventTarget), err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (i *DeleteOrUpdateInvTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata) {}", "func (r *Reconciler) UpdateStatus() error {\n\tlog := r.Logger.WithField(\"func\", \"UpdateStatus\")\n\tlog.Infof(\"Updating noobaa status\")\n\tr.NooBaa.Status.ObservedGeneration = r.NooBaa.Generation\n\treturn r.Client.Status().Update(r.Ctx, r.NooBaa)\n}", "func (manager *Manager) updateStatus(jobStatus ingestic.JobStatus) {\n\tmanager.estimatedEndTimeInSec = jobStatus.EstimatedEndTimeInSec\n\tmanager.percentageComplete = jobStatus.PercentageComplete\n\n\tevent := &automate_event.EventMsg{\n\t\tEventID: createEventUUID(),\n\t\tType: &automate_event.EventType{Name: automate_event_type.ProjectRulesUpdateStatus},\n\t\tPublished: ptypes.TimestampNow(),\n\t\tProducer: &automate_event.Producer{\n\t\t\tID: event_ids.ComplianceInspecReportProducerID,\n\t\t},\n\t\tData: &_struct.Struct{\n\t\t\tFields: map[string]*_struct.Value{\n\t\t\t\t\"Completed\": {\n\t\t\t\t\tKind: &_struct.Value_BoolValue{\n\t\t\t\t\t\tBoolValue: jobStatus.Completed,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"PercentageComplete\": {\n\t\t\t\t\tKind: &_struct.Value_NumberValue{\n\t\t\t\t\t\tNumberValue: float64(jobStatus.PercentageComplete),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"EstimatedTimeCompeleteInSec\": {\n\t\t\t\t\tKind: &_struct.Value_NumberValue{\n\t\t\t\t\t\tNumberValue: float64(jobStatus.EstimatedEndTimeInSec),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tproject_update_tags.ProjectUpdateIDTag: {\n\t\t\t\t\tKind: &_struct.Value_StringValue{\n\t\t\t\t\t\tStringValue: manager.projectUpdateID,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tpubReq := &automate_event.PublishRequest{Msg: event}\n\t_, err := manager.eventServiceClient.Publish(context.Background(), pubReq)\n\tif err != nil {\n\t\tlogrus.Warnf(\"Publishing Failed event %v\", err)\n\t}\n}", "func Status(status int) {\n\tif r, ok := responseDefinition(); ok {\n\t\tr.Status = status\n\t}\n}", "func (t *Task) updateStatus() {\n\tb, err := json.Marshal(&map[string]interface{}{\n\t\t\"type\": \"update\",\n\t\t\"start\": t.Desc.Start,\n\t\t\"end\": t.Desc.End,\n\t\t\"status\": t.Desc.Status,\n\t})\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\torm.UpdateTask(&t.Desc)\n\tsockets.Message(t.Desc.ID, b)\n}", "func (_BaseContent *BaseContentTransactor) UpdateStatus(opts *bind.TransactOpts, status_code *big.Int) (*types.Transaction, error) {\n\treturn _BaseContent.contract.Transact(opts, \"updateStatus\", status_code)\n}", "func (s *SQLProxySpec) UpdateStatus(rsrc interface{}, reconciled []ResourceInfo, err error) {\n\tstatus := rsrc.(*AirflowBaseStatus)\n\tstatus.SQLProxy = ComponentStatus{}\n\tif s != nil {\n\t\tstatus.SQLProxy.update(reconciled, err)\n\t\tif status.SQLProxy.Status != StatusReady {\n\t\t\tstatus.Status = StatusInProgress\n\t\t}\n\t}\n}", "func (s *SimpleBlockFactory) StatusUpdate(block *types.Block) {\n}", "func (r *CustomDomainReconciler) statusUpdate(reqLogger logr.Logger, instance *customdomainv1alpha1.CustomDomain) error {\n\terr := r.Client.Status().Update(context.TODO(), instance)\n\tif err != nil {\n\t\treqLogger.Error(err, fmt.Sprintf(\"Status update for %s failed\", instance.Name))\n\t}\n\t//reqLogger.Info(fmt.Sprintf(\"Status updated for %s\", instance.Name))\n\treturn err\n}", "func (h *Handler) UpdateStatus(w http.ResponseWriter, r *http.Request) {\n\n\tcmd := sigstat.Command{\n\t\tStatus: \"running\",\n\t}\n\n\th.client.CommandService().UpdateStatus(cmd)\n}", "func (b *FollowUpBuilder) Status(value string) *FollowUpBuilder {\n\tb.status = value\n\tb.bitmap_ |= 2048\n\treturn b\n}", "func (r *Reconciler) UpdateStatus() error {\n\terr := r.Client.Status().Update(r.Ctx, r.NooBaaAccount)\n\tif err != nil {\n\t\tr.Logger.Errorf(\"UpdateStatus: %s\", err)\n\t\treturn err\n\t}\n\tr.Logger.Infof(\"UpdateStatus: Done\")\n\treturn nil\n}", "func (w *ClusterDynamicClient) UpdateStatus(obj *unstructured.Unstructured, options metav1.UpdateOptions) (*unstructured.Unstructured, error) {\n\treturn w.dClient.Resource(w.resource).Namespace(w.namespace).UpdateStatus(w.ctx, obj, options)\n}", "func (m *SchemaExtension) SetStatus(value *string)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "func (v Validator) UpdateStatus(newStatus sdk.BondStatus) Validator {\n\tv.Status = newStatus\n\treturn v\n}", "func (r *ManagedServicePollRequest) Status(value int) *ManagedServicePollRequest {\n\tr.statuses = append(r.statuses, value)\n\treturn r\n}", "func (m *ThreatAssessmentRequest) SetStatus(value *ThreatAssessmentStatus)() {\n m.status = value\n}", "func (r *ReconcilerBase) UpdateStatus(obj runtime.Object) error {\n\treturn r.GetClient().Status().Update(context.Background(), obj)\n}", "func (m *Manager) updateStatus(ctx context.Context, status *MessageStatus) {\n\terr := m.r.UpdateStatus(ctx, status)\n\tif err != nil {\n\t\tlog.Log(ctx, errors.Wrap(err, \"update message status\"))\n\t}\n}", "func updateStatus(args []string) {\n\tdata, klocworkURL := formBaseRequest(\"update_status\")\n\tdata.Set(\"project\", args[0])\n\tdata.Set(\"ids\", args[1])\n\tdata.Set(\"status\", args[2])\n\n\tsendRequest(klocworkURL, data)\n\n}", "func (f *Friend) SetStatus(status int) {\n\tf.status = status\n}", "func (t *StatusTracker) UpdateStatus() {\n\tif t.failures < t.halfOpenThreshold {\n\t\tt.status = Closed\n\t} else if t.failures < t.openThreshold {\n\t\tt.status = HalfOpen\n\t} else {\n\t\tt.status = Open\n\t}\n}", "func StatusUpdate(pkt event.Packet) client.RegistryFunc {\n\treturn func(clients client.Registry) error {\n\t\tfrom := pkt.UIDs()[0]\n\n\t\tif _, ok := clients[from]; !ok {\n\t\t\treturn fmt.Errorf(\"for packet numbered %v client %v is not connected\", pkt.Sequence(), from)\n\t\t}\n\n\t\ttargetClient := clients[from]\n\n\t\tfor uid := range targetClient.Followers {\n\t\t\tfollower, ok := clients[uid]\n\t\t\tif !ok {\n\t\t\t\t// Client is no longer present, delete from followers\n\t\t\t\tdelete(targetClient.Followers, uid)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !follower.IsActive() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif err := follower.Send(pkt); err != nil {\n\t\t\t\tlog.Debug(fmt.Sprintf(\"notify.StatusUpdate: for client %v, got error %#q\", uid, err))\n\t\t\t\tdelete(targetClient.Followers, uid)\n\n\t\t\t\tclient.UnregisterFunc(uid)(clients)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func (m *RetentionEventStatus) SetStatus(value *EventStatusType)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "func (c *rpcServices) UpdateStatus(rpcService *v1.RpcService) (result *v1.RpcService, err error) {\n\tresult = &v1.RpcService{}\n\terr = c.client.Put().\n\t\tNamespace(c.ns).\n\t\tResource(\"rpcservices\").\n\t\tName(rpcService.Name).\n\t\tSubResource(\"status\").\n\t\tBody(rpcService).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (w *WaitTask) StatusUpdate(taskContext *TaskContext, id object.ObjMetadata) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\n\tif klog.V(5).Enabled() {\n\t\tstatus := taskContext.ResourceCache().Get(id).Status\n\t\tklog.Infof(\"status update (object: %q, status: %q)\", id, status)\n\t}\n\n\tswitch {\n\tcase w.pending.Contains(id):\n\t\tswitch {\n\t\tcase w.changedUID(taskContext, id):\n\t\t\t// replaced\n\t\t\tw.handleChangedUID(taskContext, id)\n\t\t\tw.pending = w.pending.Remove(id)\n\t\tcase w.reconciledByID(taskContext, id):\n\t\t\t// reconciled - remove from pending & send event\n\t\t\terr := taskContext.InventoryManager().SetSuccessfulReconcile(id)\n\t\t\tif err != nil {\n\t\t\t\t// Object never applied or deleted!\n\t\t\t\tklog.Errorf(\"Failed to mark object as successful reconcile: %v\", err)\n\t\t\t}\n\t\t\tw.pending = w.pending.Remove(id)\n\t\t\tw.sendEvent(taskContext, id, event.ReconcileSuccessful)\n\t\tcase w.failedByID(taskContext, id):\n\t\t\t// failed - remove from pending & send event\n\t\t\terr := taskContext.InventoryManager().SetFailedReconcile(id)\n\t\t\tif err != nil {\n\t\t\t\t// Object never applied or deleted!\n\t\t\t\tklog.Errorf(\"Failed to mark object as failed reconcile: %v\", err)\n\t\t\t}\n\t\t\tw.pending = w.pending.Remove(id)\n\t\t\tw.failed = append(w.failed, id)\n\t\t\tw.sendEvent(taskContext, id, event.ReconcileFailed)\n\t\t\t// default - still pending\n\t\t}\n\tcase !w.Ids.Contains(id):\n\t\t// not in wait group - ignore\n\t\treturn\n\tcase w.skipped(taskContext, id):\n\t\t// skipped - ignore\n\t\treturn\n\tcase w.failed.Contains(id):\n\t\t// If a failed resource becomes current before other\n\t\t// resources have completed/timed out, we consider it\n\t\t// current.\n\t\tif w.reconciledByID(taskContext, id) {\n\t\t\t// reconciled - remove from pending & send event\n\t\t\terr := taskContext.InventoryManager().SetSuccessfulReconcile(id)\n\t\t\tif err != nil {\n\t\t\t\t// Object never applied or deleted!\n\t\t\t\tklog.Errorf(\"Failed to mark object as successful reconcile: %v\", err)\n\t\t\t}\n\t\t\tw.failed = w.failed.Remove(id)\n\t\t\tw.sendEvent(taskContext, id, event.ReconcileSuccessful)\n\t\t} else if !w.failedByID(taskContext, id) {\n\t\t\t// If a resource is no longer reported as Failed and is not Reconciled,\n\t\t\t// they should just go back to InProgress.\n\t\t\terr := taskContext.InventoryManager().SetPendingReconcile(id)\n\t\t\tif err != nil {\n\t\t\t\t// Object never applied or deleted!\n\t\t\t\tklog.Errorf(\"Failed to mark object as pending reconcile: %v\", err)\n\t\t\t}\n\t\t\tw.failed = w.failed.Remove(id)\n\t\t\tw.pending = append(w.pending, id)\n\t\t\tw.sendEvent(taskContext, id, event.ReconcilePending)\n\t\t}\n\t\t// else - still failed\n\tdefault:\n\t\t// reconciled - check if unreconciled\n\t\tif !w.reconciledByID(taskContext, id) {\n\t\t\t// unreconciled - add to pending & send event\n\t\t\terr := taskContext.InventoryManager().SetPendingReconcile(id)\n\t\t\tif err != nil {\n\t\t\t\t// Object never applied or deleted!\n\t\t\t\tklog.Errorf(\"Failed to mark object as pending reconcile: %v\", err)\n\t\t\t}\n\t\t\tw.pending = append(w.pending, id)\n\t\t\tw.sendEvent(taskContext, id, event.ReconcilePending)\n\t\t}\n\t\t// else - still reconciled\n\t}\n\n\tklog.V(3).Infof(\"wait task progress: %d/%d\", len(w.Ids)-len(w.pending), len(w.Ids))\n\n\t// If we no longer have any pending resources, the WaitTask\n\t// can be completed.\n\tif len(w.pending) == 0 {\n\t\t// all reconciled, so exit\n\t\tklog.V(3).Infof(\"all objects reconciled or skipped (name: %q)\", w.TaskName)\n\t\tw.cancelFunc()\n\t}\n}", "func (r *Reconciler) setStatus(\n\tctx context.Context,\n\tinstance *v1alpha1.ServiceBindingRequest,\n\tstatus string,\n) error {\n\tinstance.Status.BindingStatus = status\n\treturn r.client.Status().Update(ctx, instance)\n}", "func (r *Reconciler) updateStatus(ctx reconcileRequestContext, processingJobStatus string) error {\n\treturn r.updateStatusWithAdditional(ctx, processingJobStatus, \"\")\n}", "func (m *TeamsAsyncOperation) SetStatus(value *TeamsAsyncOperationStatus)() {\n m.status = value\n}", "func (dtm *DfgetTaskManager) UpdateStatus(ctx context.Context, clientID, taskID, status string) error {\n\tdfgetTask, err := dtm.getDfgetTask(clientID, taskID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dfgetTask.Status != types.DfGetTaskStatusSUCCESS {\n\t\tdfgetTask.Status = status\n\t}\n\n\treturn nil\n}", "func (souo *SubjectsOfferedUpdateOne) SetSTATUS(b bool) *SubjectsOfferedUpdateOne {\n\tsouo.mutation.SetSTATUS(b)\n\treturn souo\n}", "func (nr *namedReceiver) UpdateStatus(ctx context.Context, status *MessageStatus) error {\n\treturn nr.Receiver.UpdateStatus(ctx, status.wrap(ctx, nr.ns))\n}", "func (r *ManagedServiceUpdateResponse) Status() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\treturn r.status\n}", "func (k *KubernetesScheduler) StatusUpdate(driver mesos.SchedulerDriver, taskStatus *mesos.TaskStatus) {\n\tlog.Infof(\"Received status update %v\\n\", taskStatus)\n\n\tk.Lock()\n\tdefer k.Unlock()\n\n\tswitch taskStatus.GetState() {\n\tcase mesos.TaskState_TASK_STAGING:\n\t\tk.handleTaskStaging(taskStatus)\n\tcase mesos.TaskState_TASK_STARTING:\n\t\tk.handleTaskStarting(taskStatus)\n\tcase mesos.TaskState_TASK_RUNNING:\n\t\tk.handleTaskRunning(taskStatus)\n\tcase mesos.TaskState_TASK_FINISHED:\n\t\tk.handleTaskFinished(taskStatus)\n\tcase mesos.TaskState_TASK_FAILED:\n\t\tk.handleTaskFailed(taskStatus)\n\tcase mesos.TaskState_TASK_KILLED:\n\t\tk.handleTaskKilled(taskStatus)\n\tcase mesos.TaskState_TASK_LOST:\n\t\tk.handleTaskLost(taskStatus)\n\t}\n}", "func ChangeStatus(c *server.Context) error {\n\tvar (\n\t\terr error\n\t\tchangeReq struct {\n\t\t\tIDs []uint32 `json:\"ids\" validate:\"required,min=1\"`\n\t\t\tStatus int8 `json:\"status\" validate:\"required,eq=-1|eq=1|eq=2|eq=3\"`\n\t\t}\n\t)\n\n\tisAdmin := c.Request().Context().Value(\"user\").(jwtgo.MapClaims)[util.IsAdmin].(bool)\n\tif !isAdmin {\n\t\tlogger.Error(\"You don't have access\")\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrToken, nil)\n\t}\n\n\terr = c.JSONBody(&changeReq)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrInvalidParam, nil)\n\t}\n\n\terr = c.Validate(changeReq)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrInvalidParam, nil)\n\t}\n\n\tconn, err := mysql.Pool.Get()\n\tdefer mysql.Pool.Release(conn)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\t// status: -1 -> delete or sold out\n\t// 1 -> common\n\t// 2 -> promotion\n\t// 3 -> today new wares\n\terr = ware.Service.ChangeStatus(conn, changeReq.IDs, changeReq.Status)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\tlogger.Info(\"change ware status success\")\n\treturn core.WriteStatusAndDataJSON(c, constants.ErrSucceed, nil)\n}", "func updateAgentStatus(status, message string) error {\n\t// IMP - To be removed once the model is in production\n\tif agent.cfg == nil || agent.cfg.GetAgentName() == \"\" {\n\t\treturn nil\n\t}\n\n\tif agent.agentResource != nil {\n\t\tagentResourceType := getAgentResourceType()\n\t\tresource := createAgentStatusSubResource(agentResourceType, status, message)\n\t\tbuffer, err := json.Marshal(resource)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tsubResURL := agent.cfg.GetEnvironmentURL() + \"/\" + agentResourceType + \"/\" + agent.cfg.GetAgentName() + \"/status\"\n\t\t_, err = agent.apicClient.ExecuteAPI(coreapi.PUT, subResURL, nil, buffer)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (m *ScheduleItem) SetStatus(value *FreeBusyStatus)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *MySQLSpec) UpdateStatus(rsrc interface{}, reconciled []ResourceInfo, err error) {\n\tstatus := rsrc.(*AirflowBaseStatus)\n\tstatus.MySQL = ComponentStatus{}\n\tif s != nil {\n\t\tstatus.MySQL.update(reconciled, err)\n\t\tif status.MySQL.Status != StatusReady {\n\t\t\tstatus.Status = StatusInProgress\n\t\t}\n\t}\n}", "func (m *LongRunningOperation) SetStatus(value *LongRunningOperationStatus)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "func (client *ClientRPCMethods) Status(in *string, response *ServerStatus) (err error) {\n\t*response = *client.client.callback.Status()\n\treturn nil\n}", "func (clt *client) setStatus(newStatus Status) {\n\tclt.statusLock.Lock()\n\tclt.status = newStatus\n\tclt.statusLock.Unlock()\n}", "func (ktuo *KqiTargetUpdateOne) SetStatus(b bool) *KqiTargetUpdateOne {\n\tktuo.mutation.SetStatus(b)\n\treturn ktuo\n}", "func (self *client) GetStatus() {\n\n}", "func (UserService) UpdateStatus(dto dto.UserEditStatusDto) int64 {\n\tu := userDao.Get(dto.Id, false)\n\t//u.Status = dto.Status\n\tc := userDao.Update(&u, map[string]interface{}{\n\t\t\"status\": dto.Status,\n\t})\n\treturn c.RowsAffected\n}", "func UpdateStatus(status, description string) {\n\tupdateAgentStatus(status, description)\n}", "func updateStatus(e *event) {\n\tfMap := followers[e.from]\n\tfor _, f := range fMap {\n\t\tif h, ok := clients.Get(f); ok {\n\t\t\th.Write(e)\n\t\t}\n\t}\n}", "func (s *NFSStoreSpec) UpdateStatus(rsrc interface{}, reconciled []ResourceInfo, err error) {\n\tstatus := rsrc.(*AirflowBaseStatus)\n\tstatus.Storage = ComponentStatus{}\n\tif s != nil {\n\t\tstatus.Storage.update(reconciled, err)\n\t\tif status.Storage.Status != StatusReady {\n\t\t\tstatus.Status = StatusInProgress\n\t\t}\n\t}\n}", "func (c *CSV) UpdateStatus(a *config.AppContext) error {\n\t/*\n\t * We will update the status\n\t */\n\treturn a.Db.Model(&c.Resource).Updates(map[string]interface{}{\n\t\t\"status\": c.Resource.Status,\n\t}).Error\n}", "func (a *DefaultApiService) Status(ctx _context.Context) ApiStatusRequest {\n\treturn ApiStatusRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (s *AirflowUISpec) UpdateStatus(rsrc interface{}, reconciled []ResourceInfo, err error) {\n\tstatus := rsrc.(*AirflowClusterStatus)\n\tstatus.UI = ComponentStatus{}\n\tif s != nil {\n\t\tstatus.UI.update(reconciled, err)\n\t\tif status.UI.Status != StatusReady {\n\t\t\tstatus.Status = StatusInProgress\n\t\t}\n\t}\n}", "func (puo *ProfileUpdateOne) SetStatus(b bool) *ProfileUpdateOne {\n\tpuo.mutation.SetStatus(b)\n\treturn puo\n}", "func (c *client) Status(u *model.User, r *model.Repo, b *model.Build, link string) error {\n\tclient := c.newClientToken(u.Token)\n\n\tstatus := getStatus(b.Status)\n\tdesc := getDesc(b.Status)\n\n\t_, err := client.CreateStatus(\n\t\tr.Owner,\n\t\tr.Name,\n\t\tb.Commit,\n\t\tgitea.CreateStatusOption{\n\t\t\tState: status,\n\t\t\tTargetURL: link,\n\t\t\tDescription: desc,\n\t\t\tContext: c.Context,\n\t\t},\n\t)\n\n\treturn err\n}", "func (b *ServiceClusterBuilder) Status(value string) *ServiceClusterBuilder {\n\tb.status = value\n\tb.bitmap_ |= 256\n\treturn b\n}", "func (m *AccessPackageAssignment) SetStatus(value *string)() {\n m.status = value\n}", "func (o *Status) Update() {\n o.Time = time.Now()\n}", "func (c *cachestub) UpdateRecordStatus(token, version string, status cache.RecordStatusT, timestamp int64, metadata []cache.MetadataStream) error {\n\treturn nil\n}", "func (oiu *OrderInfoUpdate) SetStatus(i int8) *OrderInfoUpdate {\n\toiu.mutation.ResetStatus()\n\toiu.mutation.SetStatus(i)\n\treturn oiu\n}", "func (m *ThreatAssessmentRequest) SetStatus(value *ThreatAssessmentStatus)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "func (oiuo *OrderInfoUpdateOne) SetStatus(i int8) *OrderInfoUpdateOne {\n\toiuo.mutation.ResetStatus()\n\toiuo.mutation.SetStatus(i)\n\treturn oiuo\n}", "func UpdateStatus(APIstub shim.ChaincodeStubInterface, args []string, txnID string) sc.Response {\n\tfmt.Println(\"UpdateStatus Initial\")\n\tfmt.Println(args)\n\texistingClaimAsBytes, _ := APIstub.GetState(args[0])\n\n\tclaim := Claim{}\n\tjson.Unmarshal(existingClaimAsBytes, &claim)\n\n\tclaim.Status = args[1]\n\n\tclaimAsBytes, _ := json.Marshal(claim)\n\tAPIstub.PutState(args[0], claimAsBytes)\n\n\ttimestamp, _ := APIstub.GetTxTimestamp()\n\ttimestampAsInt := timestamp.GetSeconds()\n\tisotimestamp := time.Unix(timestampAsInt, 0).Format(time.RFC3339)\n\ttxnDetails := []string{txnID, \"CSU - Claim Status Update\", isotimestamp, args[1], claim.ID}\n\tfmt.Println(txnDetails)\n\tfmt.Println(txn.Add(APIstub, txnDetails))\n\ttxn.Add(APIstub, txnDetails)\n\treturn shim.Success(claimAsBytes)\n\n}", "func (b *ClusterBuilder) Status(value *ClusterStatusBuilder) *ClusterBuilder {\n\tb.status = value\n\tif value != nil {\n\t\tb.bitmap_ |= 549755813888\n\t} else {\n\t\tb.bitmap_ &^= 549755813888\n\t}\n\treturn b\n}", "func (sry *Sryun) Status(user *model.User, repo *model.Repo, build *model.Build, link string) error {\n\treturn nil\n}", "func (m *IndustryDataRunActivity) SetStatus(value *IndustryDataActivityStatus)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "func (ktu *KqiTargetUpdate) SetStatus(b bool) *KqiTargetUpdate {\n\tktu.mutation.SetStatus(b)\n\treturn ktu\n}", "func (r *ReferenceAdapter) StatusUpdate() error {\n\terr := r.kubeClient.Status().Update(context.TODO(), r.ProjectReference)\n\tif err != nil {\n\t\treturn operrors.Wrap(err, fmt.Sprintf(\"failed to update ProjectReference status of %s\", r.ProjectReference.Name))\n\t}\n\n\treturn nil\n}", "func (m *SynchronizationJob) SetStatus(value SynchronizationStatusable)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "func (d *Device) SetStatus(status status.FieldDeviceStatus) { d.status = status }", "func (sou *SubjectsOfferedUpdate) SetSTATUS(b bool) *SubjectsOfferedUpdate {\n\tsou.mutation.SetSTATUS(b)\n\treturn sou\n}", "func (s *SchedulerSpec) UpdateStatus(rsrc interface{}, reconciled []ResourceInfo, err error) {\n\tstatus := rsrc.(*AirflowClusterStatus)\n\tstatus.Scheduler = SchedulerStatus{}\n\tif s != nil {\n\t\tstatus.Scheduler.Resources.update(reconciled, err)\n\t\tif status.Scheduler.Resources.Status != StatusReady {\n\t\t\tstatus.Status = StatusInProgress\n\t\t}\n\t}\n}", "func (client MockStatusClient) Update(context ctx.Context, object ctrlClient.Object, options ...ctrlClient.UpdateOption) error {\n\tkindKey, err := buildKindKey(object)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient.rawClient.fillInMaps(kindKey)\n\n\tjsonData, err := json.Marshal(object)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tobjectKey, err := buildJSONObjectKey(jsonData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = client.rawClient.checkPresence(kindKey, objectKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texistingObject := client.rawClient.data[kindKey][objectKey]\n\n\tnewObject := make(map[string]interface{})\n\terr = json.Unmarshal(jsonData, &newObject)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texistingObject[\"status\"] = newObject[\"status\"]\n\tclient.rawClient.data[kindKey][objectKey] = existingObject\n\n\treturn nil\n}", "func (m *WorkbookOperation) SetStatus(value *WorkbookOperationStatus)() {\n m.status = value\n}", "func (driver *MesosExecutorDriver) SendStatusUpdate(taskStatus *mesosproto.TaskStatus) (mesosproto.Status, error) {\n\tlog.Infoln(\"Sending status update\")\n\n\tdriver.mutex.Lock()\n\tdefer driver.mutex.Unlock()\n\n\tif taskStatus.GetState() == mesosproto.TaskState_TASK_STAGING {\n\t\tlog.Errorf(\"Executor is not allowed to send TASK_STAGING status update. Aborting!\\n\")\n\t\tdriver.Abort()\n\t\terr := fmt.Errorf(\"Attempted to send TASK_STAGING status update\")\n\t\tdriver.Executor.Error(driver, err.Error())\n\t\treturn driver.status, err\n\t}\n\n\t// Set up status update.\n\tupdate := driver.makeStatusUpdate(taskStatus)\n\tlog.Infof(\"Executor sending status update %v\\n\", update.String())\n\n\t// Capture the status update.\n\tdriver.updates[uuid.UUID(update.GetUuid()).String()] = update\n\n\t// Put the status update in the message.\n\tmessage := &mesosproto.StatusUpdateMessage{\n\t\tUpdate: update,\n\t\tPid: proto.String(driver.self.String()),\n\t}\n\t// Send the message.\n\tif err := driver.messenger.Send(driver.slaveUPID, message); err != nil {\n\t\tlog.Errorf(\"Failed to send %v: %v\\n\")\n\t\treturn driver.status, err\n\t}\n\treturn driver.status, nil\n}", "func (client *Client) ServiceStatus(request *ServiceStatusRequest) (response *ServiceStatusResponse, err error) {\nresponse = CreateServiceStatusResponse()\nerr = client.DoAction(request, response)\nreturn\n}", "func (svc *Service) updateContractStatus(ctx context.Context, req *apistructs.UpdateContractReq, client *apistructs.ClientModel, access *apistructs.APIAccessesModel,\n\tcontract *apistructs.ContractModel) error {\n\torg, err := svc.getOrg(context.Background(), req.OrgID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to GetOrg\")\n\t}\n\n\tif req.Body.Status == nil {\n\t\treturn nil\n\t}\n\n\t// do something depends on contract status\n\tstatus := req.Body.Status.ToLower()\n\tswitch status {\n\tcase apistructs.ContractApproved:\n\t\t// the manager change the contract status to \"approved\", call the api-gateway to grant to the client\n\t\tif err := bdl.Bdl.GrantEndpointToClient(strconv.FormatUint(req.OrgID, 10), req.Identity.UserID,\n\t\t\tclient.ClientID, access.EndpointID); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase apistructs.ContractDisapproved:\n\t\t// do nothing with api-gateway\n\tcase apistructs.ContractUnapproved:\n\t\t// call the api-gateway to revoke the grant\n\t\tif err := bdl.Bdl.RevokeEndpointFromClient(strconv.FormatUint(req.OrgID, 10), req.Identity.UserID,\n\t\t\tclient.ClientID, access.EndpointID); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn errors.New(\"invalid contract status\")\n\t}\n\n\ttimeNow := time.Now()\n\ttx := dbclient.Tx()\n\tdefer tx.RollbackUnlessCommitted()\n\n\tif err := tx.Model(contract).\n\t\tWhere(map[string]interface{}{\"org_id\": req.OrgID, \"id\": req.URIParams.ContractID}).\n\t\tUpdates(map[string]interface{}{\"status\": status, \"updated_at\": timeNow}).\n\t\tError; err != nil {\n\t\treturn errors.Wrap(err, \"failed to Updates contractModel\")\n\t}\n\n\taction := status2Action(status)\n\tif err := tx.Create(&apistructs.ContractRecordModel{\n\t\tID: 0,\n\t\tOrgID: req.OrgID,\n\t\tContractID: contract.ID,\n\t\tAction: fmt.Sprintf(\"%s对该调用申请的授权\", action),\n\t\tCreatorID: req.Identity.UserID,\n\t\tCreatedAt: timeNow,\n\t}).Error; err != nil {\n\t\treturn errors.Wrap(err, \"failed to Create contractRecordModel\")\n\t}\n\n\ttx.Commit()\n\n\t// notification by mail and in-site letter\n\tgo svc.contractMsgToUser(req.OrgID, contract.CreatorID, access.AssetName, client,\n\t\tsvc.ApprovalResultFromStatus(ctx, status, org.Locale))\n\n\treturn nil\n}", "func (s *FlowerSpec) UpdateStatus(rsrc interface{}, reconciled []ResourceInfo, err error) {\n\tstatus := rsrc.(*AirflowClusterStatus)\n\tstatus.Flower = ComponentStatus{}\n\tif s != nil {\n\t\tstatus.Flower.update(reconciled, err)\n\t\tif status.Flower.Status != StatusReady {\n\t\t\tstatus.Status = StatusInProgress\n\t\t}\n\t}\n}", "func (c *Controller) updateStatus(name types.NamespacedName, update func(status *CmdStatus), stillHasSameProcNum func() bool) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tif !stillHasSameProcNum() {\n\t\treturn\n\t}\n\n\tcmd, ok := c.updateCmds[name]\n\tif !ok {\n\t\treturn\n\t}\n\n\tupdate(&cmd.Status)\n\n\terr := c.client.Status().Update(c.globalCtx, cmd)\n\tif err != nil && !apierrors.IsNotFound(err) {\n\t\tc.st.Dispatch(store.NewErrorAction(fmt.Errorf(\"syncing to apiserver: %v\", err)))\n\t\treturn\n\t}\n\n\tc.st.Dispatch(local.NewCmdUpdateStatusAction(cmd))\n}", "func (m *ConnectorStatusDetails) SetStatus(value *ConnectorHealthState)() {\n err := m.GetBackingStore().Set(\"status\", value)\n if err != nil {\n panic(err)\n }\n}", "func (sh *StatusHandler) Status(ctx context.Context, in *empty.Empty, out *proto.StatusResponse) error {\n\tout.OK = true\n\tout.Address = sh.address\n\n\treturn nil\n}", "func (r *NodeReconciler) updateStatus(ctx context.Context, node *filecoinv1alpha1.Node) error {\n\t// TODO: update after multi-client support\n\tnode.Status.Client = \"lotus\"\n\n\tif err := r.Status().Update(ctx, node); err != nil {\n\t\tr.Log.Error(err, \"unable to update filecoin node status\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *Client) UpdateStatus(ctx context.Context, obj client.Object, state alertmanagerv1alpha1.State, requeueTime ...float64) (ctrl.Result, error) {\n\tlog := log.Logger(ctx, \"controllers.common\", \"common\", \"UpdateStatus\")\n\n\tif err := r.Status().Update(ctx, obj); err != nil {\n\t\tlog.Error(err, \"Unable to update status\", \"status\", state)\n\t\tr.Recorder.Event(obj, v1.EventTypeWarning, string(alertmanagerv1alpha1.Error), \"Unable to create/update status due to error \"+err.Error())\n\t\treturn ctrl.Result{RequeueAfter: 30 * time.Second}, nil\n\t}\n\n\tif state != alertmanagerv1alpha1.Error {\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\t//if wait time is specified, requeue it after provided time\n\tif len(requeueTime) == 0 {\n\t\trequeueTime[0] = 0\n\t}\n\n\tlog.Info(\"Requeue time\", \"time\", requeueTime[0])\n\treturn ctrl.Result{RequeueAfter: time.Duration(requeueTime[0]) * time.Millisecond}, nil\n}", "func (w *ServerInterfaceWrapper) UpdateUserStatus(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"id\" -------------\n\tvar id int\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"id\", ctx.Param(\"id\"), &id)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter id: %s\", err))\n\t}\n\n\tctx.Set(\"OAuth.Scopes\", []string{\"\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.UpdateUserStatus(ctx, id)\n\treturn err\n}", "func (v1 *EndpointsV1) GenStatusEndpoint(r *http.Request) interface{} {\n\treturn Status{\n\t\tStatus: \"ok\",\n\t\tName: \"Goscout\",\n\t\tVersion: gitVersion(),\n\t\tServerTime: time.Now().String(),\n\t\tServerTimeEpoch: time.Now().UnixNano() / int64(time.Millisecond),\n\t\tAPIEnabled: true,\n\t\tCareportalEnabled: true,\n\t\tBoluscalcEnabled: true,\n\t\tSettings: &StatusSettings{},\n\t\tExtendedSettings: &StatusExtendedSettings{\n\t\t\tDeviceStatus: struct {\n\t\t\t\tAdvanced bool `json:\"advanced\"`\n\t\t\t}{\n\t\t\t\tAdvanced: true,\n\t\t\t},\n\t\t},\n\t\tAuthorized: nil,\n\t}\n}", "func (r *reflectedStatusAccessor) SetStatus(status interface{}) {\n\tif r != nil && r.status.IsValid() && r.status.CanSet() {\n\t\tr.status.Set(reflect.ValueOf(status))\n\t}\n}", "func (o *Cause) UnsetStatus() {\n\to.Status.Unset()\n}", "func (r *ClusterPollRequest) Status(value int) *ClusterPollRequest {\n\tr.statuses = append(r.statuses, value)\n\treturn r\n}", "func (service *PrivateLinkService) SetStatus(status genruntime.ConvertibleStatus) error {\n\t// If we have exactly the right type of status, assign it\n\tif st, ok := status.(*PrivateLinkService_STATUS_PrivateLinkService_SubResourceEmbedded); ok {\n\t\tservice.Status = *st\n\t\treturn nil\n\t}\n\n\t// Convert status to required version\n\tvar st PrivateLinkService_STATUS_PrivateLinkService_SubResourceEmbedded\n\terr := status.ConvertStatusTo(&st)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to convert status\")\n\t}\n\n\tservice.Status = st\n\treturn nil\n}", "func InstanceViewStatus_STATUSGenerator() gopter.Gen {\n\tif instanceViewStatus_STATUSGenerator != nil {\n\t\treturn instanceViewStatus_STATUSGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddIndependentPropertyGeneratorsForInstanceViewStatus_STATUS(generators)\n\tinstanceViewStatus_STATUSGenerator = gen.Struct(reflect.TypeOf(InstanceViewStatus_STATUS{}), generators)\n\n\treturn instanceViewStatus_STATUSGenerator\n}", "func UpdateStatus(db gorp.SqlExecutor, id int64, status string) error {\n\t_, err := db.Exec(\"UPDATE cds_migration SET status = $1 WHERE id = $2\", status, id)\n\treturn err\n}", "func (s *PostgresSpec) UpdateStatus(rsrc interface{}, reconciled []ResourceInfo, err error) {\n\tstatus := rsrc.(*AirflowBaseStatus)\n\tstatus.Postgres = ComponentStatus{}\n\tif s != nil {\n\t\tstatus.Postgres.update(reconciled, err)\n\t\tif status.Postgres.Status != StatusReady {\n\t\t\tstatus.Status = StatusInProgress\n\t\t}\n\t}\n}", "func (c *scheduledJobs) UpdateStatus(job *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {\n\tresult = &batch.ScheduledJob{}\n\terr = c.r.Put().Namespace(c.ns).Resource(\"scheduledjobs\").Name(job.Name).SubResource(\"status\").Body(job).Do().Into(result)\n\treturn\n}", "func (c *Client) Status() error {\n\tclient, err := c.client(false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trel, err := url.Parse(\"status\")\n\tif err != nil {\n\t\t// This indicates a programming error.\n\t\tpanic(err)\n\t}\n\n\tresp, err := client.Get(c.baseURL.ResolveReference(rel).String())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusNoContent {\n\t\treturn ErrInvalidServiceBehavior\n\t}\n\treturn nil\n}", "func (pu *ProfileUpdate) SetStatus(b bool) *ProfileUpdate {\n\tpu.mutation.SetStatus(b)\n\treturn pu\n}", "func Status(status string) error {\n\treturn SdNotify(\"STATUS=\" + status)\n}", "func (v *Status) Update() error {\n\treturn nil\n}", "func VirtualMachinePatchStatus_STATUSGenerator() gopter.Gen {\n\tif virtualMachinePatchStatus_STATUSGenerator != nil {\n\t\treturn virtualMachinePatchStatus_STATUSGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddRelatedPropertyGeneratorsForVirtualMachinePatchStatus_STATUS(generators)\n\tvirtualMachinePatchStatus_STATUSGenerator = gen.Struct(reflect.TypeOf(VirtualMachinePatchStatus_STATUS{}), generators)\n\n\treturn virtualMachinePatchStatus_STATUSGenerator\n}", "func (r *ChartReconciler) UpdateStatus(c *stablev1.Chart) error {\n\tif err := r.Status().Update(ctx, c); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (puo *PostUpdateOne) SetStatus(i int8) *PostUpdateOne {\n\tpuo.mutation.ResetStatus()\n\tpuo.mutation.SetStatus(i)\n\treturn puo\n}", "func (suite *TestManagerSuite) TestManagerUpdateStatus() {\n\tl, err := suite.m.GetBy(\"d1000\", \"ruuid\", []string{v1.MimeTypeNativeReport})\n\trequire.NoError(suite.T(), err)\n\trequire.Equal(suite.T(), 1, len(l))\n\n\toldSt := l[0].Status\n\n\terr = suite.m.UpdateStatus(\"tid001\", job.SuccessStatus.String(), 10000)\n\trequire.NoError(suite.T(), err)\n\n\tl, err = suite.m.GetBy(\"d1000\", \"ruuid\", []string{v1.MimeTypeNativeReport})\n\trequire.NoError(suite.T(), err)\n\trequire.Equal(suite.T(), 1, len(l))\n\n\tassert.NotEqual(suite.T(), oldSt, l[0].Status)\n\tassert.Equal(suite.T(), job.SuccessStatus.String(), l[0].Status)\n}", "func Sku_STATUSGenerator() gopter.Gen {\n\tif sku_STATUSGenerator != nil {\n\t\treturn sku_STATUSGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddIndependentPropertyGeneratorsForSku_STATUS(generators)\n\tsku_STATUSGenerator = gen.Struct(reflect.TypeOf(Sku_STATUS{}), generators)\n\n\treturn sku_STATUSGenerator\n}", "func (pu *PostUpdate) SetStatus(i int8) *PostUpdate {\n\tpu.mutation.ResetStatus()\n\tpu.mutation.SetStatus(i)\n\treturn pu\n}", "func (s *eremeticScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus) {\n\tid := status.TaskId.GetValue()\n\n\tlog.Debugf(\"Received task status [%s] for task [%s]\", status.State.String(), id)\n\n\ttask, err := database.ReadTask(id)\n\tif err != nil {\n\t\tlog.Debugf(\"Error reading task from database: %s\", err)\n\t}\n\n\tif task.ID == \"\" {\n\t\ttask = types.EremeticTask{\n\t\t\tID: id,\n\t\t\tSlaveId: status.SlaveId.GetValue(),\n\t\t}\n\t}\n\n\tif !task.IsRunning() && *status.State == mesos.TaskState_TASK_RUNNING {\n\t\tTasksRunning.Inc()\n\t}\n\n\tif types.IsTerminal(status.State) {\n\t\tTasksTerminated.With(prometheus.Labels{\"status\": status.State.String()}).Inc()\n\t\tif task.WasRunning() {\n\t\t\tTasksRunning.Dec()\n\t\t}\n\t}\n\n\ttask.UpdateStatus(types.Status{\n\t\tStatus: status.State.String(),\n\t\tTime: time.Now().Unix(),\n\t})\n\n\tif *status.State == mesos.TaskState_TASK_FAILED && !task.WasRunning() {\n\t\tif task.Retry >= maxRetries {\n\t\t\tlog.Warnf(\"giving up on %s after %d retry attempts\", id, task.Retry)\n\t\t} else {\n\t\t\tlog.Infof(\"task %s was never running. re-scheduling\", id)\n\t\t\ttask.UpdateStatus(types.Status{\n\t\t\t\tStatus: mesos.TaskState_TASK_STAGING.String(),\n\t\t\t\tTime: time.Now().Unix(),\n\t\t\t})\n\t\t\ttask.Retry++\n\t\t\tgo func() {\n\t\t\t\tQueueSize.Inc()\n\t\t\t\ts.tasks <- id\n\t\t\t}()\n\t\t}\n\t}\n\n\tif types.IsTerminal(status.State) {\n\t\thandler.NotifyCallback(&task)\n\t}\n\n\tdatabase.PutTask(&task)\n}" ]
[ "0.666095", "0.64349437", "0.6427738", "0.63504577", "0.62834543", "0.6276046", "0.6201595", "0.62010163", "0.6190228", "0.6185797", "0.61781645", "0.6126541", "0.61198777", "0.60840464", "0.6035984", "0.60255826", "0.6014519", "0.59933907", "0.5983749", "0.59777385", "0.59768015", "0.59515554", "0.5935099", "0.5919977", "0.5919475", "0.5909317", "0.5879772", "0.5870554", "0.58691806", "0.58649725", "0.5862507", "0.5861617", "0.586128", "0.5849553", "0.58479804", "0.58371496", "0.5834113", "0.5822966", "0.5808145", "0.5802814", "0.5785198", "0.57848865", "0.5777521", "0.577482", "0.576815", "0.57643604", "0.5755624", "0.57442135", "0.574397", "0.5738589", "0.57320863", "0.5726263", "0.57234526", "0.57191944", "0.5712375", "0.5711899", "0.5710525", "0.57086426", "0.5704833", "0.57024276", "0.57019603", "0.5694037", "0.5686454", "0.56770617", "0.56769884", "0.5675537", "0.5673012", "0.5671908", "0.56677425", "0.5667493", "0.56674004", "0.5662897", "0.5661954", "0.5659655", "0.56530696", "0.5652071", "0.5646315", "0.5644726", "0.56401825", "0.5635858", "0.56342417", "0.5632932", "0.56271213", "0.5624301", "0.5623432", "0.5622863", "0.5622168", "0.561859", "0.5618333", "0.560474", "0.5600741", "0.5596444", "0.5588773", "0.5578216", "0.55640596", "0.5561014", "0.5560275", "0.55561465", "0.5547704", "0.55467546", "0.55455536" ]
0.0
-1
Delete takes name of the cloudwatchEventTarget and deletes it. Returns an error if one occurs.
func (c *FakeCloudwatchEventTargets) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewDeleteAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{}) return err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e *EventAPI) Delete(name string) error {\n\treturn e.client.httpDELETE(e.backOffConf.create(), e.eventURL(name), \"unable to delete event type\")\n}", "func (w *Watcher) DeleteTarget(targetName string) (error) {\n\tmutableMutex.Lock()\n\tdefer mutableMutex.Unlock()\n\tif w.TargetMap == nil {\n\t\tw.TargetMap = make(map[string]*Target)\n\t}\n\t_, ok := w.TargetMap[targetName]\n\tif !ok {\n\t\treturn errors.Errorf(\"not exist domain\")\n\t}\n\tdelete(w.TargetMap, targetName)\n\treturn nil\n}", "func Delete(name string) error {\n\tprofile := &performancev2.PerformanceProfile{}\n\tif err := testclient.Client.Get(context.TODO(), types.NamespacedName{Name: name}, profile); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tif err := testclient.Client.Delete(context.TODO(), profile); err != nil {\n\t\treturn err\n\t}\n\tkey := client.ObjectKey{\n\t\tName: name,\n\t}\n\treturn WaitForDeletion(key, 2*time.Minute)\n}", "func (r *ScanRequest) Delete(*cloudformationevt.Event, *runtime.Context) error {\n return nil\n}", "func Delete(name string) error {\n\treturn <-delete(name)\n}", "func (s *serverMetricsRecorder) DeleteNamedMetric(name string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tdelete(s.state.NamedMetrics, name)\n}", "func (r *ProjectsTraceSinksService) Delete(nameid string) *ProjectsTraceSinksDeleteCall {\n\tc := &ProjectsTraceSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.nameid = nameid\n\treturn c\n}", "func (app *frame) Delete(name string) error {\n\tif app.isStopped {\n\t\treturn nil\n\t}\n\n\tif _, ok := app.variables[name]; !ok {\n\t\tstr := fmt.Sprintf(\"variable: the name variable (%s) is not defined\", name)\n\t\treturn errors.New(str)\n\t}\n\n\tdelete(app.variables, name)\n\treturn nil\n}", "func (r *DeviceManagementAutopilotEventRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func Delete(name string) {\n\tkt.Remove(name)\n}", "func (ep *eventsProvider) DeleteByName(name string) error {\n\tindices, _ := ep.findByName(name)\n\tif len(indices) == 0 {\n\t\treturn nil\n\t}\n\n\tfor len(indices) != 0 {\n\t\tep.mutex.Lock()\n\t\tep.Data = append(ep.Data[:indices[0]], ep.Data[indices[0]+1:]...)\n\t\tep.mutex.Unlock()\n\t\tindices, _ = ep.findByName(name)\n\t}\n\n\treturn nil\n}", "func (c *FakeCloudwatchEventTargets) Get(name string, options v1.GetOptions) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (r *ProjectsLocationsProcessesRunsLineageEventsService) Delete(name string) *ProjectsLocationsProcessesRunsLineageEventsDeleteCall {\n\tc := &ProjectsLocationsProcessesRunsLineageEventsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func deleteEvent(key model.Key) api.WatchEvent {\n\treturn api.WatchEvent{\n\t\tType: api.WatchDeleted,\n\t\tOld: &model.KVPair{\n\t\t\tKey: key,\n\t\t\tValue: uuid.NewString(),\n\t\t\tRevision: uuid.NewString(),\n\t\t},\n\t}\n}", "func (svc *Service) Delete(ownerID string, eventID string) error {\n\t_, err := svc.client.Delete(fmt.Sprintf(\"%s/%s\", eventsURL(ownerID), eventID))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Unable to perform Update\")\n\t}\n\treturn nil\n}", "func (r *DeviceManagementTroubleshootingEventRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (s *TargetCRUD) Delete(arg ...crud.Arg) (crud.Arg, error) {\n\tevent := eventFromArg(arg[0])\n\ttarget := targetFromStuct(event)\n\tprint.DeletePrintln(\"deleting target\", *target.Target.Target,\n\t\t\"from upstream\", *target.Upstream.ID)\n\treturn target, nil\n}", "func (c *k8sClient) OnDelete(obj interface{}) {\n\tselect {\n\tcase c.eventCh <- obj:\n\tdefault:\n\t}\n}", "func Delete(c *golangsdk.ServiceClient, id string) (r DeleteResult) {\n\turl := resourceURL(c, id)\n\t//fmt.Printf(\"Delete listener url: %s.\\n\", url)\n\t_, r.Err = c.Delete(url, &golangsdk.RequestOpts{\n\t\tOkCodes: []int{204},\n\t})\n\treturn\n}", "func (c *peer) Delete(name string) error {\n\tkey := path.Join(c.prefix, name)\n\treturn c.store.Del(key)\n}", "func (s *serverMetricsRecorder) DeleteNamedUtilization(name string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tdelete(s.state.Utilization, name)\n}", "func (c *client) Delete(ctx context.Context, name string) error {\n\tlcn, err := c.Get(ctx, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(*lcn) == 0 {\n\t\treturn fmt.Errorf(\"Location [%s] not found\", name)\n\t}\n\n\trequest, err := c.getLocationRequest(wssdcloudcommon.Operation_DELETE, name, &(*lcn)[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.LocationAgentClient.Invoke(ctx, request)\n\n\treturn err\n}", "func (es *EventService) Delete(eventID string) error {\n\t// DELETE: /event/:eventID\n\treq, err := es.c.NewRequest(\"DELETE\", \"/event/\"+eventID, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn es.c.Do(req, nil)\n}", "func (c *googleCloudStorageSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"googlecloudstoragesources\").\n\t\tName(name).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *client) Delete(ctx context.Context, group, name string) error {\n\tvm, err := c.Get(ctx, group, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(*vm) == 0 {\n\t\treturn fmt.Errorf(\"Virtual Machine [%s] not found\", name)\n\t}\n\n\trequest, err := c.getVirtualMachineRequest(wssdcloudproto.Operation_DELETE, group, name, &(*vm)[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.VirtualMachineAgentClient.Invoke(ctx, request)\n\n\treturn err\n}", "func Delete(client *gophercloud.ServiceClient, name string) os.DeleteResult {\n\treturn os.Delete(client, name)\n}", "func DeleteMessage(regInfo *RegistrationInfo, receiptHandle *string) error {\n\tsvc := getSQSClient(regInfo)\n\n\tlogging.Debug(\"Deleting the event from SQS.\", nil)\n\tparams := &sqs.DeleteMessageInput{\n\t\tQueueUrl: &regInfo.ActionQueueEndpoint,\n\t\tReceiptHandle: receiptHandle,\n\t}\n\t_, err := svc.DeleteMessage(params)\n\n\tif err != nil {\n\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t// Message from an error.\n\t\tlogging.Error(\"Could not delete the event.\", logging.Fields{\"error\": err})\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (t Timers) Delete(k string) {\n\tdelete(t, k)\n}", "func (c *ControlPlaneClient) Delete(ctx context.Context, location, name string) error {\n\treturn c.internal.Delete(ctx, location, name)\n}", "func (els *EventLocalStore) Delete(id string) error {\n\tels.mutex.Lock()\n\tdefer els.mutex.Unlock()\n\n\tif _, ok := els.events[id]; ok {\n\t\tdelete(els.events, id)\n\t\treturn nil\n\t}\n\n\treturn event.ErrEventNotFound\n}", "func DeleteFor(source collection.Schema, name resource.FullName, v resource.Version) Event {\n\treturn DeleteForResource(source, &resource.Instance{\n\t\tMetadata: resource.Metadata{\n\t\t\tFullName: name,\n\t\t\tVersion: v,\n\t\t},\n\t})\n}", "func (km *Keystore) Delete(name string) error {\n\tif err := validateName(name); err != nil {\n\t\treturn err\n\t}\n\treturn km.ds.Delete(ds.NewKey(name))\n}", "func (c *client) Delete(ctx context.Context, group, name string) error {\n\tid, err := c.Get(ctx, group, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(*id) == 0 {\n\t\treturn fmt.Errorf(\"Identity [%s] not found\", name)\n\t}\n\n\trequest, err := getIdentityRequest(wssdcloudcommon.Operation_DELETE, name, &(*id)[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.IdentityAgentClient.Invoke(ctx, request)\n\treturn err\n}", "func (vfs *volatileVFS) Delete(name string) C.int {\n\tvfs.mu.Lock()\n\tdefer vfs.mu.Unlock()\n\n\tfile, ok := vfs.files[name]\n\tif !ok {\n\t\tvfs.errno = C.ENOENT\n\t\treturn C.SQLITE_IOERR_DELETE_NOENT\n\t}\n\n\t// Check that there are no consumers of this file.\n\tfor iFd := range vfs.fds {\n\t\tif vfs.fds[iFd] == file {\n\t\t\tvfs.errno = C.EBUSY\n\t\t\treturn C.SQLITE_IOERR_DELETE\n\t\t}\n\t}\n\n\tdelete(vfs.files, name)\n\n\treturn C.SQLITE_OK\n}", "func Delete(rw http.ResponseWriter, r *http.Request) {\n\t// Get userID and eventID\n\tuserID := r.Header.Get(\"userid\")\n\turlParams := strings.Replace(r.URL.String(), \"/api/deleteEvent/\", \"\", 1)\n\teventID := strings.Split(urlParams, \"/\")[0]\n\n\t// eventID must not be empty\n\tif strings.TrimSpace(eventID) == \"\" {\n\t\tlog.Printf(\"Missing event id to delete\\n\")\n\t\trw.WriteHeader(http.StatusBadRequest)\n\t\trw.Write([]byte(\"Event ID must be provided\"))\n\t\treturn\n\t}\n\n\t// Delete from DB\n\tquery := `DELETE\n\t\tFROM events\n\t\tWHERE id = $1\n\t\tAND owner_id = $2`\n\n\tres, err := conn.DB.Exec(query, eventID, userID)\n\tif err != nil {\n\t\tlog.Printf(\"Error deleting event: %s\\n\", err)\n\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\trw.Write([]byte(\"Error deleting event\"))\n\t\treturn\n\t}\n\n\tif count, err := res.RowsAffected(); err != nil || count == 0 {\n\t\tlog.Printf(\"Error deleting event, count: %d, err: %s\\n\", count, err)\n\t\trw.WriteHeader(http.StatusInternalServerError)\n\t\trw.Write([]byte(\"Error deleting event\"))\n\t\treturn\n\t}\n\n\tlog.Println(\"Event deleted\")\n\trw.WriteHeader(http.StatusOK)\n\trw.Write([]byte(\"Event deleted\"))\n}", "func (e *Event) Delete(c echo.Context, id int) error {\n\tevent, err := e.udb.View(e.db, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// if err := e.rbac.IsLowerRole(c, event.Role.AccessLevel); err != nil {\n\t// \treturn err\n\t// }\n\treturn e.udb.Delete(e.db, event)\n}", "func DeleteEvent(q Query, c chan error) {\n\tresult, err := Session.Run(`\n\t\tMATCH(n:EVENT)-[r]->(a)\n\t\tWHERE n.`+q.Key+`=$val\n\t\tDETACH DELETE n, a\n\t`, map[string]interface{}{\n\t\t\"val\": q.Value,\n\t})\n\tif err != nil {\n\t\tc <- err\n\t}\n\n\tresult.Next()\n\tlog.Println(result.Record())\n\n\tif err = result.Err(); err != nil {\n\t\tc <- err\n\t\treturn\n\t}\n\tlog.Println(\"Event deleted\")\n\tc <- nil\n\treturn\n}", "func Deleteevent(collection *mongo.Collection, st string) {\n\n\tfilter := bson.D{primitive.E{Key: \"eventsname\", Value: st}}\n\tdeleteResult, err := collection.DeleteOne(context.TODO(), filter)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"Deleted %v documents in the events collection\\n\", deleteResult.DeletedCount)\n}", "func (b *Bucket) Delete(_ context.Context, name string) error {\n\tdelete(b.objects, name)\n\treturn nil\n}", "func (s *Synk) Delete(ctx context.Context, name string) error {\n\tpolicy := metav1.DeletePropagationForeground\n\tdeleteOpts := metav1.DeleteOptions{PropagationPolicy: &policy}\n\treturn s.client.Resource(resourceSetGVR).DeleteCollection(ctx, deleteOpts, metav1.ListOptions{\n\t\tLabelSelector: fmt.Sprintf(\"name=%s\", name),\n\t})\n}", "func (c *client) Delete(ctx context.Context, group, name string) error {\n\tvnet, err := c.Get(ctx, group, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(*vnet) == 0 {\n\t\treturn fmt.Errorf(\"Virtual Network [%s] not found\", name)\n\t}\n\n\trequest, err := getVirtualNetworkRequest(wssdcloudcommon.Operation_DELETE, group, name, &(*vnet)[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.VirtualNetworkAgentClient.Invoke(ctx, request)\n\n\treturn err\n}", "func Remove(name string) error", "func (b *Bucket) Delete(ctx context.Context, name string) error {\n\treturn b.bkt.Object(name).Delete(ctx)\n}", "func (t *FakeObjectTracker) Delete(gvr schema.GroupVersionResource, ns, name string) error {\n\treturn nil\n}", "func (d *Double) Delete(stackName string) error {\n\treturn d.DeleteFn(stackName)\n}", "func (c *EventClient) Delete() *EventDelete {\n\tmutation := newEventMutation(c.config, OpDelete)\n\treturn &EventDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (e *EnqueueRequestForNamespaces) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface) {\n\te.add(ctx, evt.Object, q)\n}", "func (e *EventMapper) DeleteEvent() {\n\n}", "func (hs *PeerHandleMapSync) Delete(name string) {\n\ths.Lock()\n\t// TODO-WORKSHOP-STEP-5: This code should remove the handle from the PeerHandleMap based on the key name\n\ths.Unlock()\n\tfmt.Println(\"UserHandle Removed for \", name)\n}", "func (c *ResourcesHandler) Delete(event.DeleteEvent, workqueue.RateLimitingInterface) {}", "func (c *client) Delete(_ context.Context, request *blobstore.DeleteRequest) (*blobstore.DeleteResponse, error) {\n\tif err := os.Remove(c.bodyPath(request.Key)); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := os.Remove(c.tagsPath(request.Key)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &blobstore.DeleteResponse{}, nil\n}", "func (c *FakeAWSSNSTargets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteActionWithOptions(awssnstargetsResource, c.ns, name, opts), &v1alpha1.AWSSNSTarget{})\n\n\treturn err\n}", "func (ep *eventsProvider) Delete(id string) error {\n\tind, _ := ep.findByID(id)\n\tif ind == -1 {\n\t\treturn provider.ErrNotExistingEvent\n\t}\n\n\tep.mutex.Lock()\n\tdefer ep.mutex.Unlock()\n\tep.Data = append(ep.Data[:ind], ep.Data[ind+1:]...)\n\n\treturn nil\n}", "func (l *Listeners) Delete(id xid.ID) {\n\n\tl.Lock()\n\tdelete(l.listeners, id)\n\tl.Unlock()\n}", "func (s *fsStore) Delete(typ namespace.Type, name string) error {\n\tif !s.Exists(typ, name) {\n\t\treturn store.ErrNotExists\n\t}\n\ttrgt := s.targetPath(name, typ)\n\terr := unix.Unmount(trgt, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn os.Remove(trgt)\n}", "func (r provisionTokenClient) Delete(ctx context.Context, name string) error {\n\tteleportClient, err := r.TeleportClientAccessor(ctx)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\treturn trace.Wrap(teleportClient.DeleteToken(ctx, name))\n}", "func (e *ContainerService) Delete(name string) (err error) {\n\turl := fmt.Sprintf(\"containers/%s\", name)\n\terr = e.client.magicRequestDecoder(\"DELETE\", url, nil, nil)\n\treturn\n}", "func (r *AWSMachineTemplateWebhook) ValidateDelete(_ context.Context, _ runtime.Object) error {\n\treturn nil\n}", "func (s impl) Delete(ctx context.Context, name string) error {\n\toperation, err := s.service.SslCertificates.Delete(s.projectID, name).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.waitFor(ctx, operation.Name)\n}", "func (w *wireguardServerConfig) Delete(name string) error {\n\treturn w.store.Del(path.Join(w.prefix, name))\n}", "func (r *ProjectsMetricDescriptorsService) Delete(name string) *ProjectsMetricDescriptorsDeleteCall {\n\tc := &ProjectsMetricDescriptorsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func DeleteKeyValueExpireViaName(iName string) (err error) {\n\tvar has bool\n\tvar _KeyValueExpire = &KeyValueExpire{Name: iName}\n\tif has, err = Engine.Get(_KeyValueExpire); (has == true) && (err == nil) {\n\t\tif row, err := Engine.Where(\"name = ?\", iName).Delete(new(KeyValueExpire)); (err != nil) || (row <= 0) {\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn\n}", "func (c *MetricCollector) Delete(ctx context.Context, namespace, name string) error {\n\tc.collectionsMutex.Lock()\n\tdefer c.collectionsMutex.Unlock()\n\n\tc.logger.Debugf(\"Stopping metric collection of %s/%s\", namespace, name)\n\n\tkey := NewMetricKey(namespace, name)\n\tif _, ok := c.collections[key]; ok {\n\t\tdelete(c.collections, key)\n\t}\n\treturn nil\n}", "func Delete(ctx context.Context, name string) error {\n\tname, ok := extractName(ctx)\n\tif !ok {\n\t\treturn ErrNoTreeAttached\n\t}\n\tmu.Lock()\n\tsvr, ok := trees[name]\n\tmu.Unlock()\n\tif !ok {\n\t\tpanic(\"oversight tree not found\")\n\t}\n\tsvr.Delete(name)\n\treturn nil\n}", "func (c *Collection) DeleteEvent(\n\tkey, typ string, ts time.Time, ordinal int64,\n) error {\n\tpath := fmt.Sprintf(\"%s/%s/events/%s/%d/%d?purge=true\",\n\t\tc.Name, key, typ, ts.UnixNano()/1000000, ordinal)\n\t_, err := c.client.emptyReply(\"DELETE\", path, nil, nil, 204)\n\treturn err\n}", "func GetEventTarget(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EventTargetState, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tvar resource EventTarget\n\terr := ctx.ReadResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (w *Webhook) Delete() error {\n\treturn w.DeleteContext(context.TODO())\n}", "func Delete(name string) error {\n\tlink, err := netlink.LinkByName(name)\n\tif err != nil {\n\t\tif _, ok := err.(netlink.LinkNotFoundError); ok {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\treturn netlink.LinkDel(link)\n}", "func (signup *EventSignup) OnDeleted(container *ioccontainer.Container) error {\n\terr := signup.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar eventRepository EventRepository\n\tcontainer.Make(&eventRepository)\n\n\tevent, err := eventRepository.GetEventByID(signup.EventID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn signup.sendNotification(event, \"member_signed_out\", container)\n}", "func (m *MongoStore) DeleteName(name string) bool {\n\ts := m.session.Clone()\n\tdefer s.Close()\n\tc := s.DB(\"kittenserver\").C(\"kittens\")\n\terr := c.Remove((bson.M{\"name\": name}))\n\treturn err == nil\n}", "func (d *DevClient) DeleteEventHandler(systemKey, name string) error {\n\treturn deleteEventHandler(d, _EVENTS_HDLRS_PREAMBLE+systemKey+\"/\"+name)\n}", "func (d *DevClient) DeleteTrigger(systemKey, name string) error {\n\treturn d.DeleteEventHandler(systemKey, name)\n}", "func (b *Bucket) Delete(_ context.Context, name string) error {\n\treturn b.client.DeleteObject(b.name, name)\n}", "func skykeydeletenamecmd(name string) {\n\terr := httpClient.SkykeyDeleteByNamePost(name)\n\tif err != nil {\n\t\tdie(err)\n\t}\n\n\tfmt.Println(\"Skykey Deleted!\")\n}", "func Delete(deleteSnapshotURL string, snapshotName string) error {\n\tlogger.Infof(\"Deleting snapshot %s\", snapshotName)\n\tformData := url.Values{\n\t\t\"snapshot\": {snapshotName},\n\t}\n\n\tu, err := url.Parse(deleteSnapshotURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := http.PostForm(u.String(), formData)\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\n\tsnap := snapshot{}\n\terr = json.Unmarshal(body, &snap)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif snap.Status == \"ok\" {\n\t\tlogger.Infof(\"Snapshot %s deleted\", snapshotName)\n\t\treturn nil\n\t} else if snap.Status == \"error\" {\n\t\treturn errors.New(snap.Msg)\n\t} else {\n\t\treturn fmt.Errorf(\"Unkown status: %v\", snap.Status)\n\t}\n}", "func (command HelloWorldResource) Delete(ctx context.Context, awsConfig awsv2.Config,\n\tevent *CloudFormationLambdaEvent,\n\tlogger *zerolog.Logger) (map[string]interface{}, error) {\n\trequest := HelloWorldResourceRequest{}\n\n\trequestPropsErr := json.Unmarshal(event.ResourceProperties, &request)\n\tif requestPropsErr != nil {\n\t\treturn nil, requestPropsErr\n\t}\n\tlogger.Info().Msgf(\"delete: %s\", request.Message)\n\treturn nil, nil\n}", "func (r *EventTagsService) Delete(profileId int64, id int64) *EventTagsDeleteCall {\n\tc := &EventTagsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.id = id\n\treturn c\n}", "func (pgs *PGStorage) DeleteEvent(eventUUID uuid.UUID) error {\n\tsql := \"delete from events where uuid = $1\"\n\t_, err := pgs.DB.ExecContext(pgs.Ctx, sql, eventUUID.String())\n\treturn err\n}", "func (m *Medium) Delete(name string) error {\n\tt, ok := m.topics[name]\n\tif !ok {\n\t\treturn fmt.Errorf(\"Cannot delete. No topic named %s.\", name)\n\t}\n\tt.Close()\n\tm.mx.Lock()\n\tdelete(m.topics, name)\n\tm.mx.Unlock()\n\treturn nil\n}", "func (s *Storage) DeleteRequest(id string) error {\n\t// TODO: Unimplemented\n\treturn nil\n}", "func (s *FilesystemStore) Delete(c *kelly.Context, name string) error {\n\tsession, error := s.Get(c, name)\n\tif error != nil {\n\t\treturn error\n\t}\n\tsession.Options.MaxAge = -1\n\treturn s.Save(c, session)\n}", "func (c *GalleryImageClient) Delete(ctx context.Context, location, name string) error {\n\treturn c.internal.Delete(ctx, location, name)\n}", "func (dl *DataLayer) DeleteEvent(id int64) error {\n\t_, err := dl.db.Connection().Exec(deleteEventQuery, id)\n\treturn err\n}", "func (s *serverMetricsRecorder) DeleteRequestCost(name string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tdelete(s.state.RequestCost, name)\n}", "func (c Claims) Del(name string) { delete(c, name) }", "func (ue *UserEvent) Delete(ctx context.Context) *spanner.Mutation {\n\tvalues, _ := ue.columnsToValues(UserEventPrimaryKeys())\n\treturn spanner.Delete(\"UserEvent\", spanner.Key(values))\n}", "func (rl *Instance) DelEvent(keyPress string) {\n\tdelete(rl.evtKeyPress, keyPress)\n}", "func DeleteKeyValueViaName(iName string) (err error) {\n\tvar has bool\n\tvar _KeyValue = &KeyValue{Name: iName}\n\tif has, err = Engine.Get(_KeyValue); (has == true) && (err == nil) {\n\t\tif row, err := Engine.Where(\"name = ?\", iName).Delete(new(KeyValue)); (err != nil) || (row <= 0) {\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn\n}", "func (f *LogFile) DeleteMeasurement(name []byte) error {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\te := LogEntry{Flag: LogEntryMeasurementTombstoneFlag, Name: name}\n\tif err := f.appendEntry(&e); err != nil {\n\t\treturn err\n\t}\n\tf.execEntry(&e)\n\n\t// Flush buffer and sync to disk.\n\treturn f.FlushAndSync()\n}", "func (r *InspectOperationsService) Delete(name string) *InspectOperationsDeleteCall {\n\tc := &InspectOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (c *kongs) Delete(name string, options *v1.DeleteOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"kongs\").\n\t\tName(name).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (h *Handler) Delete(bucket, name string) error {\n\treq := h.Client.DeleteObjectRequest(&s3.DeleteObjectInput{\n\t\tBucket: &bucket,\n\t\tKey: &name,\n\t})\n\n\tresp, err := req.Send(context.Background())\n\tif err != nil {\n\t\tklog.Error(\"Failed to send Delete request. error: \", err)\n\t\treturn err\n\t}\n\n\tklog.V(10).Info(\"Delete Success\", resp)\n\n\treturn nil\n}", "func (c *Collection) Delete(k string) {\n\tc.itemsLock.Lock()\n\tdefer func() {\n\t\tc.itemsLock.Unlock()\n\t\tc.events <- &event.Event{\n\t\t\tTopic: c.Topic(TopicCollectionGone),\n\t\t\tType: event.Type(\"CollectionGone\"),\n\t\t\tID: c.EventID(k),\n\t\t\tMessage: \"Removed from collection\",\n\t\t}\n\t}()\n\tdelete(c.items, k)\n}", "func (store *Engine) DeleteRequest(requestID string) error {\n\t_, err := store.api.\n\t\tURL(\"/workflow-engine/api/v1/requests/%s\", requestID).\n\t\tDelete()\n\n\treturn err\n}", "func (r *ProjectsOccurrencesService) Delete(name string) *ProjectsOccurrencesDeleteCall {\n\tc := &ProjectsOccurrencesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (c *SubresourceClient) Delete(namespace, name string) (e error) {\n\tif c.Error != \"\" {\n\t\te = fmt.Errorf(c.Error)\n\t}\n\treturn\n}", "func (r *ProjectsLocationsDataExchangesService) Delete(name string) *ProjectsLocationsDataExchangesDeleteCall {\n\tc := &ProjectsLocationsDataExchangesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func TestDelete(t *testing.T) {\n\tlocalStore := NewEventLocalStore()\n\n\teventTest1 := &entities.Event{ID: \"id1\"}\n\n\terr := localStore.Create(eventTest1)\n\tassert.NoError(t, err)\n\n\terr = localStore.Delete(\"id1\")\n\tassert.NoError(t, err)\n\n\t// If Event Not Found\n\terr = localStore.Delete(\"\")\n\tassert.Error(t, err)\n\tassert.Equal(t, err, event.ErrEventNotFound)\n}", "func (c *Firewall) Delete(e ...interface{}) error {\n\tnames, nErr := toNames(e)\n\treturn c.ns.Delete(\"\", \"\", c.pather(), names, nErr)\n}", "func (s *baseStore[T, E, TPtr, EPtr]) Delete(ctx context.Context, id int64) error {\n\teventPtr := s.newObjectEvent(ctx, DeleteEvent)\n\teventPtr.SetObjectID(id)\n\treturn s.createObjectEvent(ctx, eventPtr)\n}" ]
[ "0.6356107", "0.57694995", "0.5659969", "0.56342745", "0.5527379", "0.5476646", "0.54259104", "0.5411367", "0.53984815", "0.539605", "0.5359793", "0.5313885", "0.52959067", "0.5263439", "0.5223835", "0.51805806", "0.51521486", "0.51521426", "0.51359683", "0.5103432", "0.50982624", "0.50549585", "0.50073564", "0.50058484", "0.4982527", "0.4975987", "0.49668816", "0.49429354", "0.49229488", "0.49039418", "0.4901857", "0.4893772", "0.4891697", "0.48887163", "0.48878372", "0.48802406", "0.48570284", "0.48514974", "0.48361745", "0.48278424", "0.4821357", "0.48189235", "0.48166552", "0.4801795", "0.47981977", "0.4790594", "0.47874326", "0.4782709", "0.47526518", "0.47518823", "0.4746338", "0.47441825", "0.4720074", "0.47182497", "0.4711298", "0.4707917", "0.47029877", "0.4700136", "0.469894", "0.46850818", "0.46835926", "0.46814305", "0.4676738", "0.46756268", "0.46699747", "0.46550468", "0.46533492", "0.4650932", "0.4649804", "0.4638397", "0.4635854", "0.4634693", "0.4633859", "0.46337646", "0.46322948", "0.46295518", "0.4628367", "0.46196073", "0.46043286", "0.460052", "0.45977747", "0.45920822", "0.45893013", "0.45752734", "0.4575008", "0.4574601", "0.45735598", "0.45698702", "0.4567352", "0.45623115", "0.45610112", "0.4558743", "0.45558193", "0.45525086", "0.45362085", "0.45357656", "0.4528602", "0.45276424", "0.45256478", "0.45251498" ]
0.703014
0
DeleteCollection deletes a collection of objects.
func (c *FakeCloudwatchEventTargets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { action := testing.NewDeleteCollectionAction(cloudwatcheventtargetsResource, c.ns, listOptions) _, err := c.Fake.Invokes(action, &v1alpha1.CloudwatchEventTargetList{}) return err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *kongs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"kongs\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *stewards) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"stewards\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *sandboxes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tResource(\"sandboxes\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *inMemoryProviders) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"inmemoryproviders\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *awsMediaStoreContainers) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsmediastorecontainers\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *demos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"demos\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *rpcServices) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"rpcservices\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (w *ClusterDynamicClient) DeleteCollection(options metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\treturn w.dClient.Resource(w.resource).Namespace(w.namespace).DeleteCollection(w.ctx, options, listOptions)\n}", "func (c *acceptableUsePolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"acceptableusepolicies\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeRabbitmqs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(rabbitmqsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.RabbitmqList{})\n\treturn err\n}", "func (c *interacts) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"interacts\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *awsAutoscalingPolicies) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsautoscalingpolicies\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *cronFederatedHPAs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"cronfederatedhpas\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *cloudFormationTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"cloudformationtemplates\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *staticFabricNetworkAttachments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"staticfabricnetworkattachments\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *meshPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tResource(\"meshpolicies\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *kaosRules) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"kaosrules\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *quarksStatefulSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"quarksstatefulsets\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *snapshotRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"snapshotrules\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *aITrainingJobs) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"aitrainingjobs\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *distccClientClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"distccclientclaims\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *awsServiceDiscoveryServices) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsservicediscoveryservices\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func deleteCollection(c client.Client, collection *kabanerov1alpha1.Collection, reqLogger logr.Logger) error {\n\t// Clean up existing collection assets.\n\terr := cleanupAssets(context.TODO(), collection, c, reqLogger)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Error during cleanup processing.\")\n\t\treturn err\n\t}\n\n\t// Remove the finalizer entry from the instance.\n\terr = removeCollectionFinalizer(context.TODO(), collection, c, reqLogger)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Error while attempting to remove the finalizer.\")\n\t\treturn err\n\t}\n\n\t// Delete the collection.\n\terr = c.Delete(context.TODO(), collection)\n\tif err != nil {\n\t\treqLogger.Error(err, \"Error while attempting to remove the finalizer.\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *FakeRobots) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(robotsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.RobotList{})\n\treturn err\n}", "func (c *sonicwallNetworkPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"sonicwallnetworkpolicies\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *FakeIotDpses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(iotdpsesResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.IotDpsList{})\n\treturn err\n}", "func (c *concurrencyControls) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"concurrencycontrols\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *gitTracks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"gittracks\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeIngressBackends) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(ingressbackendsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.IngressBackendList{})\n\treturn err\n}", "func (c *advancedDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"advanceddeployments\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *awsOrganizationsPolicyAttachments) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsorganizationspolicyattachments\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeQuobyteServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(quobyteservicesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &quobyte_com_v1.QuobyteServiceList{})\n\treturn err\n}", "func (c *Collection) Delete() error {\n\tif c.Name == \"ALL_MEDIA_AUTO_COLLECTION\" {\n\t\treturn ErrAllSaved\n\t}\n\tinsta := c.insta\n\n\tdata, err := json.Marshal(\n\t\tmap[string]string{\n\t\t\t\"_uid\": toString(insta.Account.ID),\n\t\t\t\"_uuid\": insta.uuid,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, _, err = insta.sendRequest(\n\t\t&reqOptions{\n\t\t\tEndpoint: fmt.Sprintf(urlCollectionDelete, c.ID),\n\t\t\tIsPost: true,\n\t\t\tQuery: generateSignature(data),\n\t\t},\n\t)\n\treturn err\n}", "func (c *volumeSnapshotSchedules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"volumesnapshotschedules\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *horizontalPodAutoscalers) DeleteCollection(ctx context.Context, options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\tns := c.getNs(c.ns)\n\terr := c.hpa.DeleteCollection(ctx, options, listOptions)\n\tif err != nil {\n\t\tcode := getStatusCode(err)\n\t\tc.metrics.ClientMetricErrors.WithLabelValues(\"hpa\", \"deletecollection\", \"\", ns, code).Inc()\n\t\treturn err\n\t}\n\tc.metrics.ClientMetricSuccess.WithLabelValues(\"hpa\", \"deletecollection\", \"\", ns).Inc()\n\treturn nil\n}", "func (c *FakeRedisTriggers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(redistriggersResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1beta1.RedisTriggerList{})\n\treturn err\n}", "func (c *klusterlets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tResource(\"klusterlets\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *solrBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"solrbackups\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *userProjectBindings) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tResource(\"userprojectbindings\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *jxTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"jxtasks\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeManagedCertificates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(managedcertificatesResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &networkinggkeiov1.ManagedCertificateList{})\n\treturn err\n}", "func (c *awsSesReceiptRuleSets) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"awssesreceiptrulesets\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeTraefikServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(traefikservicesResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.TraefikServiceList{})\n\treturn err\n}", "func (c *destinationPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"destinationpolicies\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeSystemBackups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(systembackupsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1beta2.SystemBackupList{})\n\treturn err\n}", "func (c *FakeSnatPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewRootDeleteCollectionAction(snatpoliciesResource, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &acisnatv1.SnatPolicyList{})\n\treturn err\n}", "func (c *iperfTasks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"iperftasks\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *routeGroups) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"routegroups\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *kuberhealthyChecks) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"khchecks\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo(context.TODO()).\n\t\tError()\n}", "func (c *previewFeatures) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tResource(\"previewfeatures\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *tiKVGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"tikvgroups\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeDaemonstools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(daemonstoolsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1beta1.DaemonstoolList{})\n\treturn err\n}", "func (c *FakeHelms) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(helmsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.HelmList{})\n\treturn err\n}", "func (c *googleCloudStorageSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"googlecloudstoragesources\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *FakeKuberaBackups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(kuberabackupsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &backuprestorev1.KuberaBackupList{})\n\treturn err\n}", "func (c *FakeGBPServers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(gbpserversResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &aciawv1.GBPServerList{})\n\treturn err\n}", "func (c *networkServicesEndpointPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"networkservicesendpointpolicies\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *FakeExportedServiceSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(exportedservicesetsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &federationv1.ExportedServiceSetList{})\n\treturn err\n}", "func (c *secrets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\n\treturn c.client.Delete().\n\t\tResource(\"secrets\").\n\t\tVersionedParams(listOpts).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *krakenClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"krakenclusters\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeRuleEndpoints) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(ruleendpointsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &rulesv1.RuleEndpointList{})\n\treturn err\n}", "func (c *FakeSpidermans) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(spidermansResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.SpidermanList{})\n\treturn err\n}", "func (c *FakeAwsApiGatewayVpcLinks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(awsapigatewayvpclinksResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &aws_v1.AwsApiGatewayVpcLinkList{})\n\treturn err\n}", "func (c *FakeGlueCatalogTables) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(gluecatalogtablesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.GlueCatalogTableList{})\n\treturn err\n}", "func (c *FakeEndpointsServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(endpointsservicesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.EndpointsServiceList{})\n\treturn err\n}", "func (c *globalThreatFeeds) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tResource(\"globalthreatfeeds\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *FakeAwsIamGroupPolicyAttachments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(awsiamgrouppolicyattachmentsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &aws_v1.AwsIamGroupPolicyAttachmentList{})\n\treturn err\n}", "func (c *customReplicationControllers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"customreplicationcontrollers\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeVaultSecretClaims) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(vaultsecretclaimsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.VaultSecretClaimList{})\n\treturn err\n}", "func (c *FakeAzureEventHubsSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(azureeventhubssourcesResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.AzureEventHubsSourceList{})\n\treturn err\n}", "func (c *FakeClusterImageSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewRootDeleteCollectionAction(clusterimagesetsResource, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &hivev1.ClusterImageSetList{})\n\treturn err\n}", "func (c *FakePrunes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(prunesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.PruneList{})\n\treturn err\n}", "func (c *FakeTraincrds) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(traincrdsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &apisv1.TraincrdList{})\n\treturn err\n}", "func (c *awsIamRolePolicyAttachments) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsiamrolepolicyattachments\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeAcceptableUsePolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(acceptableusepoliciesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha.AcceptableUsePolicyList{})\n\treturn err\n}", "func (c *awsDmsCertificates) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsdmscertificates\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeNetworkConnectivityHubs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(networkconnectivityhubsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1beta1.NetworkConnectivityHubList{})\n\treturn err\n}", "func (impl *ServerServerGroup) DeleteCollection() ([]base.ModelInterface, *base.ErrorResponse) {\n\tvar (\n\t\tname = impl.ResourceName()\n\t\trecordCollection = impl.NewEntityCollection()\n\t\tc = impl.GetConnection()\n\t)\n\n\t// We need transaction to ensure the total and the query count is consistent.\n\ttx := c.Begin()\n\tif err := tx.Error; err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"resource\": name,\n\t\t\t\"error\": err,\n\t\t}).Warn(\"Delete collection in DB failed, start transaction failed.\")\n\t\treturn nil, base.NewErrorResponseTransactionError()\n\t}\n\n\tif err := tx.Where(\"\\\"ServerGroupID\\\" <> ?\", DefaultServerGroupID).Find(recordCollection).Error; err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"resource\": name,\n\t\t\t\"error\": err,\n\t\t}).Warn(\"Delete collection in DB failed, find resource failed.\")\n\t\treturn nil, base.NewErrorResponseTransactionError()\n\t}\n\n\tif err := tx.Where(\"\\\"ServerGroupID\\\" <> ?\", DefaultServerGroupID).Delete(entity.ServerServerGroup{}).Error; err != nil {\n\t\ttx.Rollback()\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"resource\": name,\n\t\t\t\"error\": err,\n\t\t}).Warn(\"Delete collection in DB failed, delete resources failed, transaction rollback.\")\n\t\treturn nil, base.NewErrorResponseTransactionError()\n\t}\n\tret, errorResp := impl.TemplateImpl.ConvertFindResultToModel(recordCollection)\n\tif errorResp != nil {\n\t\ttx.Rollback()\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"resource\": name,\n\t\t\t\"errorResp\": errorResp.ID,\n\t\t}).Warn(\"Delete collection in DB failed, convert find result failed, transaction rollback.\")\n\t\treturn nil, errorResp\n\t}\n\tif err := tx.Commit().Error; err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"resource\": name,\n\t\t\t\"error\": err,\n\t\t}).Warn(\"Delete collection in DB failed, commit failed.\")\n\t\treturn nil, base.NewErrorResponseTransactionError()\n\t}\n\treturn ret, nil\n}", "func (c *FakeClusterManagers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewRootDeleteCollectionAction(clustermanagersResource, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &operatorv1.ClusterManagerList{})\n\treturn err\n}", "func (c *FakeAWSSNSTargets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(awssnstargetsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.AWSSNSTargetList{})\n\treturn err\n}", "func (c *FakeL4Rules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(l4rulesResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha2.L4RuleList{})\n\treturn err\n}", "func (c *podSecurityPolicySubjectReviews) DeleteCollection(options *pkg_api.DeleteOptions, listOptions pkg_api.ListOptions) error {\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"podsecuritypolicysubjectreviews\").\n\t\tVersionedParams(&listOptions, pkg_api.ParameterCodec).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (a *ManagementApiService) DeleteCollection(ctx _context.Context, applicationId int32, campaignId int32, collectionId int32) apiDeleteCollectionRequest {\n\treturn apiDeleteCollectionRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t\tapplicationId: applicationId,\n\t\tcampaignId: campaignId,\n\t\tcollectionId: collectionId,\n\t}\n}", "func (c *FakePodNetworkings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewRootDeleteCollectionAction(podnetworkingsResource, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1beta1.PodNetworkingList{})\n\treturn err\n}", "func (c *FakeWorkflowTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(workflowtemplatesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.WorkflowTemplateList{})\n\treturn err\n}", "func (c *FakeApiGatewayMethodSettingses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(apigatewaymethodsettingsesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.ApiGatewayMethodSettingsList{})\n\treturn err\n}", "func (c *FakeProxyRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(proxyroutesResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.ProxyRouteList{})\n\treturn err\n}", "func (c *clusterVulnerabilityReports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOpts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tResource(\"clustervulnerabilityreports\").\n\t\tVersionedParams(&listOpts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(&opts).\n\t\tDo(ctx).\n\t\tError()\n}", "func (c *FakeTridentSnapshotInfos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(tridentsnapshotinfosResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &netappv1.TridentSnapshotInfoList{})\n\treturn err\n}", "func (c *tiDBGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\tvar timeout time.Duration\n\tif listOptions.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second\n\t}\n\treturn c.client.Delete().\n\t\tNamespace(c.ns).\n\t\tResource(\"tidbgroups\").\n\t\tVersionedParams(&listOptions, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tBody(options).\n\t\tDo().\n\t\tError()\n}", "func (c *FakeGoogleServiceAccounts) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(googleserviceaccountsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.GoogleServiceAccountList{})\n\treturn err\n}", "func (c *FakeDaskClusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(daskclustersResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &kubernetesdaskorgv1.DaskClusterList{})\n\treturn err\n}", "func (c *FakeHealthCheckPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(healthcheckpoliciesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.HealthCheckPolicyList{})\n\treturn err\n}", "func (c *FakeGameServerAllocations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(gameserverallocationsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.GameServerAllocationList{})\n\treturn err\n}", "func (c *FakeGoogleCloudPubSubSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(googlecloudpubsubsourcesResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.GoogleCloudPubSubSourceList{})\n\treturn err\n}", "func (c *FakeExampleOperators) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(exampleoperatorsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.ExampleOperatorList{})\n\treturn err\n}", "func (c *FakeFederatedNotificationManagers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewRootDeleteCollectionAction(federatednotificationmanagersResource, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1beta2.FederatedNotificationManagerList{})\n\treturn err\n}", "func (c *FakeIamUserPolicyAttachments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(iamuserpolicyattachmentsResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.IamUserPolicyAttachmentList{})\n\treturn err\n}", "func (p PostgresPersister) DeleteCollection(id string) error {\n\tvar dbid int32\n\tfmt.Sscanf(id, p.pathPrefix+model.CollectionIDFormat, &dbid)\n\t_, err := p.db.Exec(\"DELETE FROM collection WHERE id = $1\", dbid)\n\treturn translateError(err)\n}", "func (c *FakeAppEngineFlexibleAppVersions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(appengineflexibleappversionsResource, c.ns, listOpts)\n\n\t_, err := c.Fake.Invokes(action, &v1alpha1.AppEngineFlexibleAppVersionList{})\n\treturn err\n}" ]
[ "0.7699723", "0.7570869", "0.75703704", "0.75454164", "0.7514351", "0.7488343", "0.7451056", "0.74491966", "0.74294275", "0.7426684", "0.74233156", "0.7389707", "0.7370067", "0.7361063", "0.7334545", "0.7327154", "0.7316015", "0.7310656", "0.729753", "0.7297466", "0.72921824", "0.7283851", "0.7271686", "0.7263111", "0.7241649", "0.7207388", "0.72064424", "0.72014874", "0.7199653", "0.71760017", "0.7173545", "0.71662444", "0.7160453", "0.71478593", "0.7147578", "0.7136736", "0.7133718", "0.7133091", "0.7126527", "0.71187246", "0.7116073", "0.711103", "0.7105441", "0.70986146", "0.7094344", "0.70904547", "0.7070048", "0.706444", "0.70625335", "0.70598567", "0.705932", "0.70576197", "0.7049842", "0.70479715", "0.7044902", "0.70419455", "0.70357305", "0.7031671", "0.70080435", "0.70072424", "0.7006902", "0.6990322", "0.6986337", "0.69836634", "0.69733405", "0.696775", "0.6961", "0.69535977", "0.6953", "0.6952913", "0.694083", "0.6937553", "0.69319034", "0.69314396", "0.69269407", "0.69251764", "0.6922217", "0.6912924", "0.6908678", "0.69035363", "0.68884", "0.68861294", "0.6878824", "0.6864632", "0.6861005", "0.6834033", "0.6830367", "0.6822361", "0.68028736", "0.6801885", "0.67925274", "0.67880195", "0.6786985", "0.6781987", "0.677914", "0.6764247", "0.6763957", "0.6762543", "0.6757195", "0.6756878" ]
0.6864794
83
Patch applies the patch and returns the patched cloudwatchEventTarget.
func (c *FakeCloudwatchEventTargets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.CloudwatchEventTarget, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(cloudwatcheventtargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.CloudwatchEventTarget{}) if obj == nil { return nil, err } return obj.(*v1alpha1.CloudwatchEventTarget), err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *FakeCloudwatchEventTargets) Update(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func GetEventTarget(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EventTargetState, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tvar resource EventTarget\n\terr := ctx.ReadResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (iface *Iface) patch(dev Patchable) {\n\tiface.patched = dev\n}", "func NewEventTarget(ctx *pulumi.Context,\n\tname string, args *EventTargetArgs, opts ...pulumi.ResourceOption) (*EventTarget, error) {\n\tif args == nil || args.Arn == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Arn'\")\n\t}\n\tif args == nil || args.Rule == nil {\n\t\treturn nil, errors.New(\"missing required argument 'Rule'\")\n\t}\n\tif args == nil {\n\t\targs = &EventTargetArgs{}\n\t}\n\tvar resource EventTarget\n\terr := ctx.RegisterResource(\"aws:cloudwatch/eventTarget:EventTarget\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func Patch(t testing.TB, dest, value interface{}) {\n\tNew(t).Patch(dest, value)\n}", "func PatchFunc(target, repl any) *Patch {\n\tassertSameFuncType(target, repl)\n\ttargetVal := reflect.ValueOf(target)\n\treplVal := reflect.ValueOf(repl)\n\treturn patchFunc(targetVal, replVal)\n}", "func Patch(pkgName, typeName, methodName string, patchFunc interface{}) {\n\t// find addr of the func\n\tsymbolName := getSymbolName(pkgName, typeName, methodName)\n\taddr := symbolTable[symbolName]\n\toriginalBytes := replaceFunction(addr, (uintptr)(getPtr(reflect.ValueOf(patchFunc))))\n\tpatchRecord[addr] = originalBytes\n}", "func Patch(dest, value interface{}) Restorer {\n\tdestv := reflect.ValueOf(dest).Elem()\n\toldv := reflect.New(destv.Type()).Elem()\n\toldv.Set(destv)\n\tvaluev := reflect.ValueOf(value)\n\tif !valuev.IsValid() {\n\t\t// This isn't quite right when the destination type is not\n\t\t// nilable, but it's better than the complex alternative.\n\t\tvaluev = reflect.Zero(destv.Type())\n\t}\n\tdestv.Set(valuev)\n\treturn func() {\n\t\tdestv.Set(oldv)\n\t}\n}", "func (c *FakeListeners) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networkextensionv1.Listener, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(listenersResource, c.ns, name, pt, data, subresources...), &networkextensionv1.Listener{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*networkextensionv1.Listener), err\n}", "func (c *FakeCloudwatchEventTargets) Get(name string, options v1.GetOptions) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewGetAction(cloudwatcheventtargetsResource, c.ns, name), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (c *FakeCloudwatchEventTargets) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\treturn c.Fake.\n\t\tInvokesWatch(testing.NewWatchAction(cloudwatcheventtargetsResource, c.ns, opts))\n\n}", "func (r *ProjectsTraceSinksService) Patch(nameid string, tracesink *TraceSink) *ProjectsTraceSinksPatchCall {\n\tc := &ProjectsTraceSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.nameid = nameid\n\tc.tracesink = tracesink\n\treturn c\n}", "func (c *FakeCloudwatchEventTargets) Create(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (s *GenericWatchStorage) Patch(key storage.ObjectKey, patch []byte) error {\n\ts.watcher.Suspend(watcher.FileEventModify)\n\treturn s.Storage.Patch(key, patch)\n}", "func (p *Patch) Patch() error {\n\tif p == nil {\n\t\treturn errors.New(\"patch is nil\")\n\t}\n\tif err := isPatchable(p.target, p.redirection); err != nil {\n\t\treturn err\n\t}\n\tif err := applyPatch(p); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (r *EventTagsService) Patch(profileId int64, id int64, eventtag *EventTag) *EventTagsPatchCall {\n\tc := &EventTagsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.urlParams_.Set(\"id\", fmt.Sprint(id))\n\tc.eventtag = eventtag\n\treturn c\n}", "func (a *APITest) Patch(url string) *Request {\n\ta.request.method = http.MethodPatch\n\ta.request.url = url\n\treturn a.request\n}", "func (fkw *FakeClientWrapper) Patch(ctx context.Context, obj runtime.Object,\n\tpatch k8sCl.Patch, opts ...k8sCl.PatchOption) error {\n\treturn fkw.client.Patch(ctx, obj, patch, opts...)\n}", "func (tr *Transport) Patch(url string, fn HandlerFunc, options ...HandlerOption) {\n\ttr.mux.Handler(net_http.MethodPatch, url, encapsulate(fn, tr.options, options))\n}", "func Patch(route string, do interface{}) *handler {\n\treturn handlerByMethod(&route, do, \"PATCH\")\n}", "func (c *FakeAWSSNSTargets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AWSSNSTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(awssnstargetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.AWSSNSTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.AWSSNSTarget), err\n}", "func Patch(base []byte, v interface{}) ([]byte, error) {\n\t//Clone struct v, v shoud not be modified\n\trv := reflect.ValueOf(v)\n\tfor rv.Kind() == reflect.Ptr {\n\t\trv = rv.Elem()\n\t}\n\tpv := reflect.New(rv.Type())\n\tpv.Elem().Set(rv)\n\n\tnv := pv.Interface()\n\n\t//unmarshal base\n\ttable, err := toml.Parse(base)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := toml.UnmarshalTable(table, nv); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn Marshal(nv)\n}", "func (o ExternalMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v ExternalMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func patch(c client.Client, opCond *operators.OperatorCondition, newCond meta.Condition) error {\n\tnewCond.LastTransitionTime = meta.Now()\n\tpatchData, err := json.Marshal([]*patcher.JSONPatch{\n\t\tpatcher.NewJSONPatch(\"add\", \"/spec/conditions\", []meta.Condition{newCond})})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to generate patch request body for Condition %v: %w\", newCond, err)\n\t}\n\tif err = c.Patch(context.TODO(), opCond, client.RawPatch(types.JSONPatchType, patchData)); err != nil {\n\t\treturn fmt.Errorf(\"unable to apply patch %s to OperatorCondition %s: %w\", patchData, opCond.GetName(), err)\n\t}\n\treturn nil\n}", "func (o ObjectMetricSourcePatchOutput) Target() CrossVersionObjectReferencePatchPtrOutput {\n\treturn o.ApplyT(func(v ObjectMetricSourcePatch) *CrossVersionObjectReferencePatch { return v.Target }).(CrossVersionObjectReferencePatchPtrOutput)\n}", "func (f5 *f5LTM) patch(url string, payload interface{}, result interface{}) error {\n\treturn f5.restRequestPayload(\"PATCH\", url, payload, result)\n}", "func (client *MockClient) Patch(context ctx.Context, object ctrlClient.Object, patch ctrlClient.Patch, options ...ctrlClient.PatchOption) error {\n\treturn fmt.Errorf(\"Not implemented\")\n}", "func (o ContainerResourceMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v ContainerResourceMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func (o ObjectMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v ObjectMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func (ch *CloudwatchHook) GetHook() (func(zapcore.Entry) error, error) {\n\n\tvar cloudwatchWriter = func(e zapcore.Entry) error {\n\t\tif !ch.isAcceptedLevel(e.Level) {\n\t\t\treturn nil\n\t\t}\n\n\t\tevent := &cloudwatchlogs.InputLogEvent{\n\t\t\tMessage: aws.String(fmt.Sprintf(\"[%s] %s\", e.LoggerName, e.Message)),\n\t\t\tTimestamp: aws.Int64(int64(time.Nanosecond) * time.Now().UnixNano() / int64(time.Millisecond)),\n\t\t}\n\t\tparams := &cloudwatchlogs.PutLogEventsInput{\n\t\t\tLogEvents: []*cloudwatchlogs.InputLogEvent{event},\n\t\t\tLogGroupName: aws.String(ch.GroupName),\n\t\t\tLogStreamName: aws.String(ch.StreamName),\n\t\t\tSequenceToken: ch.nextSequenceToken,\n\t\t}\n\n\t\tif ch.Async {\n\t\t\tgo ch.sendEvent(params)\n\t\t\treturn nil\n\t\t}\n\n\t\treturn ch.sendEvent(params)\n\t}\n\n\tch.svc = cloudwatchlogs.New(session.New(ch.AWSConfig))\n\n\tlgresp, err := ch.svc.DescribeLogGroups(&cloudwatchlogs.DescribeLogGroupsInput{LogGroupNamePrefix: aws.String(ch.GroupName), Limit: aws.Int64(1)})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(lgresp.LogGroups) < 1 {\n\t\t// we need to create this log group\n\t\t_, err := ch.svc.CreateLogGroup(&cloudwatchlogs.CreateLogGroupInput{LogGroupName: aws.String(ch.GroupName)})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tresp, err := ch.svc.DescribeLogStreams(&cloudwatchlogs.DescribeLogStreamsInput{\n\t\tLogGroupName: aws.String(ch.GroupName), // Required\n\t\tLogStreamNamePrefix: aws.String(ch.StreamName),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// grab the next sequence token\n\tif len(resp.LogStreams) > 0 {\n\t\tch.nextSequenceToken = resp.LogStreams[0].UploadSequenceToken\n\t\treturn cloudwatchWriter, nil\n\t}\n\n\t// create stream if it doesn't exist. the next sequence token will be null\n\t_, err = ch.svc.CreateLogStream(&cloudwatchlogs.CreateLogStreamInput{\n\t\tLogGroupName: aws.String(ch.GroupName),\n\t\tLogStreamName: aws.String(ch.StreamName),\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cloudwatchWriter, nil\n}", "func (r *Route) Patch(handler http.Handler) *Route {\n\tr.handlers[http.MethodPatch] = handler\n\treturn r\n}", "func (o *PatchRetryEventUsingPATCHParams) WithHTTPClient(client *http.Client) *PatchRetryEventUsingPATCHParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (b *Builder) PatchOffset(patchedOffset, patch dwarf.Offset) {\n\tinfoBytes := b.info.Bytes()\n\tbuf := new(bytes.Buffer)\n\tbinary.Write(buf, binary.LittleEndian, patch)\n\tcopy(infoBytes[patchedOffset:], buf.Bytes())\n}", "func (g *Cloud) PatchFirewall(f *compute.Firewall) error {\n\tctx, cancel := cloud.ContextWithCallTimeout()\n\tdefer cancel()\n\n\tmc := newFirewallMetricContext(\"Patch\")\n\treturn mc.Observe(g.c.Firewalls().Patch(ctx, meta.GlobalKey(f.Name), f))\n}", "func (r *Reconciler) patch(\n\tctx context.Context, object client.Object,\n\tpatch client.Patch, options ...client.PatchOption,\n) error {\n\toptions = append([]client.PatchOption{r.Owner}, options...)\n\treturn r.Client.Patch(ctx, object, patch, options...)\n}", "func (o ResourceMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v ResourceMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func (o ObjectMetricStatusPatchOutput) Target() CrossVersionObjectReferencePatchPtrOutput {\n\treturn o.ApplyT(func(v ObjectMetricStatusPatch) *CrossVersionObjectReferencePatch { return v.Target }).(CrossVersionObjectReferencePatchPtrOutput)\n}", "func getProxyUpdateEvent(msg events.PubSubMessage) *proxyUpdateEvent {\n\tswitch msg.Kind {\n\tcase\n\t\t//\n\t\t// K8s native resource events\n\t\t//\n\t\t// Endpoint event\n\t\tannouncements.EndpointAdded, announcements.EndpointDeleted, announcements.EndpointUpdated,\n\t\t// k8s Ingress event\n\t\tannouncements.IngressAdded, announcements.IngressDeleted, announcements.IngressUpdated,\n\t\t//\n\t\t// OSM resource events\n\t\t//\n\t\t// Egress event\n\t\tannouncements.EgressAdded, announcements.EgressDeleted, announcements.EgressUpdated,\n\t\t// IngressBackend event\n\t\tannouncements.IngressBackendAdded, announcements.IngressBackendDeleted, announcements.IngressBackendUpdated,\n\t\t// MulticlusterService event\n\t\tannouncements.MultiClusterServiceAdded, announcements.MultiClusterServiceDeleted, announcements.MultiClusterServiceUpdated,\n\t\t//\n\t\t// SMI resource events\n\t\t//\n\t\t// SMI HTTPRouteGroup event\n\t\tannouncements.RouteGroupAdded, announcements.RouteGroupDeleted, announcements.RouteGroupUpdated,\n\t\t// SMI TCPRoute event\n\t\tannouncements.TCPRouteAdded, announcements.TCPRouteDeleted, announcements.TCPRouteUpdated,\n\t\t// SMI TrafficSplit event\n\t\tannouncements.TrafficSplitAdded, announcements.TrafficSplitDeleted, announcements.TrafficSplitUpdated,\n\t\t// SMI TrafficTarget event\n\t\tannouncements.TrafficTargetAdded, announcements.TrafficTargetDeleted, announcements.TrafficTargetUpdated,\n\t\t//\n\t\t// Proxy events\n\t\t//\n\t\tannouncements.ProxyUpdate:\n\t\treturn &proxyUpdateEvent{\n\t\t\tmsg: msg,\n\t\t\ttopic: announcements.ProxyUpdate.String(),\n\t\t}\n\n\tcase announcements.MeshConfigUpdated:\n\t\tprevMeshConfig, okPrevCast := msg.OldObj.(*v1alpha1.MeshConfig)\n\t\tnewMeshConfig, okNewCast := msg.NewObj.(*v1alpha1.MeshConfig)\n\t\tif !okPrevCast || !okNewCast {\n\t\t\tlog.Error().Msgf(\"Expected MeshConfig type, got previous=%T, new=%T\", okPrevCast, okNewCast)\n\t\t\treturn nil\n\t\t}\n\n\t\tprevSpec := prevMeshConfig.Spec\n\t\tnewSpec := newMeshConfig.Spec\n\t\t// A proxy config update must only be triggered when a MeshConfig field that maps to a proxy config\n\t\t// changes.\n\t\tif prevSpec.Traffic.EnableEgress != newSpec.Traffic.EnableEgress ||\n\t\t\tprevSpec.Traffic.EnablePermissiveTrafficPolicyMode != newSpec.Traffic.EnablePermissiveTrafficPolicyMode ||\n\t\t\tprevSpec.Observability.Tracing != newSpec.Observability.Tracing ||\n\t\t\tprevSpec.Traffic.InboundExternalAuthorization.Enable != newSpec.Traffic.InboundExternalAuthorization.Enable ||\n\t\t\t// Only trigger an update on InboundExternalAuthorization field changes if the new spec has the 'Enable' flag set to true.\n\t\t\t(newSpec.Traffic.InboundExternalAuthorization.Enable && (prevSpec.Traffic.InboundExternalAuthorization != newSpec.Traffic.InboundExternalAuthorization)) ||\n\t\t\tprevSpec.FeatureFlags != newSpec.FeatureFlags {\n\t\t\treturn &proxyUpdateEvent{\n\t\t\t\tmsg: msg,\n\t\t\t\ttopic: announcements.ProxyUpdate.String(),\n\t\t\t}\n\t\t}\n\t\treturn nil\n\n\tcase announcements.PodUpdated:\n\t\t// Only trigger a proxy update for proxies associated with this pod based on the proxy UUID\n\t\tprevPod, okPrevCast := msg.OldObj.(*corev1.Pod)\n\t\tnewPod, okNewCast := msg.NewObj.(*corev1.Pod)\n\t\tif !okPrevCast || !okNewCast {\n\t\t\tlog.Error().Msgf(\"Expected *Pod type, got previous=%T, new=%T\", okPrevCast, okNewCast)\n\t\t\treturn nil\n\t\t}\n\t\tprevMetricAnnotation := prevPod.Annotations[constants.PrometheusScrapeAnnotation]\n\t\tnewMetricAnnotation := newPod.Annotations[constants.PrometheusScrapeAnnotation]\n\t\tif prevMetricAnnotation != newMetricAnnotation {\n\t\t\tproxyUUID := newPod.Labels[constants.EnvoyUniqueIDLabelName]\n\t\t\treturn &proxyUpdateEvent{\n\t\t\t\tmsg: msg,\n\t\t\t\ttopic: GetPubSubTopicForProxyUUID(proxyUUID),\n\t\t\t}\n\t\t}\n\t\treturn nil\n\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (r *FakeClient) Patch(\n\tctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption,\n) error {\n\t// TODO (covariance) implement me!\n\tpanic(\"not implemented\")\n}", "func (o HttpRuleOutput) Patch() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HttpRule) *string { return v.Patch }).(pulumi.StringPtrOutput)\n}", "func Patch(visitor ast.Visitor) Option {\n\treturn func(c *conf.Config) {\n\t\tc.Visitors = append(c.Visitors, visitor)\n\t}\n}", "func (a *App) Patch(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"patching in testing mode. Get ready to send multipart-form data\"))\n}", "func (router *Router) Patch(path string, handler Handle) *Router {\n\trouter.Mux.PATCH(path, handleProxy(handler))\n\treturn router\n}", "func (o ExternalMetricSourcePatchPtrOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v *ExternalMetricSourcePatch) *MetricTargetPatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(MetricTargetPatchPtrOutput)\n}", "func patch(opts *tf.ContextOpts) (*tf.State, error) {\n\tif opts.Destroy {\n\t\t// Need walkDestroy to implement this\n\t\tpanic(\"tfx: patch does not support pure destroy operations\")\n\t}\n\n\t// Create context with a copy of the original state\n\torig, state := opts.State, opts.State.DeepCopy()\n\topts.State = state\n\tc, err := tf.NewContext(opts)\n\tif opts.State = orig; err != nil {\n\t\treturn nil, err\n\t}\n\n\t// HACK: Get contextComponentFactory\n\tcomps := (&tf.ContextGraphWalker{Context: c}).\n\t\tEnterPath(tf.RootModulePath).(*tf.BuiltinEvalContext).Components\n\n\t// Build patch graph\n\tgraph, err := (&patchGraphBuilder{tf.ApplyGraphBuilder{\n\t\tDiff: opts.Diff,\n\t\tState: state,\n\t\tProviders: comps.ResourceProviders(),\n\t\tProvisioners: comps.ResourceProvisioners(),\n\t\tTargets: opts.Targets,\n\t\tDestroy: opts.Destroy,\n\t\tValidate: true,\n\t}}).Build(tf.RootModulePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// HACK: Get walkApply value\n\twalkApplyOnce.Do(func() {\n\t\tvar c tf.Context // Avoid deep copy of the real state\n\t\twalkApply.Operation = c.Interpolater().Operation\n\t})\n\n\t// Walk the graph\n\tw := &patchGraphWalker{ContextGraphWalker: tf.ContextGraphWalker{\n\t\tContext: c,\n\t\tOperation: walkApply.Operation,\n\t\tStopContext: context.Background(),\n\t}}\n\tif err = graph.Walk(w); len(w.ValidationErrors) > 0 {\n\t\terr = multierror.Append(err, w.ValidationErrors...)\n\t}\n\n\t// Stop providers and provisioners\n\tfor _, p := range w.rootCtx.ProviderCache {\n\t\tp.Stop()\n\t}\n\tfor _, p := range w.rootCtx.ProvisionerCache {\n\t\tp.Stop()\n\t}\n\treturn state, err\n}", "func Struct(target, patch interface{}) (changed bool, err error) {\n\n\tvar dst = structs.New(target)\n\tvar fields = structs.New(patch).Fields() // work stack\n\n\tfor N := len(fields); N > 0; N = len(fields) {\n\t\tvar srcField = fields[N-1] // pop the top\n\t\tfields = fields[:N-1]\n\n\t\tif !srcField.IsExported() {\n\t\t\tcontinue // skip unexported fields\n\t\t}\n\t\tif srcField.IsEmbedded() {\n\t\t\t// add the embedded fields into the work stack\n\t\t\tfields = append(fields, srcField.Fields()...)\n\t\t\tcontinue\n\t\t}\n\t\tif srcField.IsZero() {\n\t\t\tcontinue // skip zero-value fields\n\t\t}\n\n\t\tvar name = srcField.Name()\n\n\t\tvar dstField, ok = dst.FieldOk(name)\n\t\tif !ok {\n\t\t\tcontinue // skip non-existing fields\n\t\t}\n\t\tvar srcValue = reflect.ValueOf(srcField.Value())\n\t\tsrcValue = reflect.Indirect(srcValue)\n\t\tif skind, dkind := srcValue.Kind(), dstField.Kind(); skind != dkind {\n\t\t\terr = fmt.Errorf(\"field `%v` types mismatch while patching: %v vs %v\", name, dkind, skind)\n\t\t\treturn\n\t\t}\n\n\t\tif !reflect.DeepEqual(srcValue.Interface(), dstField.Value()) {\n\t\t\tchanged = true\n\t\t}\n\n\t\terr = dstField.Set(srcValue.Interface())\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (this *Route) PATCH(handlers ...HTTPHandler) *Route {\n\treturn this.addHandler(\"patch\", handlers...)\n}", "func ApplyPatch(cur, patch io.Reader) (io.Reader, error) {\n\tbuf := &bytes.Buffer{}\n\terr := binarydist.Patch(cur, buf, patch)\n\n\treturn buf, err\n}", "func Patch(path string, fn http.HandlerFunc, c ...alice.Constructor) {\n\trecord(\"PATCH\", path)\n\n\tinfoMutex.Lock()\n\tr.PATCH(path, Handler(alice.New(c...).ThenFunc(fn)))\n\tinfoMutex.Unlock()\n}", "func modifiedEvent(key model.Key) api.WatchEvent {\n\treturn api.WatchEvent{\n\t\tType: api.WatchModified,\n\t\tNew: &model.KVPair{\n\t\t\tKey: key,\n\t\t\tValue: uuid.NewString(),\n\t\t\tRevision: uuid.NewString(),\n\t\t},\n\t}\n}", "func Patch(expectations []*RunExpectation) func(t *testing.T) {\n\t_mocker = &runMocker{\n\t\texpectations: expectations,\n\t\tptr: 0,\n\t\tlength: len(expectations),\n\t}\n\n\treturn func(t *testing.T) {\n\t\tif expectation := _mocker.expectation(); expectation != nil {\n\t\t\tt.Errorf(\"execkit-mock: missing call: %v\", expectation)\n\t\t\tt.FailNow()\n\t\t}\n\t\t_mocker = nil\n\t}\n}", "func (o PodsMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v PodsMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func (p *Patch) Patch() {\n\tp.patched = true\n\tif p.funcInfo != nil {\n\t\tp.applyFunc()\n\t} else if p.varInfo != nil {\n\t\tp.applyVar()\n\t}\n}", "func (o ContainerResourceMetricSourcePatchPtrOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v *ContainerResourceMetricSourcePatch) *MetricTargetPatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(MetricTargetPatchPtrOutput)\n}", "func RawPatch(patchType types.PatchType, data []byte) Patch {\n\treturn &patch{patchType, data}\n}", "func (client MockStatusClient) Patch(context ctx.Context, object ctrlClient.Object, patch ctrlClient.Patch, options ...ctrlClient.PatchOption) error {\n\treturn fmt.Errorf(\"not implemented\")\n}", "func (o ObjectMetricSourcePatchPtrOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricSourcePatch) *MetricTargetPatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(MetricTargetPatchPtrOutput)\n}", "func Patch() int {\n\treturn patch\n}", "func (c *FakeAwsIamGroupPolicyAttachments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *aws_v1.AwsIamGroupPolicyAttachment, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(awsiamgrouppolicyattachmentsResource, c.ns, name, data, subresources...), &aws_v1.AwsIamGroupPolicyAttachment{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*aws_v1.AwsIamGroupPolicyAttachment), err\n}", "func NewPatchRetryEventUsingPATCHParamsWithHTTPClient(client *http.Client) *PatchRetryEventUsingPATCHParams {\n\tvar ()\n\treturn &PatchRetryEventUsingPATCHParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *PatchRetryEventUsingPATCHParams) WithTimeout(timeout time.Duration) *PatchRetryEventUsingPATCHParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (c *awsOrganizationsPolicyAttachments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.AwsOrganizationsPolicyAttachment, err error) {\n\tresult = &v1.AwsOrganizationsPolicyAttachment{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"awsorganizationspolicyattachments\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (c *FakeAwsApiGatewayVpcLinks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *aws_v1.AwsApiGatewayVpcLink, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(awsapigatewayvpclinksResource, c.ns, name, data, subresources...), &aws_v1.AwsApiGatewayVpcLink{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*aws_v1.AwsApiGatewayVpcLink), err\n}", "func (_this *IntersectionObserverEntry) Target() *dom.Element {\n\tvar ret *dom.Element\n\tvalue := _this.Value_JS.Get(\"target\")\n\tret = dom.ElementFromJS(value)\n\treturn ret\n}", "func (e *Entity) Patch(uri string, payload interface{}) error {\n\theader := make(map[string]string)\n\tif e.etag != \"\" {\n\t\theader[\"If-Match\"] = e.etag\n\t}\n\n\tresp, err := e.client.PatchWithHeaders(uri, payload, header)\n\tif err == nil {\n\t\treturn resp.Body.Close()\n\t}\n\treturn err\n}", "func patchResource(mapping *meta.RESTMapping, config *rest.Config, group string,\n\tversion string, namespace string, data []byte) error {\n\trestClient, err := getRESTClient(config, group, version)\n\tif err != nil {\n\t\treturn &kfapis.KfError{\n\t\t\tCode: int(kfapis.INVALID_ARGUMENT),\n\t\t\tMessage: fmt.Sprintf(\"patchResource error: %v\", err),\n\t\t}\n\t}\n\n\tif _, err = restClient.\n\t\tPatch(k8stypes.JSONPatchType).\n\t\tResource(mapping.Resource.Resource).\n\t\tNamespaceIfScoped(namespace, mapping.Scope.Name() == \"namespace\").\n\t\tBody(data).\n\t\tDo().\n\t\tGet(); err == nil {\n\t\treturn nil\n\t} else {\n\t\treturn &kfapis.KfError{\n\t\t\tCode: int(kfapis.INVALID_ARGUMENT),\n\t\t\tMessage: fmt.Sprintf(\"patchResource error: %v\", err),\n\t\t}\n\t}\n}", "func (o ObjectMetricSourcePatchPtrOutput) Target() CrossVersionObjectReferencePatchPtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricSourcePatch) *CrossVersionObjectReferencePatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(CrossVersionObjectReferencePatchPtrOutput)\n}", "func mutatingWatcherFor(source watch.Interface, mutator func(runtime.Object) error) watch.Interface {\n\tw := mutatingWatcher{\n\t\tmutator: mutator,\n\t\tsource: source,\n\t\toutput: make(chan watch.Event),\n\t\twg: &sync.WaitGroup{},\n\t}\n\tw.wg.Add(1)\n\tgo func(input <-chan watch.Event, output chan<- watch.Event) {\n\t\tdefer w.wg.Done()\n\t\tfor event := range input {\n\t\t\tif err := mutator(event.Object); err != nil {\n\t\t\t\toutput <- watch.Event{\n\t\t\t\t\tType: watch.Error,\n\t\t\t\t\tObject: &errors.NewInternalError(fmt.Errorf(\"failed to mutate object in watch event: %v\", err)).ErrStatus,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput <- event\n\t\t\t}\n\t\t}\n\t}(source.ResultChan(), w.output)\n\treturn &w\n}", "func (client ApplicationsClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "func EventOriginal(val string) zap.Field {\n\treturn zap.String(FieldEventOriginal, val)\n}", "func (r *volumeReactor) modifyVolumeEvent(volume *v1.PersistentVolume) {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\tr.volumes[volume.Name] = volume\n\t// Generate deletion event. Cloned volume is needed to prevent races (and we\n\t// would get a clone from etcd too).\n\tif r.fakeVolumeWatch != nil {\n\t\tclone, _ := api.Scheme.DeepCopy(volume)\n\t\tvolumeClone := clone.(*v1.PersistentVolume)\n\t\tr.fakeVolumeWatch.Modify(volumeClone)\n\t}\n}", "func (o ObjectMetricStatusPatchPtrOutput) Target() CrossVersionObjectReferencePatchPtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricStatusPatch) *CrossVersionObjectReferencePatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(CrossVersionObjectReferencePatchPtrOutput)\n}", "func (o ResourceMetricSourcePatchPtrOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v *ResourceMetricSourcePatch) *MetricTargetPatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(MetricTargetPatchPtrOutput)\n}", "func patchEtcd(ctx context.Context, log *logrus.Entry, etcdcli operatorv1client.EtcdInterface, e *operatorv1.Etcd, patch string) error {\n\tlog.Infof(\"Preparing to patch etcd %s with %s\", e.Name, patch)\n\t// must be removed to force redeployment\n\te.CreationTimestamp = metav1.Time{\n\t\tTime: time.Now(),\n\t}\n\te.ResourceVersion = \"\"\n\te.UID = \"\"\n\n\tbuf := &bytes.Buffer{}\n\terr := codec.NewEncoder(buf, &codec.JsonHandle{}).Encode(e)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = etcdcli.Patch(ctx, e.Name, types.MergePatchType, buf.Bytes(), metav1.PatchOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"Patched etcd %s with %s\", e.Name, patch)\n\n\treturn nil\n}", "func Watch(ctx context.Context, i v1.PodInterface, podFilter *regexp.Regexp,\n\tcontainerFilter *regexp.Regexp, containerExcludeFilter *regexp.Regexp,\n\tcontainerState ContainerState, labelSelector labels.Selector) (chan *Target, chan *Target, error) {\n\n\tlogger := requestctx.Logger(ctx).WithName(\"pod-watch\").V(4)\n\n\tlogger.Info(\"create\")\n\twatcher, err := i.Watch(ctx, metav1.ListOptions{Watch: true, LabelSelector: labelSelector.String()})\n\tif err != nil {\n\t\tfmt.Printf(\"err.Error() = %+v\\n\", err.Error())\n\t\treturn nil, nil, errors.Wrap(err, \"failed to set up watch\")\n\t}\n\n\tadded := make(chan *Target)\n\tremoved := make(chan *Target)\n\n\tgo func() {\n\t\tlogger.Info(\"await events\")\n\t\tdefer func() {\n\t\t\tlogger.Info(\"event processing ends\")\n\t\t}()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase e := <-watcher.ResultChan():\n\t\t\t\tlogger.Info(\"received event\")\n\n\t\t\t\tif e.Object == nil {\n\t\t\t\t\tlogger.Info(\"event error, no object\")\n\t\t\t\t\t// Closed because of error\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tpod, ok := e.Object.(*corev1.Pod)\n\t\t\t\tif !ok {\n\t\t\t\t\tlogger.Info(\"event error, object not a pod\")\n\t\t\t\t\t// Not a Pod\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif !podFilter.MatchString(pod.Name) {\n\t\t\t\t\tlogger.Info(\"filtered\", \"pod\", pod.Name, \"filter\", podFilter.String())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tswitch e.Type {\n\t\t\t\tcase watch.Added, watch.Modified:\n\t\t\t\t\tlogger.Info(\"pod added/modified\", \"name\", pod.Name)\n\n\t\t\t\t\tvar statuses []corev1.ContainerStatus\n\t\t\t\t\tstatuses = append(statuses, pod.Status.InitContainerStatuses...)\n\t\t\t\t\tstatuses = append(statuses, pod.Status.ContainerStatuses...)\n\n\t\t\t\t\tfor _, c := range statuses {\n\t\t\t\t\t\tif !containerFilter.MatchString(c.Name) {\n\t\t\t\t\t\t\tlogger.Info(\"filtered\", \"container\", c.Name, \"filter\", containerFilter.String())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif containerExcludeFilter != nil && containerExcludeFilter.MatchString(c.Name) {\n\t\t\t\t\t\t\tlogger.Info(\"excluded\", \"container\", c.Name, \"exclude-filter\", containerExcludeFilter.String())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif c.State.Running != nil || c.State.Terminated != nil { // There are logs to read\n\t\t\t\t\t\t\tlogger.Info(\"report added\", \"container\", c.Name, \"pod\", pod.Name, \"namespace\", pod.Namespace)\n\t\t\t\t\t\t\tadded <- &Target{\n\t\t\t\t\t\t\t\tNamespace: pod.Namespace,\n\t\t\t\t\t\t\t\tPod: pod.Name,\n\t\t\t\t\t\t\t\tContainer: c.Name,\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\tcase watch.Deleted:\n\t\t\t\t\tlogger.Info(\"pod deleted\", \"name\", pod.Name)\n\n\t\t\t\t\tvar containers []corev1.Container\n\t\t\t\t\tcontainers = append(containers, pod.Spec.Containers...)\n\t\t\t\t\tcontainers = append(containers, pod.Spec.InitContainers...)\n\n\t\t\t\t\tfor _, c := range containers {\n\t\t\t\t\t\tif !containerFilter.MatchString(c.Name) {\n\t\t\t\t\t\t\tlogger.Info(\"filtered\", \"container\", c.Name, \"filter\", containerFilter.String())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif containerExcludeFilter != nil && containerExcludeFilter.MatchString(c.Name) {\n\t\t\t\t\t\t\tlogger.Info(\"excluded\", \"container\", c.Name, \"exclude-filter\", containerExcludeFilter.String())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlogger.Info(\"report removed\", \"container\", c.Name, \"pod\", pod.Name, \"namespace\", pod.Namespace)\n\t\t\t\t\t\tremoved <- &Target{\n\t\t\t\t\t\t\tNamespace: pod.Namespace,\n\t\t\t\t\t\t\tPod: pod.Name,\n\t\t\t\t\t\t\tContainer: c.Name,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlogger.Info(\"received stop request\")\n\t\t\t\twatcher.Stop()\n\t\t\t\tclose(added)\n\t\t\t\tclose(removed)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tlogger.Info(\"pass watch report channels\")\n\treturn added, removed, nil\n}", "func (node *Node) PATCH(functions ...interface{}) *Handler {\n\n\thandler := &Handler{}\n\n\tif len(functions) > 0 { handler.function = functions[0].(func (req web.RequestInterface) *web.ResponseStatus) }\n\n\tnode.addHandler(\"PATCH\", handler)\n\n\treturn handler\n}", "func (x *fastReflection_ValidatorSlashEventRecord) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.ValidatorSlashEventRecord.validator_slash_event\":\n\t\tif x.ValidatorSlashEvent == nil {\n\t\t\tx.ValidatorSlashEvent = new(ValidatorSlashEvent)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.ValidatorSlashEvent.ProtoReflect())\n\tcase \"cosmos.distribution.v1beta1.ValidatorSlashEventRecord.validator_address\":\n\t\tpanic(fmt.Errorf(\"field validator_address of message cosmos.distribution.v1beta1.ValidatorSlashEventRecord is not mutable\"))\n\tcase \"cosmos.distribution.v1beta1.ValidatorSlashEventRecord.height\":\n\t\tpanic(fmt.Errorf(\"field height of message cosmos.distribution.v1beta1.ValidatorSlashEventRecord is not mutable\"))\n\tcase \"cosmos.distribution.v1beta1.ValidatorSlashEventRecord.period\":\n\t\tpanic(fmt.Errorf(\"field period of message cosmos.distribution.v1beta1.ValidatorSlashEventRecord is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.ValidatorSlashEventRecord\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.ValidatorSlashEventRecord does not contain field %s\", fd.FullName()))\n\t}\n}", "func (m *MobileAppTroubleshootingEventsMobileAppTroubleshootingEventItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable, requestConfiguration *MobileAppTroubleshootingEventsMobileAppTroubleshootingEventItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, 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.CreateMobileAppTroubleshootingEventFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable), nil\n}", "func (c *FakeRuleEndpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *rulesv1.RuleEndpoint, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(ruleendpointsResource, c.ns, name, pt, data, subresources...), &rulesv1.RuleEndpoint{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*rulesv1.RuleEndpoint), err\n}", "func (r *OrganizationsEnvironmentsTraceConfigOverridesService) Patch(name string, googlecloudapigeev1traceconfigoverride *GoogleCloudApigeeV1TraceConfigOverride) *OrganizationsEnvironmentsTraceConfigOverridesPatchCall {\n\tc := &OrganizationsEnvironmentsTraceConfigOverridesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\tc.googlecloudapigeev1traceconfigoverride = googlecloudapigeev1traceconfigoverride\n\treturn c\n}", "func NewPatch() *Patch {\n\treturn &Patch{\n\t\tpatchOps: []*patchOp{},\n\t}\n}", "func (r *versionResolver) Patch(ctx context.Context, obj *restModel.APIVersion) (*restModel.APIPatch, error) {\n\tif !evergreen.IsPatchRequester(*obj.Requester) {\n\t\treturn nil, nil\n\t}\n\tapiPatch, err := data.FindPatchById(*obj.Id)\n\tif err != nil {\n\t\treturn nil, InternalServerError.Send(ctx, fmt.Sprintf(\"Couldn't find a patch with id '%s': %s\", *obj.Id, err.Error()))\n\t}\n\treturn apiPatch, nil\n}", "func PatchMethodByReflect(target reflect.Method, redirection interface{}) (*Patch, error) {\n\treturn PatchMethodByReflectValue(target.Func, redirection)\n}", "func (this WebhookFunc) Handle(log logger.LogContext, version string, obj runtime.RawExtension) (runtime.Object, error) {\n\treturn this(log, version, obj)\n}", "func (c *FakeKubeletConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machineconfigurationopenshiftiov1.KubeletConfig, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewRootPatchSubresourceAction(kubeletconfigsResource, name, pt, data, subresources...), &machineconfigurationopenshiftiov1.KubeletConfig{})\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*machineconfigurationopenshiftiov1.KubeletConfig), err\n}", "func (h *HttpHandlerFactory) NewUpdateHandler(mutator WebhookUpdateHandler) http.HandlerFunc {\n\tmutateFunc := func(ctx context.Context, review v1beta1.AdmissionReview) ([]PatchOperation, error) {\n\t\t// Decode the new updated CR from the request.\n\t\tobject, err := mutator.Decode(review.Request.Object)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\n\t\townerClusterGetter := func(objectMeta metav1.ObjectMetaAccessor) (capi.Cluster, bool, error) {\n\t\t\townerCluster, ok, err := generic.TryGetOwnerCluster(ctx, h.ctrlClient, object)\n\t\t\tif err != nil {\n\t\t\t\treturn capi.Cluster{}, false, microerror.Mask(err)\n\t\t\t}\n\n\t\t\treturn ownerCluster, ok, nil\n\t\t}\n\n\t\t// Check if the CR should be mutated by the azure-admission-controller.\n\t\tok, err := filter.IsObjectReconciledByLegacyRelease(ctx, h.logger, h.ctrlReader, object, ownerClusterGetter)\n\t\tif err != nil {\n\t\t\treturn nil, microerror.Mask(err)\n\t\t}\n\n\t\tvar patch []PatchOperation\n\n\t\tif ok {\n\t\t\t// Decode the old CR from the request (before the update).\n\t\t\toldObject, err := mutator.Decode(review.Request.OldObject)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, microerror.Mask(err)\n\t\t\t}\n\n\t\t\t// Mutate the CR and get patch for those mutations.\n\t\t\tpatch, err = mutator.OnUpdateMutate(ctx, oldObject, object)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, microerror.Mask(err)\n\t\t\t}\n\t\t}\n\n\t\treturn patch, nil\n\t}\n\n\treturn h.newHttpHandler(mutator, mutateFunc)\n}", "func Patch(path string, fn http.HandlerFunc, c ...alice.Constructor) {\n\tinfoMutex.Lock()\n\trecord(\"PATCH\", path)\n\tr.Patch(path, alice.New(c...).ThenFunc(fn).(http.HandlerFunc))\n\tinfoMutex.Unlock()\n}", "func (s *externalServiceClient) Patch(o *ExternalService, patchType types.PatchType, data []byte, subresources ...string) (*ExternalService, error) {\n\tobj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)\n\treturn obj.(*ExternalService), err\n}", "func PatchMethodByReflectValue(target reflect.Value, redirection interface{}) (*Patch, error) {\n\ttValue := &target\n\trValue := getValueFrom(redirection)\n\tif err := isPatchable(tValue, &rValue); err != nil {\n\t\treturn nil, err\n\t}\n\tpatch := &Patch{target: tValue, redirection: &rValue}\n\tif err := applyPatch(patch); err != nil {\n\t\treturn nil, err\n\t}\n\treturn patch, nil\n}", "func PatchMethodWithMakeFuncValue(target reflect.Value, fn func(args []reflect.Value) (results []reflect.Value)) (*Patch, error) {\n\treturn PatchMethodByReflectValue(target, reflect.MakeFunc(target.Type(), fn))\n}", "func (patchwork *Patchwork) Patch(p func(repo github.Repository, directory string)) {\n\tpatchwork.patch = p\n}", "func (o PodsMetricSourcePatchPtrOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v *PodsMetricSourcePatch) *MetricTargetPatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(MetricTargetPatchPtrOutput)\n}", "func SchedulePatch(ctx context.Context, env evergreen.Environment, patchId string, version *model.Version, patchUpdateReq model.PatchUpdate) (int, error) {\n\tvar err error\n\tp, err := patch.FindOneId(patchId)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"loading patch '%s'\", patchId)\n\t}\n\tif p == nil {\n\t\treturn http.StatusBadRequest, errors.Errorf(\"patch '%s' not found\", patchId)\n\t}\n\n\tif p.IsCommitQueuePatch() {\n\t\treturn http.StatusBadRequest, errors.New(\"can't schedule commit queue patch\")\n\t}\n\tprojectRef, err := model.FindMergedProjectRef(p.Project, p.Version, true)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"finding project ref '%s' for version '%s'\", p.Project, p.Version)\n\t}\n\tif projectRef == nil {\n\t\treturn http.StatusInternalServerError, errors.Errorf(\"project '%s' for version '%s' not found\", p.Project, p.Version)\n\t}\n\n\tstatusCode, err := model.ConfigurePatch(ctx, env.Settings(), p, version, projectRef, patchUpdateReq)\n\tif err != nil {\n\t\treturn statusCode, err\n\t}\n\tif p.Version != \"\" { // if the version already exists, no more to do\n\t\treturn http.StatusOK, nil\n\t}\n\n\t// create a separate context from the one the caller has so that the caller\n\t// can't interrupt the db operations here\n\tnewCxt := context.Background()\n\t// Process additional patch trigger aliases added via UI.\n\t// Child patches created with the CLI --trigger-alias flag go through a separate flow, so ensure that new child patches are also created before the parent is finalized.\n\tif err := ProcessTriggerAliases(ctx, p, projectRef, env, patchUpdateReq.PatchTriggerAliases); err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"processing patch trigger aliases\")\n\t}\n\tif len(patchUpdateReq.PatchTriggerAliases) > 0 {\n\t\tp.Triggers.Aliases = patchUpdateReq.PatchTriggerAliases\n\t\tif err = p.SetTriggerAliases(); err != nil {\n\t\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"attaching trigger aliases '%s'\", p.Id.Hex())\n\t\t}\n\t}\n\t_, err = model.FinalizePatch(newCxt, p, p.GetRequester(), \"\")\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"finalizing patch\")\n\t}\n\n\tif p.IsGithubPRPatch() {\n\t\tjob := NewGithubStatusUpdateJobForNewPatch(p.Id.Hex())\n\t\tif err := evergreen.GetEnvironment().LocalQueue().Put(newCxt, job); err != nil {\n\t\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"adding GitHub status update job to queue\")\n\t\t}\n\t}\n\treturn http.StatusOK, nil\n}", "func mutate(newObj runtime.Object) (admission.PatchOps, error) {\n\tsupportBundle := newObj.(*longhorn.SupportBundle)\n\tvar patchOps admission.PatchOps\n\n\tpatchOp, err := common.GetLonghornFinalizerPatchOpIfNeeded(supportBundle)\n\tif err != nil {\n\t\terr := errors.Wrapf(err, \"failed to get finalizer patch for supportBundle %v\", supportBundle.Name)\n\t\treturn nil, werror.NewInvalidError(err.Error(), \"\")\n\t}\n\tif patchOp != \"\" {\n\t\tpatchOps = append(patchOps, patchOp)\n\t}\n\n\treturn patchOps, nil\n}", "func (l *Library) Patch(src *Library) {\n\tif src.Name != \"\" {\n\t\tl.Name = src.Name\n\t}\n\tif src.Description != \"\" {\n\t\tl.Description = src.Description\n\t}\n\tif src.Version != \"\" {\n\t\tl.Version = src.Version\n\t}\n}", "func (r *DeviceManagementAutopilotEventRequest) Update(ctx context.Context, reqObj *DeviceManagementAutopilotEvent) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (wc *watchChan) transform(e *event) (res *watch.Event) {\n\tcurObj, oldObj, err := wc.prepareObjs(e)\n\tif err != nil {\n\t\tlogrus.Errorf(\"failed to prepare current and previous objects: %v\", err)\n\t\twc.sendError(err)\n\t\treturn nil\n\t}\n\tswitch {\n\tcase e.isProgressNotify:\n\t\tobj := wc.watcher.newFunc()\n\t\t// todo: update object version\n\t\tres = &watch.Event{\n\t\t\tType: watch.Bookmark,\n\t\t\tObject: obj,\n\t\t}\n\tcase e.isDeleted:\n\t\tres = &watch.Event{\n\t\t\tType: watch.Deleted,\n\t\t\tObject: oldObj,\n\t\t}\n\tcase e.isCreated:\n\t\tres = &watch.Event{\n\t\t\tType: watch.Added,\n\t\t\tObject: curObj,\n\t\t}\n\tdefault:\n\t\t// TODO: emit ADDED if the modified object causes it to actually pass the filter but the previous one did not\n\t\tres = &watch.Event{\n\t\t\tType: watch.Modified,\n\t\t\tObject: curObj,\n\t\t}\n\t}\n\treturn res\n}", "func (mx *Mux) Patch(pattern string, handlerFn http.HandlerFunc) {\n\tmx.handle(mPATCH, pattern, handlerFn)\n}", "func PATCH(c *httputil.Client, data DataMultipartWriter, v interface{}, url string) error {\n\treturn Do(c, \"PATCH\", data, v, url)\n}", "func NewPatchModifier(log *logrus.Entry) (*PatchModifier, error) {\n\treturn &PatchModifier{\n\t\tLog: log,\n\t}, nil\n}" ]
[ "0.5266063", "0.49771908", "0.48856008", "0.47132525", "0.4605321", "0.45569208", "0.4526433", "0.44783974", "0.44632348", "0.44467813", "0.44410396", "0.434499", "0.4281584", "0.42695108", "0.42690158", "0.42472798", "0.4209925", "0.4201461", "0.41979274", "0.4197556", "0.4176965", "0.41743794", "0.4171769", "0.41709194", "0.41606873", "0.41560796", "0.41479373", "0.41453838", "0.41304782", "0.41158414", "0.41154101", "0.41039342", "0.40952057", "0.40905294", "0.40882108", "0.40789366", "0.40770546", "0.40720868", "0.4064988", "0.40599176", "0.40581384", "0.4052163", "0.4038417", "0.4032913", "0.4027298", "0.40267572", "0.402609", "0.40239665", "0.40235123", "0.40178734", "0.40159088", "0.40060574", "0.4003291", "0.3991215", "0.3988769", "0.39810666", "0.39792064", "0.39718002", "0.39688116", "0.3966847", "0.39610395", "0.39604837", "0.3957443", "0.3953222", "0.39488837", "0.39468217", "0.39460576", "0.39451298", "0.39443287", "0.39423868", "0.39375004", "0.3931743", "0.39299905", "0.39276633", "0.39253882", "0.39240125", "0.39230698", "0.39128482", "0.3911989", "0.3909487", "0.39045385", "0.3887611", "0.38868013", "0.38842788", "0.3883352", "0.38803998", "0.38768098", "0.38756272", "0.38650835", "0.38614938", "0.3848636", "0.38483286", "0.3848036", "0.38396147", "0.3838598", "0.3837033", "0.38315803", "0.38218674", "0.38131875", "0.38130844" ]
0.7371751
0
String colorized string message.
func (c contentMessage) String() string { message := console.Colorize("Time", fmt.Sprintf("[%s] ", c.Time.Format(printDate))) message = message + console.Colorize("Size", fmt.Sprintf("%7s ", strings.Join(strings.Fields(humanize.IBytes(uint64(c.Size))), ""))) message = func() string { if c.Filetype == "folder" { return message + console.Colorize("Dir", c.Key) } return message + console.Colorize("File", c.Key) }() return message }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ColorString(code int, str string) string {\n\treturn fmt.Sprintf(\"\\x1b[%d;1m%s\\x1b[39;22m\", code, str)\n}", "func (s Style) String() string {\n\treturn colors2code(s...)\n}", "func (s statement) colorString() string {\n\tout := make([]string, 0, len(s)+2)\n\tfor _, t := range s {\n\t\tout = append(out, t.formatColor())\n\t}\n\treturn strings.Join(out, \"\")\n}", "func (fig figure) ColorString() string {\n\ts := \"\"\n\tfor _, printRow := range fig.Slicify() {\n\t\tif fig.color != \"\" {\n\t\t\tprintRow = colors[fig.color] + printRow + colors[\"reset\"]\n\t\t}\n\t\ts += fmt.Sprintf(\"%s\\n\", printRow)\n\t}\n\treturn s\n}", "func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) }", "func RedString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgRed, format, a...)\n\treturn\n}", "func (c Colour) String() string {\n\treturn fmt.Sprintf(\"R: %d G: %d B: %d L: %d (#%02X%02X%02X%02X)\", c.R, c.G, c.B, c.L, c.R, c.G, c.B, c.L)\n}", "func C(str, color string) string {\n\tif runtime.GOOS == \"windows\" {\n\t\treturn str\n\t}\n\treturn ansi.Color(fmt.Sprint(str), color)\n}", "func ColorString(mode RenderMode, px Pixel) string {\n\tif px.alpha < TRANSPARENCY_THRESHOLD {\n\t\treturn \"\" // sentinel for transparent colors\n\t}\n\tif mode == term24bit {\n\t\tr, g, b := px.color.RGB255()\n\t\treturn fmt.Sprintf(\"%d;%d;%d\", r, g, b)\n\t}\n\tresult := 0\n\tlast := len(colors[mode]) - 1\n\tdist := ColorDistance(mode, px.color, colors[mode][last])\n\t// start from the end so higher color indices are favored in the irc palette\n\tfor i := last - 1; i >= 0; i-- {\n\t\td := ColorDistance(mode, px.color, colors[mode][i])\n\t\tif d < dist {\n\t\t\tdist = d\n\t\t\tresult = i\n\t\t}\n\t}\n\treturn strconv.Itoa(result)\n}", "func Color(str string, color int) string {\n\treturn applyTransform(str, func(idx int, line string) string {\n\t\treturn fmt.Sprintf(\"%s%s%s\", getColor(color), line, RESET)\n\t})\n}", "func (c *Color) String() string {\n\treturn fmt.Sprintf(\"#%02x%02x%02x,\", c.R, c.G, c.B)\n}", "func LogColorString(levelname, s string) string {\n\tif !Glog.Printer.IsTerminal {\n\t\treturn s\n\t}\n\treturn LogColorStringFuncs[levelname](s)\n\t// return ColorStringFuncs[Level(glog.Level)](s)\n}", "func (c Color) String() string {\n\treturn string(c)\n}", "func YellowString(format string, a ...interface{}) string { return colorString(format, FgYellow, a...) }", "func (c RGB) String() string {\n\treturn fmt.Sprintf(\"#%02X%02X%02X\", c.R, c.G, c.B)\n}", "func (c *Color) String() string {\n\tif c == nil {\n\t\treturn \"nil\"\n\t}\n\treturn fmt.Sprintf(\"R: %v G: %v B: %v A: %v\", c.R, c.G, c.B, c.A)\n}", "func (s statusMessage) String() string {\n\tswitch s.status {\n\tcase subtleStatusMessage:\n\t\treturn ui.DimGreenFg(s.message)\n\tcase errorStatusMessage:\n\t\treturn ui.RedFg(s.message)\n\tdefault:\n\t\treturn ui.GreenFg(s.message)\n\t}\n}", "func color(str string, logLevel LogLevel) string {\n\tif !colorEnabled() {\n\t\treturn str\n\t}\n\n\tvar color string\n\n\tswitch logLevel {\n\tcase LevelError:\n\t\tcolor = \"\\033[1;31m\" // Red\n\tcase LevelWarn:\n\t\tcolor = \"\\033[1;33m\" // Yellow\n\tcase LevelInfo:\n\t\tcolor = \"\\033[1;34m\" // Blue\n\tcase LevelDebug:\n\t\tcolor = \"\\033[0;36m\" // Cyan\n\tcase LevelTrace:\n\t\tcolor = \"\\033[0;37m\" // White\n\tdefault:\n\t\tcolor = \"\\033[0m\" // None\n\t}\n\n\treturn color + str + \"\\033[0m\"\n}", "func HiRedString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgHiRed, format, a...)\n\treturn\n}", "func YellowString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgYellow, format, a...)\n\treturn\n}", "func CyanString(format string, a ...interface{}) string { return colorString(format, FgCyan, a...) }", "func (c Color256) String() string {\n\treturn fmt.Sprintf(\"38;05;%d\", c)\n}", "func (c Color256) String() string {\n\treturn fmt.Sprintf(\"38;05;%d\", c)\n}", "func color(s string, color string) string {\n\treturn \"\\033[\" + color + \"m\" + s + \"\\033[0m\"\n}", "func (r TCellColor) String() string {\n\tc := r.tc - 2\n\tif c == -2 {\n\t\treturn \"[no-color]\"\n\t} else {\n\t\treturn fmt.Sprintf(\"TCellColor(%v)\", tcell.Color(c))\n\t}\n}", "func (e Color) String() string {\n name, _ := colorMap[int32(e)]\n return name\n}", "func (m *Message) String() string {\n\tbuffer := bytes.NewBufferString(\"\")\n\terr := m.tpl.Execute(buffer, m)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"%s\\n\", m.Content)\n\t}\n\tstr := buffer.String()\n\tif m.color {\n\t\tstr = ansi.Color(str, Colors[m.Level])\n\t}\n\treturn str\n}", "func (c Color) String() string {\n\treturn fmt.Sprintf(\"%d\", c)\n}", "func GetColoredString(str string, fgcolor string, bgcolor string) string {\n\tcoloredString := \"\"\n\n\tif len(fgcolor) != 0 {\n\t\tif len(FGcolors[fgcolor]) != 0 {\n\t\t\tcoloredString = fmt.Sprintf(\"%s%c[%sm\", coloredString, 27, FGcolors[fgcolor])\n\t\t}\n\t}\n\n\tif len(bgcolor) != 0 {\n\t\tif len(BGcolors[bgcolor]) != 0 {\n\t\t\tcoloredString = fmt.Sprintf(\"%s%c[%sm\", coloredString, 27, BGcolors[bgcolor])\n\t\t}\n\t}\n\n\tcoloredString = fmt.Sprintf(\"%s%s%c[0m\", coloredString, str, 27)\n\t// return $coloredString;\n\treturn coloredString\n}", "func GreenString(format string, a ...interface{}) string { return colorString(format, FgGreen, a...) }", "func HiRedString(format string, a ...interface{}) string { return colorString(format, FgHiRed, a...) }", "func green(str string) string {\n\treturn \"\\033[32m\\033[1m\" + str + \"\\033[0m\"\n}", "func red(str string) string {\n return(\"\\033[91m\" + bold(str) + \"\\033[0m\")\n}", "func (color Color) ansiString(foreground bool) string {\n\tvalue := color.colorValue()\n\n\tfgBgMarker := \"3\"\n\tif !foreground {\n\t\tfgBgMarker = \"4\"\n\t}\n\n\tif color.colorType() == colorType16 {\n\t\tif value < 8 {\n\t\t\treturn fmt.Sprint(\"\\x1b[\", fgBgMarker, value, \"m\")\n\t\t} else if value <= 15 {\n\t\t\tfgBgMarker := \"9\"\n\t\t\tif !foreground {\n\t\t\t\tfgBgMarker = \"10\"\n\t\t\t}\n\t\t\treturn fmt.Sprint(\"\\x1b[\", fgBgMarker, value-8, \"m\")\n\t\t}\n\t}\n\n\tif color.colorType() == colorType256 {\n\t\tif value <= 255 {\n\t\t\treturn fmt.Sprint(\"\\x1b[\", fgBgMarker, \"8;5;\", value, \"m\")\n\t\t}\n\t}\n\n\tif color.colorType() == colorType24bit {\n\t\tred := (value & 0xff0000) >> 16\n\t\tgreen := (value & 0xff00) >> 8\n\t\tblue := value & 0xff\n\n\t\treturn fmt.Sprint(\"\\x1b[\", fgBgMarker, \"8;2;\", red, \";\", green, \";\", blue, \"m\")\n\t}\n\n\tif color.colorType() == colorTypeDefault {\n\t\treturn fmt.Sprint(\"\\x1b[\", fgBgMarker, \"9m\")\n\t}\n\n\tpanic(fmt.Errorf(\"unhandled color type=%d value=%#x\", color.colorType(), value))\n}", "func (c Color) String() string {\n\treturn colorMap[c].Color\n}", "func green(str string) string {\n return(\"\\033[92m\" + bold(str) + \"\\033[0m\")\n}", "func (f findMSG) String() string {\n\treturn console.Colorize(\"Find\", f.Path)\n}", "func (c *Color) String() string {\n\treturn \"c(\" + floatToString(c.r, 8) + \",\" + floatToString(c.g, 8) + \",\" + floatToString(c.b, 8) + \")\"\n}", "func red(str string) string {\n\treturn \"\\033[31m\\033[1m\" + str + \"\\033[0m\"\n}", "func WhiteString(format string, a ...interface{}) string { return colorString(format, FgWhite, a...) }", "func colorize(s interface{}, c int) string {\n\treturn fmt.Sprintf(\"\\x1b[%dm%v\\x1b[0m\", c, s)\n}", "func colorize(s interface{}, c int) string {\n\treturn fmt.Sprintf(\"\\x1b[%dm%v\\x1b[0m\", c, s)\n}", "func (c RGB) String() string {\n\treturn strings.Join([]string{\n\t\tstrconv.Itoa(c.R),\n\t\tstrconv.Itoa(c.G),\n\t\tstrconv.Itoa(c.B),\n\t}, \",\")\n}", "func GreenString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgGreen, format, a...)\n\treturn\n}", "func statusColorize(input string) string {\n output := input\n\n output = strings.Replace( output, \"RUN\", cCyan + \"RUN\" + cClr, -1 )\n output = strings.Replace( output, \"PASS\", cBold + cGreen + \"PASS\" + cClr, -1 )\n output = strings.Replace( output, \"FAIL\", cRed + \"FAIL\" + cClr, -1 )\n output = strings.Replace( output, \"ok \", cGreen + \"ok \" + cClr, -1 )\n\n return output\n}", "func (colour *TextColour) String() string {\n\t/* no breaks needed in switch statement, use 'fallthrough' keyword\n\t * when you really need that behaviour. also switch works on pretty\n\t * much any type :) */\n\tswitch colour {\n\tcase W:\n\t\treturn \"W\"\n\tcase R:\n\t\treturn \"R\"\n\tcase G:\n\t\treturn \"G\"\n\tcase B:\n\t\treturn \"B\"\n\tcase C:\n\t\treturn \"C\"\n\tcase M:\n\t\treturn \"M\"\n\tcase Y:\n\t\treturn \"Y\"\n\tcase K:\n\t\treturn \"K\"\n\t}\n\tpanic(\"unknown colour \", colour)\n}", "func red(str string) string {\n\treturn fmt.Sprintf(\"\\033[1;31m%s\\033[0m\", str)\n}", "func (c Color) String() string {\n\treturn ColorValueToName[int(c)]\n}", "func colorize(l Level, s string) string {\n\tif DisableColor {\n\t\treturn s\n\t}\n\treturn colorstring.Color(levelColor[l] + s)\n}", "func Colorize(color Color, text string) string {\n\treturn fmt.Sprintf(\"%s%s%s\", string(color), text, string(Normal))\n}", "func (c Color) String() string {\n\tswitch c {\n\tcase ColorIOTA:\n\t\treturn \"IOTA\"\n\tcase ColorMint:\n\t\treturn \"MINT\"\n\tdefault:\n\t\treturn c.Base58()\n\t}\n}", "func (c Color) Sprint(a ...interface{}) string {\n\tmessage := Sprint(a...)\n\tmessageLines := strings.Split(message, \"\\n\")\n\tfor i, line := range messageLines {\n\t\tmessageLines[i] = color.RenderCode(c.String(), strings.ReplaceAll(line, color.ResetSet, Sprintf(\"\\x1b[0m\\u001B[%sm\", c.String())))\n\t}\n\tmessage = strings.Join(messageLines, \"\\n\")\n\treturn message\n}", "func (d *Dispatcher) coloredText(color string, text string) string {\n\tif color == \"\" {\n\t\treturn text\n\t}\n\n\treturn \"<font data-mx-color='\" + color + \"'>\" + text + \"</font>\"\n}", "func formatText(message *Message, colors bool) string {\n\tvar mitmFunc fitm.FormatMitm\n\n\tif colors {\n\t\tmitmFunc = fitmApplyColors\n\t} else {\n\t\tmitmFunc = fitmDiscardColors\n\t}\n\n\treturn fitm.Sprintf(mitmFunc, message.Format(), message.FormatArgs()...)\n}", "func LogGreen(str string) {\n\tfmt.Printf(\"\\x1b[32;2m%s\\x1b[0m\\n\", str)\n}", "func (msg *Message) String() string {\n\treturn msg.Render()\n}", "func (c Color) Format(s string) string {\n\treturn fmt.Sprintf(\"\\x1b[%dm%s\\x1b[0m\", c, s)\n}", "func (c contentMessage) String() string {\n\tmessage := console.Colorize(\"Time\", fmt.Sprintf(\"[%s]\", c.Time.Format(printDate)))\n\tmessage += console.Colorize(\"Size\", fmt.Sprintf(\"%7s\", strings.Join(strings.Fields(humanize.IBytes(uint64(c.Size))), \"\")))\n\tfileDesc := \"\"\n\n\tif c.VersionID != \"\" {\n\t\tfileDesc += console.Colorize(\"VersionID\", \" \"+c.VersionID) + console.Colorize(\"VersionOrd\", fmt.Sprintf(\" v%d\", c.VersionOrd))\n\t\tif c.IsDeleteMarker {\n\t\t\tfileDesc += console.Colorize(\"DEL\", \" DEL\")\n\t\t} else {\n\t\t\tfileDesc += console.Colorize(\"PUT\", \" PUT\")\n\t\t}\n\t}\n\n\tfileDesc += \" \" + c.Key\n\n\tif c.Filetype == \"folder\" {\n\t\tmessage += console.Colorize(\"Dir\", fileDesc)\n\t} else {\n\t\tmessage += console.Colorize(\"File\", fileDesc)\n\t}\n\treturn message\n}", "func (e Color2) String() string {\n name, _ := color2Map[int32(e)]\n return name\n}", "func BlueString(format string, a ...interface{}) string { return colorString(format, FgBlue, a...) }", "func colorize(s, color string) string {\n\ts = fmt.Sprintf(color, doublePercent(s))\n\treturn singlePercent(s)\n}", "func ColoredStringDirect(str string, colour *color.Color) string {\n\treturn colour.SprintFunc()(fmt.Sprint(str))\n}", "func DisplayMessage(msg string) {\n\tcolor.Set(color.FgRed)\n\tfmt.Println(msg)\n\tcolor.Unset()\n}", "func LogRed(str string) {\n\tfmt.Printf(\"\\x1b[31;2m%s\\x1b[0m\\n\", str)\n}", "func (c *Color) HexString() string {\n\tif c == nil {\n\t\treturn \"nil\"\n\t}\n\treturn fmt.Sprintf(\"#%02X%02X%02X%02X\", c.R, c.G, c.B, c.A)\n}", "func CyanString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgCyan, format, a...)\n\treturn\n}", "func (s policyLinksMessage) String() string {\n\treturn console.Colorize(\"Policy\", string(s.URL))\n}", "func ColorText(colorCode, text string) string {\n\treturn colourText(colorCode, text)\n}", "func Red(v ...interface{}) string {\n\treturn fmt.Sprintf(\"%c[1;0;31m%s%c[0m\", 0x1B, v, 0x1B)\n}", "func HiGreenString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgHiGreen, format, a...)\n\treturn\n}", "func Green(v ...interface{}) string {\n\treturn fmt.Sprintf(\"%c[1;0;32m%s%c[0m\", 0x1B, v, 0x1B)\n}", "func decorate(s string, color string) string {\n\tswitch color {\n\tcase \"green\":\n\t\ts = \"\\x1b[0;32m\" + s\n\tcase \"red\":\n\t\ts = \"\\x1b[0;31m\" + s\n\tdefault:\n\t\treturn s\n\t}\n\treturn s + \"\\x1b[0m\"\n}", "func (c RGB) HexString() string {\n\treturn fmt.Sprintf(\"#%02x%02x%02x\", c.R, c.G, c.B)\n}", "func (p *Printer) String() string {\n\t// panic(\"implement me\")\n\treturn p.ColorCode\n}", "func (c *ColorFlag) String() string {\n\treturn fmt.Sprintf(\"0x%x\", *c)\n}", "func messageString(t *testing.T, m *browser.Message) string {\n\tt.Helper()\n\n\tvar s []string\n\tif m != nil && len(m.Measurements) > 0 {\n\t\ts = append(s, strings.Join(m.Measurements, \"-\"))\n\t}\n\tif m != nil && len(m.Stations) > 0 {\n\t\ts = append(s, strings.Join(m.Stations, \"-\"))\n\t}\n\tif m != nil && len(m.Landuse) > 0 {\n\t\ts = append(s, strings.Join(m.Landuse, \"-\"))\n\t}\n\n\treturn strings.Join(s, \"_\")\n}", "func HiYellowString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgHiYellow, format, a...)\n\treturn\n}", "func (this *IrcMessage) String() string {\n\tprefix := \"\"\n\tparameters := \"\"\n\n\tif len(this.Prefix.String()) > 0 {\n\t\tprefix = fmt.Sprintf(\":%s \", this.Prefix.String())\n\t}\n\n\tif len(this.Parameters) > 0 {\n\t\tpcount := len(this.Parameters)\n\t\tif strings.Contains(this.Parameters[pcount-1], \" \") {\n\t\t\tif pcount > 1 {\n\t\t\t\tparameters = strings.Join(this.Parameters[0:pcount-1], \" \")\n\t\t\t\tparameters = fmt.Sprintf(\" %s :%s\", parameters, this.Parameters[pcount-1])\n\t\t\t} else {\n\t\t\t\tparameters = \" :\" + this.Parameters[pcount-1]\n\t\t\t}\n\t\t} else {\n\t\t\tparameters = \" \"\n\t\t\tparameters += strings.Join(this.Parameters, \" \")\n\t\t}\n\t}\n\n\treturn fmt.Sprintf(\"%s%s%s\", prefix, this.Command, parameters)\n}", "func (c Color256) Format(s string) string {\n\treturn \"\\033[\" + c.String() + \"m\" + s + Reset\n}", "func (c Color256) Format(s string) string {\n\treturn \"\\033[\" + c.String() + \"m\" + s + Reset\n}", "func (gc gateColor) String() string {\n\tswitch gc {\n\tcase purple:\n\t\treturn \"Purple\"\n\tcase blue:\n\t\treturn \"Blue\"\n\tcase teal:\n\t\treturn \"Teal\"\n\tcase green:\n\t\treturn \"Green\"\n\t}\n\treturn \"\"\n}", "func Color(text string, colors ...string) string {\n\t// The windows terminal has no color support.\n\tif runtime.GOOS == \"windows\" {\n\t\treturn text\n\t}\n\treturn esc(strings.Join(colors, \";\")) + text + esc(Default)\n}", "func Color() string {\n\treturn lookup(lang, \"colors\", true)\n}", "func (Screen *ScreenManager) Color(str string, color int) string {\n\treturn applyScreenTransform(str, func(idx int, line string) string {\n\t\treturn fmt.Sprintf(\"%s%s%s\", getScreenColor(color), line, RESET)\n\t})\n}", "func (t Text) String() string {\n\tbuf := make([]byte, 0, 64)\n\tfor _, segment := range t {\n\t\tstyleBuf := make([]string, 0, 8)\n\n\t\tif segment.Bold {\n\t\t\tstyleBuf = append(styleBuf, \"1\")\n\t\t}\n\t\tif segment.Dim {\n\t\t\tstyleBuf = append(styleBuf, \"2\")\n\t\t}\n\t\tif segment.Italic {\n\t\t\tstyleBuf = append(styleBuf, \"3\")\n\t\t}\n\t\tif segment.Underlined {\n\t\t\tstyleBuf = append(styleBuf, \"4\")\n\t\t}\n\t\tif segment.Blink {\n\t\t\tstyleBuf = append(styleBuf, \"5\")\n\t\t}\n\t\tif segment.Inverse {\n\t\t\tstyleBuf = append(styleBuf, \"7\")\n\t\t}\n\n\t\tif segment.Foreground != \"\" {\n\t\t\tif col, ok := colorTranslationTable[segment.Foreground]; ok {\n\t\t\t\tstyleBuf = append(styleBuf, col)\n\t\t\t}\n\t\t}\n\t\tif segment.Background != \"\" {\n\t\t\tif col, ok := colorTranslationTable[\"bg-\"+segment.Background]; ok {\n\t\t\t\tstyleBuf = append(styleBuf, col)\n\t\t\t}\n\t\t}\n\n\t\tif len(styleBuf) > 0 {\n\t\t\tbuf = append(buf, \"\\033[\"...)\n\t\t\tbuf = append(buf, strings.Join(styleBuf, \";\")...)\n\t\t\tbuf = append(buf, 'm')\n\t\t\tbuf = append(buf, segment.Text...)\n\t\t\tbuf = append(buf, \"\\033[m\"...)\n\t\t} else {\n\t\t\tbuf = append(buf, segment.Text...)\n\t\t}\n\t}\n\treturn string(buf)\n}", "func Yellow(v ...interface{}) string {\n\treturn fmt.Sprintf(\"%c[1;0;33m%s%c[0m\", 0x1B, v, 0x1B)\n}", "func message(level string, message string) {\n\tswitch level {\n\tcase \"info\":\n\t\tcolor.Cyan(\"[i]\" + message)\n\tcase \"note\":\n\t\tcolor.Yellow(\"[-]\" + message)\n\tcase \"warn\":\n\t\tcolor.Red(\"[!]\" + message)\n\tcase \"debug\":\n\t\tcolor.Red(\"[DEBUG]\" + message)\n\tcase \"success\":\n\t\tcolor.Green(\"[+]\" + message)\n\tdefault:\n\t\tcolor.Red(\"[_-_]Invalid message level: \" + message)\n\t}\n}", "func message(level string, message string) {\n\tswitch level {\n\tcase \"info\":\n\t\tcolor.Cyan(\"[i]\" + message)\n\tcase \"note\":\n\t\tcolor.Yellow(\"[-]\" + message)\n\tcase \"warn\":\n\t\tcolor.Red(\"[!]\" + message)\n\tcase \"debug\":\n\t\tcolor.Red(\"[DEBUG]\" + message)\n\tcase \"success\":\n\t\tcolor.Green(\"[+]\" + message)\n\tdefault:\n\t\tcolor.Red(\"[_-_]Invalid message level: \" + message)\n\t}\n}", "func render(m diag.Message, colorize bool) string {\n\treturn fmt.Sprintf(\"%s%v%s [%v]%s %s\",\n\t\tcolorPrefix(m, colorize), m.Type.Level(), colorSuffix(colorize),\n\t\tm.Type.Code(), m.Origin(), fmt.Sprintf(m.Type.Template(), m.Parameters...),\n\t)\n}", "func (t Token) String() string {\n\treturn color.NewString(\"%v %v\", color.Green(t.ID), color.Yellow(t.Value)).String()\n}", "func (me TxsdPresentationAttributesColorColorInterpolation) String() string {\n\treturn xsdt.String(me).String()\n}", "func PrintString(x, y int, fg, bg termbox.Attribute, msg string) {\n\tfor _, c := range msg {\n\t\ttermbox.SetCell(x, y, c, termbox.ColorWhite, bg)\n\t\tx++\n\t}\n}", "func applyColor(f, s string) string {\n\treturn f + s + log.ColorNone\n}", "func (s Style) Sprint(a ...interface{}) string {\n\tmessage := Sprint(a...)\n\tmessageLines := strings.Split(message, \"\\n\")\n\tfor i, line := range messageLines {\n\t\tmessageLines[i] = color.RenderCode(s.String(), strings.ReplaceAll(line, color.ResetSet, Sprintf(\"\\x1b[0m\\u001B[%sm\", s.String())))\n\t}\n\tmessage = strings.Join(messageLines, \"\\n\")\n\treturn color.RenderCode(s.String(), message)\n}", "func CSprintf(fgcolor string, bgcolor string, format string, vars ...interface{}) string {\n\ttmp := GetColoredString(format, fgcolor, bgcolor)\n\treturn fmt.Sprintf(tmp, vars...)\n}", "func (c *HEXColor) String() string {\n\treturn c.hex\n}", "func MagentaString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgMagenta, format, a...)\n\treturn\n}", "func (r SqlMsg) String() string {\n\tif r[0] == '#' {\n\t\tcode := r[1:6]\n\t\treturn fmt.Sprintf(\"(%v): %v\", code, r[6:])\n\t}\n\treturn string(r)\n}", "func GetRarityColoredString(data string, rarity string) string {\n\treturn rarityColorMap[rarity](data)\n}", "func WhiteString(format string, a ...interface{}) (s string) {\n\ts = colorString(FgWhite, format, a...)\n\treturn\n}" ]
[ "0.7172207", "0.68433386", "0.67938584", "0.6777948", "0.66997826", "0.6699148", "0.66343457", "0.66196483", "0.65795577", "0.6576471", "0.6563334", "0.6556685", "0.65492076", "0.6487279", "0.6477751", "0.6475352", "0.64554566", "0.6381751", "0.63747114", "0.6372769", "0.63525176", "0.63400537", "0.63400537", "0.6325615", "0.6307128", "0.6297486", "0.62791383", "0.6272806", "0.627038", "0.62696946", "0.626082", "0.6259201", "0.62493783", "0.62473714", "0.6232469", "0.62217355", "0.61978376", "0.61854655", "0.6185166", "0.6143331", "0.61397", "0.61397", "0.6134312", "0.61016935", "0.6097818", "0.6086144", "0.6084635", "0.60816264", "0.6062308", "0.60388106", "0.6023133", "0.60187703", "0.5999037", "0.5981191", "0.5906218", "0.5885638", "0.5867116", "0.5856264", "0.58520365", "0.58403856", "0.58322895", "0.582084", "0.5818256", "0.58017385", "0.5798769", "0.57966876", "0.57966864", "0.57923913", "0.57851857", "0.57797843", "0.5755988", "0.5755092", "0.5750409", "0.57484424", "0.5740041", "0.5733075", "0.573195", "0.5730558", "0.57300776", "0.57300776", "0.57140976", "0.5712462", "0.57028073", "0.5688231", "0.56869006", "0.56842035", "0.56797737", "0.56797737", "0.5675104", "0.5675039", "0.5671797", "0.5663826", "0.5657865", "0.5654964", "0.565326", "0.5639348", "0.5637992", "0.5636119", "0.56349754", "0.5631395" ]
0.61758167
39
JSON jsonified content message.
func (c contentMessage) JSON() string { c.Status = "success" jsonMessageBytes, e := json.MarshalIndent(c, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(jsonMessageBytes) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (msg *Message) JsonContent() (string, error) {\n\t//if msg.Content == nil {\n\t//\treturn \"\", nil\n\t//}\n\tb, err := json.Marshal(msg.Content)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "func (m lockCmdMessage) JSON() string {\n\tmsgBytes, e := json.MarshalIndent(m, \"\", \" \")\n\tfatalIf(probe.NewError(e), \"Unable to marshal into JSON.\")\n\treturn string(msgBytes)\n}", "func (msg *Any) JSON() []byte {\n\tjsonBytes, err := json.Marshal(*msg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jsonBytes\n}", "func (a *AppController) JSON() {\n\tm := messagePool.Get().(*models.Message)\n\tm.Message = helloWorldMsg\n\ta.Reply().JSON(m)\n}", "func (s SizeMessage) JSON() string {\n\treturn strutil.JSON(s)\n}", "func JsonMessage(writer http.ResponseWriter, info_code int, info_message string) {\n\twriter.WriteHeader(info_code)\n\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\twriter.Write([]byte(\"{\\\"message\\\": \\\"\" + info_message + \"\\\"}\"))\n}", "func (msg *Message) Json() (string, error) {\n\tb, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "func JSON(ctx *fasthttp.RequestCtx) {\n\tmessage := acquireMessage()\n\tmessage.Message = helloWorldStr\n\tdata, _ := json.Marshal(message)\n\n\tctx.Response.Header.SetContentType(contentTypeJSON)\n\tctx.Response.SetBody(data)\n\n\treleaseMessage(message)\n}", "func JSON(ctx *fasthttp.RequestCtx) {\n\tmessage := acquireMessage()\n\tmessage.Message = helloWorldStr\n\tdata, _ := json.Marshal(message)\n\n\tctx.Response.Header.SetContentType(contentTypeJSON)\n\tctx.Response.SetBody(data)\n\n\treleaseMessage(message)\n}", "func (h aliasMessage) JSON() string {\n\th.Status = \"success\"\n\tjsonMessageBytes, e := json.MarshalIndent(h, \"\", \" \")\n\tfatalIf(probe.NewError(e), \"Unable to marshal into JSON.\")\n\n\treturn string(jsonMessageBytes)\n}", "func (l legalHoldInfoMessage) JSON() string {\n\tmsgBytes, e := json.MarshalIndent(l, \"\", \" \")\n\tfatalIf(probe.NewError(e), \"Unable to marshal into JSON.\")\n\treturn string(msgBytes)\n}", "func (u eventAddMessage) JSON() string {\n\tu.Status = \"success\"\n\teventAddMessageJSONBytes, e := json.MarshalIndent(u, \"\", \" \")\n\tfatalIf(probe.NewError(e), \"Unable to marshal into JSON.\")\n\treturn string(eventAddMessageJSONBytes)\n}", "func jsonHandler(w http.ResponseWriter, r *http.Request) {\r\n w.Header().Set(\"Content-Type\", \"application/json\")\r\n json.NewEncoder(w).Encode(&Message{helloWorldString})\r\n}", "func (f findMSG) JSON() string {\n\tf.Path = \"path\"\n\tjsonMessageBytes, e := json.Marshal(f)\n\tfatalIf(probe.NewError(e), \"Unable to marshal into JSON.\")\n\n\treturn string(jsonMessageBytes)\n}", "func (s policyMessage) JSON() string {\n\tpolicyJSONBytes, e := json.MarshalIndent(s, \"\", \" \")\n\tfatalIf(probe.NewError(e), \"Unable to marshal into JSON.\")\n\n\treturn string(policyJSONBytes)\n}", "func (d *InfoOutput) JSON() ([]byte, error) {\n\treturn json.Marshal(d.reply)\n}", "func (g *Game) getMessageJson() []byte {\n\te := g.Messages.Pop()\n\tif e == nil {\n\t\treturn nil\n\t}\n\tm := e.Value.(*TextMessage)\n\tb, err := json.Marshal(m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn b\n}", "func (msg *Int64) JSON() []byte {\n\tjsonBytes, err := json.Marshal(*msg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jsonBytes\n}", "func (c *EzClient) JSON(j interface{}) *EzClient {\n\tb, err := json.Marshal(j)\n\tif err == nil {\n\t\tc.body = bytes.NewReader(b)\n\t}\n\n\treturn c\n}", "func (u configExportMessage) JSON() string {\n\tu.Status = \"success\"\n\tstatusJSONBytes, e := json.MarshalIndent(u, \"\", \" \")\n\tfatalIf(probe.NewError(e), \"Unable to marshal into JSON.\")\n\n\treturn string(statusJSONBytes)\n}", "func (s policyLinksMessage) JSON() string {\n\tpolicyJSONBytes, e := json.MarshalIndent(s, \"\", \" \")\n\tfatalIf(probe.NewError(e), \"Unable to marshal into JSON.\")\n\n\treturn string(policyJSONBytes)\n}", "func (msg *Error) JSON() any {\n\tjsonData := H{}\n\tif msg.Meta != nil {\n\t\tvalue := reflect.ValueOf(msg.Meta)\n\t\tswitch value.Kind() {\n\t\tcase reflect.Struct:\n\t\t\treturn msg.Meta\n\t\tcase reflect.Map:\n\t\t\tfor _, key := range value.MapKeys() {\n\t\t\t\tjsonData[key.String()] = value.MapIndex(key).Interface()\n\t\t\t}\n\t\tdefault:\n\t\t\tjsonData[\"meta\"] = msg.Meta\n\t\t}\n\t}\n\tif _, ok := jsonData[\"error\"]; !ok {\n\t\tjsonData[\"error\"] = msg.Error()\n\t}\n\treturn jsonData\n}", "func (r *Request) dumpJson() []byte {\n\tpayload, _ := json.Marshal(r.Message)\n\treturn payload\n}", "func (r *Reply) JSON(data interface{}) *Reply {\n\tr.ContentType(ahttp.ContentTypeJSON.String())\n\tr.Render(&jsonRender{Data: data})\n\treturn r\n}", "func (this Message) String() string {\n\tstr, _ := json.Marshal(this)\n\treturn string(str)\n}", "func ATJsonMessage(writer http.ResponseWriter, info_code int, info_message string) {\n\twriter.WriteHeader(info_code)\n\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\tobj := model.ATResultList{ ResultList: make([]model.ATResult,0) }\n\tobj.ResultList = append(obj.ResultList, model.ATResult{Text: info_message,\n\t\tTimestamp: util.GetTimeNowSting(), Topic: \"K/AI\"})\n\tjson_bytes, _ := json.Marshal(obj)\n\twriter.Write(json_bytes)\n}", "func MessageToJSON(msg Message) string {\n\tvar jl string\n\tb, err := json.Marshal(msg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tjl = string(b)\n\treturn jl\n}", "func (m *Meta) JSON() string {\n\tj, _ := json.MarshalIndent(m, \"\", \" \")\n\treturn string(j)\n}", "func (message *Message) Bytes() ([]byte, error) {\n\treturn json.Marshal(*message) // Return encoded\n}", "func (m Message) String() string {\n\tjm, _ := json.Marshal(m)\n\treturn string(jm)\n}", "func (h *Host) JSON() []byte {\n\tb, _ := json.MarshalIndent(h, \"\", \" \")\n\treturn b\n}", "func ToJSONString(message MessageInterface) string {\n\tarr := ToJSONByteSlice(message)\n\treturn string(arr)\n}", "func (msg *Message) MarshalJSON() (out []byte, err error) {\n\tmsg.buf.Reset()\n\n\terr = msg.buf.WriteByte('{')\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif len(msg.channel) > 0 {\n\t\terr = bufWriteKV(&msg.buf, `\"channel\"`, []byte(msg.channel),\n\t\t\t':', '\"', '\"')\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = msg.buf.WriteByte(',')\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\tif len(msg.username) > 0 {\n\t\terr = bufWriteKV(&msg.buf, `\"username\"`, []byte(msg.username),\n\t\t\t':', '\"', '\"')\n\t} else {\n\t\terr = bufWriteKV(&msg.buf, `\"username\"`, []byte(msg.hostname),\n\t\t\t':', '\"', '\"')\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\terr = msg.buf.WriteByte(',')\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif msg.attc != nil {\n\t\tvar attc []byte\n\n\t\tattc, err = msg.attc.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t_, _ = msg.buf.WriteString(`\"attachments\":[`)\n\t\t_, _ = msg.buf.Write(attc)\n\t\t_ = msg.buf.WriteByte(']')\n\t} else {\n\t\terr = msg.writeText()\n\t}\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = msg.buf.WriteByte('}')\n\tout = msg.buf.Bytes()\n\n\treturn\n}", "func (m Messages) String() string {\n\tjm, _ := json.Marshal(m)\n\treturn string(jm)\n}", "func (c *Controller) Json(data interface{}, status int, msg ...string) {\n ctx := c.Context()\n message := App().Status().Text(status, ctx.Header(\"Accept-Language\", \"\"), msg...)\n r := render.NewJson(map[string]interface{}{\n \"status\": status,\n \"message\": message,\n \"data\": data,\n })\n\n ctx.PushLog(\"status\", status)\n ctx.SetHeader(\"Content-Type\", r.ContentType())\n ctx.End(r.HttpCode(), r.Content())\n}", "func JSON(e interface{}) []byte {\n\tcontents, err := json.Marshal(e)\n\tif err != nil {\n\t\treturn []byte{}\n\t}\n\n\treturn contents\n}", "func (e *HTTPError) JSON() []byte {\n\tval, _ := json.Marshal(e)\n\n\treturn val\n}", "func JsonContent(next http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tnext.ServeHTTP(w, r)\n\t}\n}", "func writeMessage(data interface{}, w io.Writer) error {\n\n\tresBytes, err := jsoniter.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn encodeByteSlice(w, resBytes)\n}", "func (c *Controller) Json(data interface{}, status int, msg ...string) {\n\tctx := c.Context()\n\tmessage := App().Status().Text(status, ctx.Header(\"Accept-Language\", \"\"), msg...)\n\tr := render.NewJson(map[string]interface{}{\n\t\t\"status\": status,\n\t\t\"message\": message,\n\t\t\"data\": data,\n\t})\n\n\tctx.PushLog(\"status\", status)\n\tctx.SetHeader(\"Content-Type\", r.ContentType())\n\thttpStatus := r.HttpCode()\n\tif ctx.Status() > 0 && ctx.Status() != httpStatus {\n\t\thttpStatus = ctx.Status()\n\t}\n\tctx.End(httpStatus, r.Content())\n}", "func JSON(data interface{}, args ...interface{}) string {\n\tw := Writer{\n\t\tOptions: ojg.DefaultOptions,\n\t\tWidth: 80,\n\t\tMaxDepth: 3,\n\t\tSEN: false,\n\t}\n\tw.config(args)\n\tb, _ := w.encode(data)\n\n\treturn string(b)\n}", "func (msg *Message) Content() []byte {\n\treturn msg.content\n}", "func JSONHandler(ctx *atreugo.RequestCtx) error {\n\tmessage := AcquireMessage()\n\tmessage.Message = helloWorldStr\n\terr := ctx.JSONResponse(message)\n\n\tReleaseMessage(message)\n\n\treturn err\n}", "func responderMensajeJson(writer http.ResponseWriter, r *http.Request, code int, codigoDeMensaje string){\n\tresponderJSON(writer, code, map[string]string{\"codigo\": codigoDeMensaje, \"mensaje\": getMensaje(codigoDeMensaje)})\n}", "func (c *Ctx) JSON(data interface{}) error {\n\traw, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Response.SetBodyRaw(raw)\n\tc.Response.Header.SetContentType(MIMEApplicationJSON)\n\treturn nil\n}", "func (m *Message) String() string {\n\tjsonBytes, err := json.MarshalIndent(m, \"\", \" \")\n\t// jsonBytes, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"message error - fail to marshal message to bytes, error: %v\", err)\n\t}\n\treturn string(jsonBytes)\n}", "func JSON(j interface{}) string {\n\tvar buf bytes.Buffer\n\tencoder := json.NewEncoder(&buf)\n\tencoder.SetEscapeHTML(false)\n\tencoder.SetIndent(\"\", \"\")\n\terr := encoder.Encode(j)\n\n\tif err == nil {\n\t\treturn strings.TrimSuffix(buf.String(), \"\\n\")\n\t}\n\n\t// j could not be serialized to json, so let's log the error and return a\n\t// helpful-ish value\n\tError().logGenericArgs(\"error serializing value to json\", err, nil, 1)\n\treturn fmt.Sprintf(\"<error: %v>\", err)\n}", "func (message *Message) ToJson(writer io.Writer) error {\n\tencoder := json.NewEncoder(writer)\n\tencodedMessage := encoder.Encode(message)\n\treturn encodedMessage\n}", "func (e *Response) Json() (ret []byte) {\n\tvar err error\n\tif ret, err = json.Marshal(e); err != nil {\n\t\t//e.Error = fmt.Errorf(\"Error marshal json: %s\", err.Error())\n\t\treturn\n\t}\n\treturn\n}", "func (v Message) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson42239ddeEncodeGithubComKhliengDispatchServer18(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (m *GCMMessage) ToJSON() (string, error) {\n\tb, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "func (h *Handler) JSON(c *fiber.Ctx, status int, data interface{}) error {\n\tif err := c.Status(status).JSON(data); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (v FetchMessages) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson42239ddeEncodeGithubComKhliengDispatchServer24(w, v)\n}", "func (v Messages) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson42239ddeEncodeGithubComKhliengDispatchServer17(w, v)\n}", "func (b Block) Message() []byte {\n\n\tm := Message{}\n\tm.Type = 0\n\t// same as func (m *Message) HandleTimeStamp()\n\t// b.Time = b.Time*2/1000 - 946684800\n\tb.Time = b.Time\n\tm.Data = b\n\n\tms := []Message{}\n\tms = append(ms, m)\n\tresult, _ := json.Marshal(ms)\n\treturn result\n}", "func (j *Job) Json() ([]byte, error) {\n\tjson, err := json.MarshalIndent(j, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn []byte(\"\"), maskAny(err)\n\t}\n\treturn json, nil\n}", "func (c *Client) send(ctx context.Context, session string, content Content) error {\n\t_dt := c.Now\n\tif _dt == nil {\n\t\t_dt = dt.Now\n\t}\n\t_m := newMsg(session, content, _dt)\n\tm := newJSONMsg(_m)\n\tb, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbody := bytes.NewReader(b)\n\tu := c.url(\"/rex/v0/messages\")\n\tresp, err := c.http().Post(u, \"application/json\", body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tb, _ := ioutil.ReadAll(resp.Body)\n\t\treturn fmt.Errorf(\"%v %s %s: %s\", resp.Status, \"POST\", u, b)\n\t}\n\treturn nil\n}", "func (c *connection) writeJson(message msg) error {\n\tc.ws.SetWriteDeadline(time.Now().Add(writeWait))\n\tfmt.Println(\"=>\", message)\n\treturn c.ws.WriteJSON(message)\n}", "func (v Messages) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson42239ddeEncodeGithubComKhliengDispatchServer17(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func JSON() (ret httprpc.Codec) {\n\treturn Danger(\n\t\tfunc(w io.Writer) DangerEncoder {\n\t\t\treturn json.NewEncoder(w)\n\t\t},\n\t\tfunc(r io.Reader) DangerDecoder {\n\t\t\treturn json.NewDecoder(r)\n\t\t},\n\t)\n}", "func (s *ResponseModifier) JSON(data interface{}) error {\n\tbuf := &bytes.Buffer{}\n\n\tswitch data.(type) {\n\tcase string:\n\t\tbuf.WriteString(data.(string))\n\tcase []byte:\n\t\tbuf.Write(data.([]byte))\n\tdefault:\n\t\tif err := json.NewEncoder(buf).Encode(data); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ts.Response.Body = ioutil.NopCloser(buf)\n\ts.Response.ContentLength = int64(buf.Len())\n\ts.Response.Header.Set(\"Content-Type\", \"application/json\")\n\treturn nil\n}", "func (ctx *Context) Json(data interface{}) {\n\tdata, err := json.Marshal(data)\n\tif err != nil {\n\t\tfmt.Println(\"[ERROR] \" + err.Error())\n\t}\n\tctx.writer.Header().Set(\"Content-Type\", \"application/json\")\n\tfmt.Fprintf(ctx.writer, \"%s\", data)\n}", "func jsonError(w http.ResponseWriter, serverMsg string, clientMsg string) {\n\tlog.Error(serverMsg)\n\tpayload := Message{\n\t\tError: clientMsg,\n\t}\n\tresJSON, err := json.Marshal(payload)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to marshal result : %v\", err)\n\t\thttpError(w, msg, msg, http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tfmt.Fprintf(w, \"%s\\n\", string(resJSON))\n\treturn\n}", "func (msg *Message) _marshalJSON() (out []byte, err error) {\n\tstr := `{`\n\n\tif len(msg.channel) > 0 {\n\t\tstr += `\"channel\":\"` + msg.channel + `\",`\n\t}\n\n\tif len(msg.username) > 0 {\n\t\tstr += `\"username\":\"` + msg.username + `\",`\n\t} else {\n\t\tstr += `\"username\":\"` + msg.hostname + `\",`\n\t}\n\n\tif msg.attc != nil {\n\t\tvar attc []byte\n\n\t\tattc, err = msg.attc.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tstr += `\"attachments\":[` + string(attc) + `]`\n\t} else {\n\t\tstr += `\"text\":\"` + msg.getText() + `\"`\n\t}\n\n\tstr += `}`\n\tout = []byte(str)\n\n\treturn\n}", "func jsonResponse(rw http.ResponseWriter, code int, msg string) {\n\trw.Header().Set(\"Content-Type\", \"application/json\")\n\trw.WriteHeader(code)\n\trw.Write([]byte(fmt.Sprintf(`{\"message\":\"%s\"}`, msg)))\n}", "func (cm Message) Serialize() ([]byte, error) {\n\treturn []byte(cm.Content), nil\n}", "func (c *echoContext) JSON(code int, d interface{}) error {\n\treturn c.ctx.JSON(code, d)\n}", "func (em Message) Serialize() ([]byte, error) {\n\tmsg, err := json.Marshal(em)\n\treturn msg, err\n}", "func (m *DynamicMessage) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(m.data)\n}", "func (self *monitoringData) JSON() (jsonString string, e error) {\n\tb, err := json.Marshal(*self)\n\treturn string(b), err\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 (cmd *command) json() []byte {\n\tj, _ := json.Marshal(cmd)\n\treturn append(j, '\\r', '\\n')\n}", "func (c *T) JSON() cast.JSON {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn cast.JSON{\n\t\t\"id\": c.ID,\n\t\t\"cardid\": c.Proto.ID,\n\t\t\"name\": c.Proto.Name,\n\t\t\"costs\": c.Proto.Costs.JSON(),\n\t\t\"text\": c.Proto.Text,\n\t\t\"username\": c.Username,\n\t\t\"image\": c.Proto.Image,\n\t\t\"type\": c.Proto.Type.String(),\n\t\t\"powers\": c.Proto.Powers.JSON(),\n\t}\n}", "func (a EnrichedMessage) String() string {\n\tbytes, _ := json.Marshal(a)\n\n\treturn string(bytes)\n}", "func Json(w http.ResponseWriter, data interface{}) {\n\tjs, err := json.Marshal(data)\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\tw.Write(js)\n}", "func (mp JSONMsgPacker) PackMsg(msg interface{}, buf []byte) ([]byte, error) {\n\tbuffer := bytes.NewBuffer(buf)\n\tjsonEncoder := json.NewEncoder(buffer)\n\terr := jsonEncoder.Encode(msg)\n\tif err != nil {\n\t\treturn buf, err\n\t}\n\tbuf = buffer.Bytes()\n\treturn buf[:len(buf)-1], nil // encoder always put '\\n' at the end, we trim it\n}", "func GetJson(w http.ResponseWriter, Status string, Msg string, httpStatus int) string {\n\tmsgJsonStruct := &JsonMsg{Status, Msg}\n\tmsgJson, errj := json.Marshal(msgJsonStruct)\n\tif errj != nil {\n\t\tmsg := `{\"status\":\"error\",\"message\":\"We could not generate the json error!\"}`\n\t\treturn msg\n\t}\n\treturn string(msgJson)\n}", "func (ctx *Context) JSON(code int, obj interface{}) (err error) {\n\tw := ctx.ResponseWriter\n\tw.Header().Set(HeaderContentType, MIMEApplicationJSONCharsetUTF8)\n\tw.WriteHeader(code)\n\treturn json.NewEncoder(w).Encode(obj)\n}", "func (e *Ender) Message() []byte {\n\tvar msg []byte\n\tbroadcastEndMsg := queues.MessageBroadcastEnd{\n\t\tRoomID: e.roomModel.GetID(),\n\t\tBroadcastID: e.broadcastModel.GetID(),\n\t\tEndTime: time.Now().Unix(),\n\t}\n\n\tdata := struct {\n\t\tType int `json:\"type\"`\n\t\tData interface{} `json:\"data\"`\n\t}{\n\t\te.config.TypeID,\n\t\tbroadcastEndMsg,\n\t}\n\n\tmsg, _ = json.Marshal(data)\n\treturn msg\n}", "func (e *Entity) JSON() string {\n\tif e == nil {\n\t\treturn \"{}\"\n\t}\n\treturn e.data.JSON()\n}", "func JSON(w http.ResponseWriter, data interface{}) {\n\tresponse, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Println(\"Failed to generate json \")\n\t}\n\tfmt.Fprint(w, string(response))\n}", "func (s *Server) JSON(w http.ResponseWriter, status int, data interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\tjson.NewEncoder(w).Encode(data)\n}", "func (c *Context) JSON(code int, data interface{}) {\n\tc.SetHeader(\"Content-Type\", \"application/json\")\n\tc.Status(code)\n\tencoder := json.NewEncoder(c.Writer)\n\tif err := encoder.Encode(data); err != nil {\n\t\thttp.Error(c.Writer, err.Error(), 500)\n\t}\n}", "func (j *Message) MarshalJSON() ([]byte, error) {\n\tvar buf fflib.Buffer\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn buf.Bytes(), nil\n\t}\n\terr := j.MarshalJSONBuf(&buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "func (jf *JFile) JSON() ([]byte, error) {\n\treturn jf.rootnode.PrettyJSON()\n}", "func (r *Response) Message(msg string) JResponseWriter {\n\treturn r.Field(fieldMsg, msg)\n}", "func (q *Query) JSON() (string, error) {\n\tstrCh, err := q.StringChan()\n\tif err != nil {\n\t\treturn \"\", errors.WithStack(err)\n\t}\n\ts := StringFromChan(strCh)\n\treturn fmt.Sprintf(`{\"query\":\"%s\"}`, strings.Replace(s, `\"`, `\\\"`, -1)), nil\n}", "func (fr FlushResult) JSON() string {\n\tj, err := json.Marshal(fr)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(j)\n}", "func (messages *Messages) ToJson(writer io.Writer) error {\n\tencoder := json.NewEncoder(writer)\n\tencodedMessages := encoder.Encode(messages)\n\treturn encodedMessages\n}", "func (schedule Schedule) JSON() []byte {\n\tb, err := json.Marshal(&schedule)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn b\n}", "func (m Message) MarshalJSON() ([]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 enc Message\n\tenc.Sig = m.Sig\n\tenc.TTL = m.TTL\n\tenc.Timestamp = m.Timestamp\n\tenc.Topic = m.Topic\n\tenc.Payload = m.Payload\n\tenc.Padding = m.Padding\n\tenc.PoW = m.PoW\n\tenc.Hash = m.Hash\n\tenc.Dst = m.Dst\n\treturn json.Marshal(&enc)\n}", "func MessagesHandler(w http.ResponseWriter, r *http.Request) {\n\t//fmt.Fprintln(w, \"no message to show\")\n\t// specify to the client that the request should be respect the JSON format\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\t// Encode the messages to send back some JSON to the client\n\tif err := json.NewEncoder(w).Encode(listMessages); err != nil {\n\t\tpanic(err)\n\t}\n}", "func RenderJSON(w http.ResponseWriter, msg interface{}) {\n\tswitch v := msg.(type) {\n\tcase *JSONResponse:\n\t\tif _, ok := v.data[\"error\"]; !ok {\n\t\t\tv.data[\"error\"] = nil\n\t\t}\n\t\tw.WriteHeader(v.status)\n\t\tmsg = v.data\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(msg)\n}", "func (l Locale) JSON() (string, error) {\n\tb, err := json.Marshal(l.Data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}", "func sendJSON(data interface{}, w http.ResponseWriter) {\n\tcontent, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Add(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(content)\n}", "func (v FetchMessages) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson42239ddeEncodeGithubComKhliengDispatchServer24(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (m *ConnectedMessage) ToJson() string {\n\tvar msg, _ = json.Marshal(m)\n\treturn string(msg)\n}", "func (c *client) SendJSONMessage(msg interface{}) error {\n\treturn c.ws.WriteJSON(msg)\n}", "func Serialize(msg Message) ([]byte, error) {\n\tvar b bytes.Buffer\n\tencoder := json.NewEncoder(&b)\n\terr := encoder.Encode(msg)\n\treturn b.Bytes(), err\n}" ]
[ "0.81981593", "0.7193156", "0.71297085", "0.70724344", "0.69950885", "0.69847697", "0.6969687", "0.6947664", "0.6947664", "0.6902756", "0.6756524", "0.67506754", "0.6678022", "0.6643379", "0.6576812", "0.6566346", "0.64627314", "0.644587", "0.6444574", "0.6435986", "0.6433906", "0.64311713", "0.6396124", "0.6376626", "0.6276202", "0.62450135", "0.6237225", "0.6219143", "0.62158734", "0.62118524", "0.6197187", "0.61526227", "0.6149122", "0.6147296", "0.61006314", "0.6085855", "0.6085102", "0.6075197", "0.60412395", "0.60378146", "0.6032388", "0.60305935", "0.6028207", "0.60224605", "0.5998671", "0.5981975", "0.5962032", "0.59566134", "0.59243715", "0.59234095", "0.5907936", "0.5902254", "0.5899456", "0.5888897", "0.58804035", "0.5855274", "0.58505416", "0.58497745", "0.5846182", "0.58257324", "0.58245015", "0.582373", "0.5820732", "0.5812327", "0.58051467", "0.5805024", "0.5800801", "0.5798897", "0.57967794", "0.57865405", "0.57844037", "0.57829005", "0.57784665", "0.57772684", "0.5776667", "0.57591087", "0.57567704", "0.5756695", "0.57478875", "0.57454014", "0.5743144", "0.57420754", "0.5740254", "0.5736799", "0.5735449", "0.5733128", "0.5724327", "0.5712897", "0.57090276", "0.5696268", "0.5695495", "0.56915283", "0.56913775", "0.5684121", "0.5682352", "0.56821984", "0.5681602", "0.5681314", "0.5679459" ]
0.82813597
1
parseContent parse client Content container into printer struct.
func parseContent(c *clientContent) contentMessage { content := contentMessage{} content.Time = c.Time.Local() // guess file type. content.Filetype = func() string { if c.Type.IsDir() { return "folder" } return "file" }() content.Size = c.Size md5sum := strings.TrimPrefix(c.ETag, "\"") md5sum = strings.TrimSuffix(md5sum, "\"") content.ETag = md5sum // Convert OS Type to match console file printing style. content.Key = getKey(c) return content }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ParseContent(content string, params Params) (string, error) {\n\tcheckAndInitDefaultView()\n\treturn defaultViewObj.ParseContent(content, params)\n}", "func (c *GRPCClient) Content(ctx context.Context, contentPath string) (component.ContentResponse, error) {\n\tvar contentResponse component.ContentResponse\n\n\terr := c.run(func() error {\n\t\treq := &dashboard.ContentRequest{\n\t\t\tPath: contentPath,\n\t\t}\n\n\t\tresp, err := c.client.Content(ctx, req)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"grpc client content\")\n\t\t}\n\n\t\tif err := json.Unmarshal(resp.ContentResponse, &contentResponse); err != nil {\n\t\t\treturn errors.Wrap(err, \"unmarshal content response\")\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn component.ContentResponse{}, err\n\t}\n\n\treturn contentResponse, nil\n}", "func ParseText(content []byte) []interface{} {\n jsonObject := []interface{}{}\n if err := json.Unmarshal(content, &jsonObject); err != nil {\n panic(err)\n }\n return parse(jsonObject)\n}", "func ParseContent(text []byte) (*Appcast, error) {\n\tvar appcast = New()\n\terr := xml.Unmarshal(text, appcast)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn appcast, nil\n}", "func (view *View) ParseContent(ctx context.Context, content string, params ...Params) (string, error) {\n\tvar usedParams Params\n\tif len(params) > 0 {\n\t\tusedParams = params[0]\n\t}\n\treturn view.ParseOption(ctx, Option{\n\t\tContent: content,\n\t\tOrphan: false,\n\t\tParams: usedParams,\n\t})\n}", "func (d *GetResult) Content(valuePtr interface{}) error {\n\treturn DefaultDecode(d.contents, d.flags, valuePtr)\n}", "func (r *Response) ParseTplContent(content string, params ...gview.Params) (string, error) {\n\treturn r.Request.GetView().ParseContent(r.Request.Context(), content, r.buildInVars(params...))\n}", "func (f *File) ParseContent(doc *Doc) (err error) {\n\tcontent, err := f.Open(\"content.xml\")\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer content.Close()\n\n\td := xml.NewDecoder(content)\n\terr = d.Decode(doc)\n\treturn\n}", "func (p *ParseData) Content() string {\n\treturn p.content\n}", "func (resp *Response) Content() ([]byte, error) {\n\tbuf := bufferpool.Get()\n\tdefer buf.Free()\n\terr := drainBody(resp.Body, buf)\n\treturn buf.Bytes(), err\n}", "func (_BaseContentSpace *BaseContentSpaceFilterer) ParseCreateContent(log types.Log) (*BaseContentSpaceCreateContent, error) {\n\tevent := new(BaseContentSpaceCreateContent)\n\tif err := _BaseContentSpace.contract.UnpackLog(event, \"CreateContent\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func LoadContent (data []byte, unsafe...bool) (*Parser, error) {\n if j, e := gjson.LoadContent(data, unsafe...); e == nil {\n return &Parser{j}, nil\n } else {\n return nil, e\n }\n}", "func (o FileContentBufferResponseOutput) Content() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FileContentBufferResponse) string { return v.Content }).(pulumi.StringOutput)\n}", "func (o FileContentBufferResponsePtrOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FileContentBufferResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Content\n\t}).(pulumi.StringPtrOutput)\n}", "func GetContent(fullUrl string) (*Content, string, error) {\n\n\t// My own Cient with my own Transport\n\t// Just to abort very slow responses\n\ttransport := http.Transport{\n\t\tDial: func(network, addr string) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(network, addr, time.Duration(10*time.Second))\n\t\t},\n\t}\n\n\tclient := http.Client{\n\t\tTransport: &transport,\n\t}\n\n\tresp, err := client.Get(fullUrl)\n\tif err != nil {\n\t\treturn nil, \"\", errors.New(\n\t\t\tfmt.Sprintf(\"Desculpe, ocorreu ao tentar recuperar a pagina referente a URL passada. %s.\", err))\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, \"\", errors.New(\n\t\t\tfmt.Sprintf(\"Desculpe, mas a pagina passada respondeu indevidamente. O Status Code recebido foi: %d.\", resp.StatusCode))\n\t}\n\n\treader, err := charset.NewReader(resp.Body, resp.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\treturn nil, \"\", errors.New(\n\t\t\tfmt.Sprintf(\"Erro ao decodificar o charset da pagina. %s.\", err))\n\t}\n\n\tcontent := &Content{}\n\timageUrl := \"\"\n\n\t// This function create a Tokenizer for an io.Reader, obs. HTML should be UTF-8\n\tz := html.NewTokenizer(reader)\n\tfor {\n\t\ttokenType := z.Next()\n\n\t\tif tokenType == html.ErrorToken {\n\t\t\tif z.Err() == io.EOF { // EVERTHINGS WORKS WELL!\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Ops, we've got something wrong, it isn't an EOF token\n\t\t\treturn nil, \"\", errors.New(\n\t\t\t\tfmt.Sprintf(\"Desculpe, mas ocorreu um erro ao extrair as tags HTML da pagina passada. %s.\", z.Err()))\n\t\t}\n\n\t\tswitch tokenType {\n\t\tcase html.StartTagToken, html.SelfClosingTagToken:\n\n\t\t\ttoken := z.Token()\n\t\t\t// Check if it is an title tag opennig, it's the fastest way to compare bytes\n\t\t\tif token.Data == \"title\" {\n\t\t\t\t// log.Printf(\"TAG: '%v'\\n\", token.Data)\n\t\t\t\tnextTokenType := z.Next()\n\t\t\t\tif nextTokenType == html.TextToken {\n\t\t\t\t\tnextToken := z.Token()\n\t\t\t\t\tcontent.Title = strings.TrimSpace(nextToken.Data)\n\t\t\t\t\t// log.Println(\"<title> = \" + content.Title)\n\t\t\t\t}\n\n\t\t\t} else if token.Data == \"meta\" {\n\t\t\t\tkey := \"\"\n\t\t\t\tvalue := \"\"\n\n\t\t\t\t// log.Printf(\"NewMeta: %s : \", token.String())\n\n\t\t\t\t// Extracting this meta data information\n\t\t\t\tfor _, attr := range token.Attr {\n\t\t\t\t\tswitch attr.Key {\n\t\t\t\t\tcase \"property\", \"name\":\n\t\t\t\t\t\tkey = attr.Val\n\t\t\t\t\tcase \"content\":\n\t\t\t\t\t\tvalue = attr.Val\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tswitch key {\n\n\t\t\t\tcase \"title\", \"og:title\", \"twitter:title\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\tcontent.Title = strings.TrimSpace(value)\n\t\t\t\t\t\t// log.Printf(\"Title: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\n\t\t\t\tcase \"og:site_name\", \"twitter:domain\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\t//content.SiteName = strings.TrimSpace(value)\n\t\t\t\t\t\t//log.Printf(\"Site Name: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\n\t\t\t\tcase \"description\", \"og:description\", \"twitter:description\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\tcontent.Description = strings.TrimSpace(value)\n\t\t\t\t\t\t// log.Printf(\"Description: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\t\t\t\tcase \"og:image\", \"twitter:image\", \"twitter:image:src\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\timageUrl = strings.TrimSpace(value)\n\t\t\t\t\t\t// log.Printf(\"Image: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\t\t\t\tcase \"og:url\", \"twitter:url\":\n\t\t\t\t\tif strings.TrimSpace(value) != \"\" {\n\t\t\t\t\t\t// Not used, cause user could use a redirect service\n\t\t\t\t\t\t// fullUrl = strings.TrimSpace(value)\n\t\t\t\t\t\t// log.Printf(\"Url: %s\\n\", strings.TrimSpace(value))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Limiting the size of Title and Description to 250 characters\n\tif len(content.Title) > 250 {\n\t\tcontent.Title = content.Title[0:250]\n\t}\n\tif len(content.Description) > 250 {\n\t\tcontent.Description = content.Description[0:250]\n\t}\n\t// If content description is empty, lets full fill with something\n\tif len(content.Description) == 0 {\n\t\tcontent.Description = \"Veja o conteudo completo...\"\n\t}\n\n\t// Adding the host of this content\n\tcontent.Host = resp.Request.URL.Host\n\n\tlog.Printf(\"Title: %s\\n description: %s\\n host:%s\\n imageUrl:%s\\n\",\n\t\tcontent.Title, content.Description, content.Host, imageUrl)\n\n\treturn content, imageUrl, nil\n}", "func (o FileContentBufferOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FileContentBuffer) *string { return v.Content }).(pulumi.StringPtrOutput)\n}", "func (jv *Viewer) Content(content interface{}) error {\n\n\tjson, err := toJSON(content)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error converting %v to json: %s\", content, err.Error())\n\t}\n\twriter := colorwriter.New(\n\t\tcolorMap,\n\t\ttermbox.Attribute(jv.theme.Bg))\n\tformatter := jsonfmt.New(json, writer)\n\tif err := formatter.Format(); err != nil {\n\t\treturn err\n\t}\n\tformattedJSON := writer.Lines\n\n\tjv.tree = jsontree.New(formattedJSON)\n\tfor index := 0; index < len(formattedJSON); index++ {\n\t\tjv.tree.ToggleLine(index)\n\t}\n\treturn nil\n}", "func (t *Template) Parse(content interface{}) {\n\n\tif t.compiled == nil {\n\t\tlog.Println(\"there is no compiled template\")\n\t\treturn\n\t}\n\n\tvar buffer bytes.Buffer\n\n\tif err := t.compiled.Execute(&buffer, content); err != nil {\n\t\tlog.Println(\"error parsing template \", err)\n\t\treturn\n\t}\n\n\tt.BodyContent = buffer.String()\n}", "func (view *View) doParseContent(ctx context.Context, content string, params Params) (string, error) {\n\t// It's not necessary continuing parsing if template content is empty.\n\tif content == \"\" {\n\t\treturn \"\", nil\n\t}\n\tvar (\n\t\terr error\n\t\tkey = fmt.Sprintf(\"%s_%v_%v\", templateNameForContentParsing, view.config.Delimiters, view.config.AutoEncode)\n\t\ttpl = templates.GetOrSetFuncLock(key, func() interface{} {\n\t\t\tif view.config.AutoEncode {\n\t\t\t\treturn htmltpl.New(templateNameForContentParsing).Delims(\n\t\t\t\t\tview.config.Delimiters[0],\n\t\t\t\t\tview.config.Delimiters[1],\n\t\t\t\t).Funcs(view.funcMap)\n\t\t\t}\n\t\t\treturn texttpl.New(templateNameForContentParsing).Delims(\n\t\t\t\tview.config.Delimiters[0],\n\t\t\t\tview.config.Delimiters[1],\n\t\t\t).Funcs(view.funcMap)\n\t\t})\n\t)\n\t// Using memory lock to ensure concurrent safety for content parsing.\n\thash := strconv.FormatUint(ghash.DJB64([]byte(content)), 10)\n\tgmlock.LockFunc(\"gview.ParseContent:\"+hash, func() {\n\t\tif view.config.AutoEncode {\n\t\t\ttpl, err = tpl.(*htmltpl.Template).Parse(content)\n\t\t} else {\n\t\t\ttpl, err = tpl.(*texttpl.Template).Parse(content)\n\t\t}\n\t})\n\tif err != nil {\n\t\terr = gerror.Wrapf(err, `template parsing failed`)\n\t\treturn \"\", err\n\t}\n\t// Note that the template variable assignment cannot change the value\n\t// of the existing `params` or view.data because both variables are pointers.\n\t// It needs to merge the values of the two maps into a new map.\n\tvariables := gutil.MapMergeCopy(params)\n\tif len(view.data) > 0 {\n\t\tgutil.MapMerge(variables, view.data)\n\t}\n\tview.setI18nLanguageFromCtx(ctx, variables)\n\n\tbuffer := bytes.NewBuffer(nil)\n\tif view.config.AutoEncode {\n\t\tvar newTpl *htmltpl.Template\n\t\tnewTpl, err = tpl.(*htmltpl.Template).Clone()\n\t\tif err != nil {\n\t\t\terr = gerror.Wrapf(err, `template clone failed`)\n\t\t\treturn \"\", err\n\t\t}\n\t\tif err = newTpl.Execute(buffer, variables); err != nil {\n\t\t\terr = gerror.Wrapf(err, `template parsing failed`)\n\t\t\treturn \"\", err\n\t\t}\n\t} else {\n\t\tif err = tpl.(*texttpl.Template).Execute(buffer, variables); err != nil {\n\t\t\terr = gerror.Wrapf(err, `template parsing failed`)\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\t// TODO any graceful plan to replace \"<no value>\"?\n\tresult := gstr.Replace(buffer.String(), \"<no value>\", \"\")\n\tresult = view.i18nTranslate(ctx, result, variables)\n\treturn result, nil\n}", "func parseContent(content string) ([]byte, error) {\n\t// Decode and replace all occurrences of hexadecimal content.\n\tvar errpanic error\n\tdefer func() {\n\t\tr := recover()\n\t\tif r != nil {\n\t\t\terrpanic = fmt.Errorf(\"recovered from panic: %v\", r)\n\t\t}\n\t}()\n\n\tif containsUnescaped(content) {\n\t\treturn nil, fmt.Errorf(\"invalid special characters escaping\")\n\t}\n\n\tb := escapeContent.ReplaceAllString(content, \"$1\")\n\n\tb = hexRE.ReplaceAllStringFunc(b,\n\t\tfunc(h string) string {\n\t\t\tr, err := hex.DecodeString(strings.Replace(strings.Trim(h, \"|\"), \" \", \"\", -1))\n\t\t\tif err != nil {\n\t\t\t\tpanic(\"invalid hexRE regexp\")\n\t\t\t}\n\t\t\treturn string(r)\n\t\t})\n\treturn []byte(b), errpanic\n}", "func LoadContent(data interface{}, unsafe...bool) (*Parser, error) {\n if j, e := gjson.LoadContent(data, unsafe...); e == nil {\n return &Parser{j}, nil\n } else {\n return nil, e\n }\n}", "func contentHandler(w http.ResponseWriter, r *http.Request) {\n\n\t//Get the filename from the url:\n\tdataFileLoc := r.URL.Path[len(\"/kanban-board/content/\"):] + \".json\"\n\n\tlog.Info(\"Request for file: \" + contentFolderLoc + dataFileLoc)\n\tdat, err := ioutil.ReadFile(contentFolderLoc + dataFileLoc)\n\tif err != nil {\n\t\t//Return a 404 for errrors.\n\t\thttp.NotFound(w, r)\n\t\tlog.Error(err.Error())\n\t\treturn\n\t}\n\n\tvar myPageData PageDataModel\n\tif err = json.Unmarshal(dat, &myPageData); err != nil {\n\t\thttp.Error(w, \"Error processing page\", 500)\n\t\tlog.Error(err.Error())\n\t\treturn\n\t}\n\n\thtmlString, err := makeHTML(myPageData)\n\tif err != nil {\n\t\thttp.Error(w, \"Error processing page\", 500)\n\t\tlog.Error(err.Error())\n\t\treturn\n\t}\n\n\tfmt.Fprintf(w, htmlString)\n}", "func parseContent(n *html.Node) []*ContentSegment {\n\tsegments := make([]*ContentSegment, 0)\n\n\tvar parser func(*html.Node, Attribution)\n\tparser = func(node *html.Node, attribution Attribution) {\n\t\tif node.Type == html.ElementNode {\n\t\t\tswitch node.Data {\n\t\t\tcase \"em\":\n\t\t\t\tattribution = attribution | AttributionEmphasis\n\t\t\tcase \"strong\":\n\t\t\t\tattribution = attribution | AttributionBold\n\t\t\tcase \"code\":\n\t\t\t\tattribution = attribution | AttributionCode\n\t\t\tcase \"a\":\n\t\t\t\tattribution |= AttributeAnchor\n\t\t\t\tseg := ContentSegment{\n\t\t\t\t\tRaw: node.FirstChild.Data,\n\t\t\t\t\tAttribution: attribution,\n\t\t\t\t}\n\t\t\t\tseg.Context = make(map[string]string)\n\t\t\t\tfor _, att := range node.Attr {\n\t\t\t\t\tif att.Key == \"href\" {\n\t\t\t\t\t\tseg.Context[\"href\"] = att.Val\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsegments = append(segments, &seg)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor c := node.FirstChild; c != nil; c = c.NextSibling {\n\t\t\t\tparser(c, attribution)\n\t\t\t}\n\t\t} else if node.Type == html.TextNode {\n\t\t\tseg := ContentSegment{\n\t\t\t\tRaw: node.Data,\n\t\t\t\tAttribution: attribution,\n\t\t\t}\n\t\t\tsegments = append(segments, &seg)\n\t\t}\n\t}\n\tparser(n, AttributionPlain)\n\n\t// for _, l := range segments {\n\t// \tlog.Printf(\"Segment %v\\n\", l)\n\t// }\n\n\treturn segments\n}", "func generateContentMessages(clntURL ClientURL, ctnts []*ClientContent, printAllVersions bool) (msgs []contentMessage) {\n\tprefixPath := clntURL.Path\n\tprefixPath = filepath.ToSlash(prefixPath)\n\tif !strings.HasSuffix(prefixPath, \"/\") {\n\t\tprefixPath = prefixPath[:strings.LastIndex(prefixPath, \"/\")+1]\n\t}\n\tprefixPath = strings.TrimPrefix(prefixPath, \"./\")\n\n\tnrVersions := len(ctnts)\n\n\tfor i, c := range ctnts {\n\t\t// Convert any os specific delimiters to \"/\".\n\t\tcontentURL := filepath.ToSlash(c.URL.Path)\n\t\t// Trim prefix path from the content path.\n\t\tc.URL.Path = strings.TrimPrefix(contentURL, prefixPath)\n\n\t\tcontentMsg := contentMessage{}\n\t\tcontentMsg.Time = c.Time.Local()\n\n\t\t// guess file type.\n\t\tcontentMsg.Filetype = func() string {\n\t\t\tif c.Type.IsDir() {\n\t\t\t\treturn \"folder\"\n\t\t\t}\n\t\t\treturn \"file\"\n\t\t}()\n\n\t\tcontentMsg.Size = c.Size\n\t\tmd5sum := strings.TrimPrefix(c.ETag, \"\\\"\")\n\t\tmd5sum = strings.TrimSuffix(md5sum, \"\\\"\")\n\t\tcontentMsg.ETag = md5sum\n\t\t// Convert OS Type to match console file printing style.\n\t\tcontentMsg.Key = getKey(c)\n\t\tcontentMsg.VersionID = c.VersionID\n\t\tcontentMsg.IsDeleteMarker = c.IsDeleteMarker\n\t\tcontentMsg.VersionOrd = nrVersions - i\n\t\t// URL is empty by default\n\t\t// Set it to either relative dir (host) or public url (remote)\n\t\tcontentMsg.URL = clntURL.String()\n\n\t\tmsgs = append(msgs, contentMsg)\n\n\t\tif !printAllVersions {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func parse(message def.Message, messageTemplate interface{}) bool {\n\tlog.Infoln(message.Content())\n\tr := strings.NewReader(message.Content())\n\td := json.NewDecoder(r)\n\t//err := json.Unmarshal([]byte(message.Content()), &messageTemplate)\n\terr := d.Decode(&messageTemplate)\n\tif err != nil {\n\t\tlog.Errorf(\"JSON Unmarshal error: '%s'\\nFrom message (type %d) of client #%d: '%s'\", err, message.ClientID(), message.Type(), message.Content())\n\t\tlog.Errorf(\"JSON Unmarshal error of content: '%s'\", message.Content())\n\t\treturn false\n\t}\n\treturn true\n}", "func (s *GRPCServer) Content(ctx context.Context, req *dashboard.ContentRequest) (*dashboard.ContentResponse, error) {\n\tservice, ok := s.Impl.(ModuleService)\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"plugin is not a module, it's a %T\", s.Impl)\n\t}\n\n\tcontentResponse, err := service.Content(ctx, req.Path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcontentResponseBytes, err := json.Marshal(&contentResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &dashboard.ContentResponse{\n\t\tContentResponse: contentResponseBytes,\n\t}, nil\n}", "func (se *SNEntry) getContent() string {\n\tvar content string\n\n\tfor _, c := range se.Components {\n\t\t// Skip all components that aren't plain text.\n\t\tif c.Type != \"text\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// We don't want to create too long messages, so if we have\n\t\t// more than 200 characters in the string we'll skip the\n\t\t// remaining text components.\n\t\tif len(content) > 200 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Append the text to our content string\n\t\tcontent += \" \" + c.Text.Value\n\t}\n\n\treturn content\n}", "func Parse(content []byte) []map[string][]string {\n\ts := &scanner{\n\t\ts: bufio.NewScanner(bytes.NewReader(content)),\n\t\tused: true,\n\t}\n\tp := &parser{\n\t\tdata: make([]map[string][]string, 0),\n\t\tcurrentKey: \"\",\n\t\tisNewItem: true,\n\t}\n\n\tfor s.Scan() {\n\t\ttext := s.Text()\n\t\tif isComment(text) {\n\t\t\tp.isNewItem = true\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(text, \" \") {\n\t\t\tp.parse([]string{text})\n\t\t\tcontinue\n\t\t}\n\t\tp.parse(strings.Split(text, \":\"))\n\t}\n\n\treturn p.data\n}", "func NewContent (rawContent map[string]interface{}) Content {\n if nil == rawContent {\n return Content{}\n }\n\n id, _ := rawContent[\"id\"].(string)\n parentId, _ := rawContent[\"parentId\"].(string)\n body, _ := rawContent[\"body\"].(string)\n title, _ := rawContent[\"title\"].(string)\n rawCreated, _ := rawContent[\"created\"].(string)\n rawModified, _ := rawContent[\"modified\"].(string)\n launchInNewWindow, _ := rawContent[\"launchInNewWindow\"].(bool)\n reviewable, _ := rawContent[\"reviewable\"].(bool)\n\n created, _ := time.Parse (time.RFC3339, rawCreated)\n modified, _ := time.Parse (time.RFC3339, rawModified)\n\n hasChildren, _ := rawContent[\"hasChildren\"].(bool)\n hasGradebookColumns, _ := rawContent[\"hasGradebookColumns\"].(bool)\n hasAssociatedGroups, _ := rawContent[\"hasAssociatedGroups\"].(bool)\n\n contentHandler, _ := rawContent[\"contentHandler\"].(map[string]interface{})\n\n return Content {\n Id: id,\n ParentId: parentId,\n Title: title,\n Body: body,\n Created: created,\n Modified: modified,\n Position: _parsePosition (rawContent[\"position\"]),\n HasChildren: hasChildren,\n HasGradebookColumn: hasGradebookColumns,\n HasAssociatedGroups: hasAssociatedGroups,\n LaunchInNewWindow: launchInNewWindow,\n Reviewable: reviewable,\n ContentHandler: NewContentHandler (contentHandler),\n Availability:\n _parseAvailability (rawContent[\"availability\"].(map[string]interface{})),\n }\n}", "func getContentMarketing(wg *sync.WaitGroup) {\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", contentMarketingURL, nil)\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tdefer func() {\n\t\tresp.Body.Close()\n\t\twg.Done()\n\t}()\n\n\terr = json.NewDecoder(resp.Body).Decode(&contentMarketing)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func (P *Parser) stringifyContent(content interface{}) (string, error) {\n\tswitch c := content.(type) {\n\tcase string:\n\t\treturn c, nil\n\tcase []byte:\n\t\treturn string(c), nil\n\tcase *bytes.Buffer:\n\t\tif c != nil {\n\t\t\treturn c.String(), nil\n\t\t}\n\tcase io.Reader:\n\t\tvar buf bytes.Buffer\n\t\tif _, err := io.Copy(&buf, c); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn buf.String(), nil\n\t}\n\treturn \"\", fmt.Errorf(\"unsupported content type %T\", content)\n}", "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n reader, err := d.Reader(ctx, path, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ioutil.ReadAll(reader)\n}", "func (r ResponseAPI) GetContent() echo.Map {\n\treturn r.Content\n}", "func GetContent(host, path string, requiredCode int) ([]byte, error) {\n\tresp, err := GetRequest(host, path)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tdata, err := out(resp, requiredCode)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\treturn data, nil\n}", "func (p *Parser) Parse(_ string, fileContent []byte) ([]model.Document, error) {\n\tvar documents []model.Document\n\tcom, err := dockerfile.ParseReader(bytes.NewReader(fileContent))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to parse Dockerfile\")\n\t}\n\n\tdoc := &model.Document{}\n\n\tvar resource Resource\n\tresource.CommandList = com\n\n\tj, err := json.Marshal(resource)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to Marshal Dockerfile\")\n\t}\n\n\tif err := json.Unmarshal(j, &doc); err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to Unmarshal Dockerfile\")\n\t}\n\n\tdocuments = append(documents, *doc)\n\n\treturn documents, nil\n}", "func ParseContent(content string, match string) []string {\n\t// TODO: 따옴표로 감싸면 콤마 무시\n\tif content == \"!\"+match {\n\t\treturn []string{}\n\t}\n\n\treturn MapTrim(strings.Split(strings.Replace(content, \"!\"+match, \"\", 1), \",\"))\n}", "func (p *Packet) Content() []byte {\n\treturn p._pkt.body.anon0[:p._pkt.body.length]\n}", "func (c *HostConfig) Content() string {\n\treturn c.ContentBuffer().String()\n}", "func (e *Engine) Parse(content []byte) ([]string, error) {\n\treturn e.parser.Parse(content)\n}", "func Parse(content []byte) (resources []*Node, err error) {\n\tobj, err := hcl.ParseBytes(content)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\tast.Walk(obj.Node, func(n ast.Node) (ast.Node, bool) {\n\t\tbaseItem, ok := n.(*ast.ObjectItem)\n\t\tif !ok {\n\t\t\treturn n, true\n\t\t}\n\n\t\titem := NewNode(baseItem)\n\n\t\tif itemErr := item.Validate(); itemErr != nil {\n\t\t\terr = multierror.Append(err, itemErr)\n\t\t\treturn n, false\n\t\t}\n\n\t\tresources = append(resources, item)\n\n\t\treturn n, false\n\t})\n\n\treturn resources, err\n}", "func NewContents (rawContents []map[string]interface{}) []Content {\n newContents := make ([]Content, len (rawContents))\n\n for i, rawContent := range rawContents {\n newContents[i] = NewContent (rawContent)\n }\n\n return newContents\n}", "func (_BaseAccessWallet *BaseAccessWalletCaller) ContentObjects(opts *bind.CallOpts) (struct {\n\tCategory uint8\n\tLength *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _BaseAccessWallet.contract.Call(opts, &out, \"contentObjects\")\n\n\toutstruct := new(struct {\n\t\tCategory uint8\n\t\tLength *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Category = *abi.ConvertType(out[0], new(uint8)).(*uint8)\n\toutstruct.Length = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "func (c *Client) LoadFromContent(content []byte) error {\n\treturn yaml.Unmarshal(content, c)\n}", "func (s *schema) Content() []byte {\n\treturn s.content\n}", "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tpath = path[1:]\n\tbaseUrl := qiniu.MakeBaseUrl(d.Config.Domain,path)\n\tfmt.Print(baseUrl)\n\tres, err := http.Get(baseUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcontent, err := ioutil.ReadAll(res.Body)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn content, nil\n}", "func formatContent(content string) string {\n\t// TODO: for extremely large JSON it would be better to do this with a buffer\n\tret := \"\"\n\tfor i, line := range strings.Split(strings.TrimSuffix(content, \"\\n\"), \"\\n\") {\n\t\tif i == 0 {\n\t\t\tret += fmt.Sprintf(\"%s\\n\", line)\n\t\t} else {\n\t\t\tret += fmt.Sprintf(\"\\t %s\\n\", line)\n\n\t\t}\n\t}\n\treturn ret\n}", "func (o *GetMessagesAllOf) GetContent() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Content\n}", "func handleParse(h Handler, content string) ([]string, error) {\n\tvar (\n\t\tp CmdParser\n\t\tok bool\n\t)\n\tif p, ok = h.(CmdParser); !ok {\n\t\treturn cmdParserDefault(content), nil\n\t}\n\n\treturn p.Parse(content)\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupCaller) ContentObjects(opts *bind.CallOpts) (struct {\n\tCategory uint8\n\tLength *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _BaseAccessControlGroup.contract.Call(opts, &out, \"contentObjects\")\n\n\toutstruct := new(struct {\n\t\tCategory uint8\n\t\tLength *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Category = *abi.ConvertType(out[0], new(uint8)).(*uint8)\n\toutstruct.Length = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "func GetAllContent() []Content {\n\t// Do the connection and select database.\n\tdb := MongoDBConnect()\n\n\t// Do the query to a collection on database.\n\tc, err := db.Collection(\"sample_content\").Find(nil, bson.D{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer c.Close(nil)\n\n\tvar content []Content\n\n\t// Start looping on the query result.\n\tfor c.Next(context.TODO()) {\n\t\teachContent := Content{}\n\n\t\terr := c.Decode(&eachContent)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tcontent = append(content, eachContent)\n\t}\n\n\treturn content\n}", "func ContentPrint(path string) {\n\tfile2, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, os.ModeAppend)\n\tdefer file2.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tstats, statsErr := file2.Stat()\n\tif statsErr != nil {\n\t\tfmt.Println(\"erro\")\n\t}\n\n\tvar sizes int64 = stats.Size()\n\tbytess := make([]byte, sizes)\n\n\tbufr := bufio.NewReader(file2)\n\t_, err = bufr.Read(bytess)\n\n\tfmt.Println(bytess)\n}", "func (s *Conn) GetMsgContent(link *Link) (content []byte, err error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\tbuf := pool.BufPoolCopy.Get().([]byte)\n\tif n, err := s.ReadFrom(buf, link.De, link.Crypt, link.Rate); err == nil {\n\t\tcontent = buf[:n]\n\t}\n\treturn\n}", "func (c *Communication) parseText(ms []Message) []*Frame {\n\tfs := make([]*Frame, len(ms))\n\tfor i, m := range ms {\n\t\tif s, ok := m.Content().(string); ok {\n\t\t\tfs[i] = NewFrame(TextMessageType, s)\n\t\t} else { fs[i] = NewFrame(TextMessageType, \"\"); }\n\n\t\tfs[i].AddMeta(Sender, m.SenderId())\n\t\tif m.IsGroupMessage() {\n\t\t\tfs[i].AddMeta(Group, m.GroupName())\n\t\t}\n\t}\n\n\treturn fs\n}", "func (v *Version) GetContent(ctx context.Context) ([]byte, error) {\n\tlock := v.Chart.Space.SpaceManager.Lock.Get(v.Chart.Space.Name(), v.Chart.Name(), v.Number())\n\tif !lock.RLock(v.Chart.Space.SpaceManager.LockTimeout) {\n\t\treturn nil, ErrorLocking.Format(\"version\", v.Chart.Space.Name()+\"/\"+v.Chart.Name()+\"/\"+v.Number())\n\t}\n\tdefer lock.RUnlock()\n\tif err := v.Validate(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\tpath := path.Join(v.Prefix, chartPackageName)\n\tdata, err := v.Chart.Space.SpaceManager.Backend.GetContent(ctx, path)\n\tif err != nil {\n\t\treturn nil, ErrorContentNotFound.Format(v.Prefix)\n\t}\n\treturn data, nil\n}", "func streamContent(w io.Writer) {\n\t// For simplicity, let's use a simple loop here\n\tfor i := 0; i < 10; i++ {\n\t\t// Generate a chunk of data\n\t\tchunk := []byte(fmt.Sprintf(\"Chunk %d\\n\", i))\n\n\t\t// Write the chunk to the writer\n\t\t_, err := w.Write(chunk)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Manually close the connection after streaming is complete\n\tif closer, ok := w.(io.Closer); ok {\n\t\tcloser.Close()\n\t}\n}", "func (ps *ProxySettings) Content(ctx context.Context, config *Config) (*Config, error) {\n\tif err := ps.ui.WaitUntilExists(config.HostNode())(ctx); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to ensure node %q exists and is shown on the screen\", config.HostName())\n\t}\n\n\tinfoHostNode, err := ps.ui.Info(ctx, config.HostNode())\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to get node info for field %q\", config.HostName())\n\t}\n\n\tif err := ps.ui.WaitUntilExists(config.PortNode())(ctx); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to ensure node %q exists and is shown on the screen\", config.HostName())\n\t}\n\n\tinfoPortNode, err := ps.ui.Info(ctx, config.PortNode())\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to get node info for field %q\", config.PortName())\n\t}\n\n\treturn &Config{\n\t\tProtocol: config.Protocol,\n\t\tHost: infoHostNode.Value,\n\t\tPort: infoPortNode.Value,\n\t}, nil\n}", "func ContentText(inStream io.Reader) ([]string, error) {\n\tscanner := bufio.NewScanner(inStream)\n\tlist := make([]string, 0)\n\tfor scanner.Scan() {\n\t\tlist = append(list, scanner.Text())\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn list, nil\n}", "func ReadContent(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\t// Get the parameter.\n\tslug := ps.ByName(\"slug\")\n\n\t// Do the connection and select database.\n\tdb := MongoDBConnect()\n\n\tresult := Content{}\n\n\t// Do the query to a collection on database.\n\tif err := db.Collection(\"sample_content\").FindOne(nil, bson.D{{\"slug\", slug}}).Decode(&result); err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\t// Get content file (in markdown format).\n\tfileContent, err := ioutil.ReadFile(\"web/content/samples/\" + result.ContentFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Prepare renderer.\n\tcr := NewChromaRenderer(\"paraiso-light\")\n\tcontent := string(blackfriday.Run(fileContent, blackfriday.WithRenderer(cr)))\n\n\t// Prepare data structure for data passed to template.\n\ttype TemplateData struct {\n\t\tContent template.HTML\n\t\tSlug string\n\t\tEnv string\n\t}\n\n\ttemplateData := TemplateData{Content: template.HTML(content), Slug: slug, Env: os.Getenv(\"IGO_ENV\")}\n\n\t// Parse templates.\n\tvar templates = template.Must(template.New(\"\").ParseFiles(\"web/templates/_base.html\", \"web/templates/read-content.html\"))\n\n\t// Execute template.\n\ttemplates.ExecuteTemplate(w, \"_base.html\", templateData)\n}", "func (o FileContentBufferPtrOutput) Content() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FileContentBuffer) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Content\n\t}).(pulumi.StringPtrOutput)\n}", "func (d *driver) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tdefer debugTime()()\n\treader, err := d.shell.Cat(d.fullPath(path))\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"no link named\") {\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: path}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tcontent, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Debugf(\"Got content %s: %s\", path, content)\n\n\treturn content, nil\n}", "func (m *WorkbookCommentReply) GetContent()(*string) {\n return m.content\n}", "func (sys *HTTPConsoleLoggerSys) Content() (logs []log.Entry) {\n\tsys.RLock()\n\tsys.logBuf.Do(func(p interface{}) {\n\t\tif p != nil {\n\t\t\tlg, ok := p.(log.Info)\n\t\t\tif ok {\n\t\t\t\tif (lg.Entry != log.Entry{}) {\n\t\t\t\t\tlogs = append(logs, lg.Entry)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\tsys.RUnlock()\n\n\treturn\n}", "func (api *API) getContentPrivateHandler(w http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tvars := mux.Vars(req)\n\tid := vars[\"id\"]\n\tlogdata := log.Data{\n\t\t\"request_id\": ctx.Value(dprequest.RequestIdKey),\n\t\t\"content_id\": id,\n\t\t\"function\": \"getContentPrivateHandler\",\n\t}\n\n\t// get type from query parameters, or default value\n\tqueryTypeFlags := getContentTypeParameter(req.URL.Query())\n\tif queryTypeFlags == 0 {\n\t\thandleError(ctx, w, apierrors.ErrContentUnrecognisedParameter, logdata)\n\t\treturn\n\t}\n\n\t// check topic from mongoDB by id\n\terr := api.dataStore.Backend.CheckTopicExists(id)\n\tif err != nil {\n\t\thandleError(ctx, w, err, logdata)\n\t\treturn\n\t}\n\n\t// get content from mongoDB by id\n\tcontent, err := api.dataStore.Backend.GetContent(id, queryTypeFlags)\n\tif err != nil {\n\t\t// no content found\n\t\thandleError(ctx, w, err, logdata)\n\t\treturn\n\t}\n\n\t// User has valid authentication to get raw full content document(s)\n\n\tif content.Current == nil {\n\t\t// TODO\n\t\t/*\n\t\t\tIn the future: when the API becomes more than read-only\n\t\t\tWhen a document is first created, it will only have 'next' until it is published, when it gets 'current' populated.\n\t\t\tSo current == nil is not an error.\n\n\t\t\tFor now we return an error because we dont have publishing steps.\n\t\t*/\n\t\thandleError(ctx, w, apierrors.ErrInternalServer, logdata)\n\t\treturn\n\t}\n\tif content.Next == nil {\n\t\thandleError(ctx, w, apierrors.ErrInternalServer, logdata)\n\t\treturn\n\t}\n\n\tcurrentResult := getRequiredItems(queryTypeFlags, content.Current, content.ID)\n\n\t// The 'Next' type items may have a different length to the current, so we do the above again, but for Next\n\tnextResult := getRequiredItems(queryTypeFlags, content.Next, content.ID)\n\n\tif currentResult.TotalCount == 0 && nextResult.TotalCount == 0 {\n\t\thandleError(ctx, w, apierrors.ErrContentNotFound, logdata)\n\t\treturn\n\t}\n\n\tvar result models.PrivateContentResponseAPI\n\tresult.Next = nextResult\n\tresult.Current = currentResult\n\n\tif err := WriteJSONBody(ctx, result, w, logdata); err != nil {\n\t\t// WriteJSONBody has already logged the error\n\t\treturn\n\t}\n\tlog.Event(ctx, \"request successful\", log.INFO, logdata) // NOTE: name of function is in logdata\n}", "func Read() []string {\n\treturn content.Items\n}", "func (_AccessIndexor *AccessIndexorCaller) ContentObjects(opts *bind.CallOpts) (struct {\n\tCategory uint8\n\tLength *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _AccessIndexor.contract.Call(opts, &out, \"contentObjects\")\n\n\toutstruct := new(struct {\n\t\tCategory uint8\n\t\tLength *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Category = *abi.ConvertType(out[0], new(uint8)).(*uint8)\n\toutstruct.Length = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "func content(lines []string) []byte {\n\treturn []byte(strings.Join(lines, \"\\n\") + \"\\n\")\n}", "func xmlParserContents(ctx context.Context, rfC <-chan *resourceFile) (<-chan *rdpb.Resource, <-chan error) {\n\tresC := make(chan *rdpb.Resource)\n\terrC := make(chan error)\n\tgo func() {\n\t\tdefer close(resC)\n\t\tdefer close(errC)\n\t\tfor rf := range rfC {\n\t\t\tif !syncParseContents(respipe.PrefixErr(ctx, fmt.Sprintf(\"%s xml-parse: \", rf.pathInfo.Path)), rf.pathInfo, bytes.NewReader(rf.contents), resC, errC) {\n\t\t\t\t// ctx must have been canceled - exit.\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\treturn resC, errC\n}", "func contentExtractor(contents []byte, src string, vars []string) bytes.Buffer {\n\t// Create a parser\n\tprog, err := parser.ParseProgram([]byte(src), nil)\n\tif err != nil {\n\t\tFatalf(\"Failed to parse the program: %s\", src)\n\t}\n\n\t// The configuration\n\tvar buf bytes.Buffer\n\tconfig := &interp.Config{\n\t\tStdin: bytes.NewReader([]byte(contents)),\n\t\tVars: vars,\n\t\tOutput: &buf,\n\t}\n\n\t// Execute the program\n\t_, err = interp.ExecProgram(prog, config)\n\tif err != nil {\n\t\tFatalf(\"Failure in executing the goawk script: %v\", err)\n\t}\n\treturn buf\n}", "func PbContents(cs []*table.Content) []*Content {\n\tif cs == nil {\n\t\treturn make([]*Content, 0)\n\t}\n\n\tresult := make([]*Content, 0)\n\tfor _, c := range cs {\n\t\tresult = append(result, PbContent(c))\n\t}\n\n\treturn result\n}", "func (r *Document) Content() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"content\"])\n}", "func (p ListParserImpl) Parse(content string) []model.Word {\n\tresult := []model.Word{}\n\tdoc, err := goquery.NewDocumentFromReader(strings.NewReader(content))\n\tif err != nil {\n\t\treturn result\n\t}\n\n\twords := doc.Find(WORDS_SECTION).First()\n\n\twords.Find(WORD_BLOCK).Each(func(_ int, node *goquery.Selection) {\n\t\ttitle, _ := node.Attr(\"title\")\n\t\twordsList := strings.Split(title, \" \")\n\t\tword := wordsList[len(wordsList)-1]\n\t\tword = strings.Trim(word, \"\\n\")\n\t\tif len(word) > 3 {\n\t\t\turl, _ := node.Attr(\"href\")\n\t\t\turl = strings.Trim(url, \"\\n\")\n\t\t\twordObject := model.Word{\n\t\t\t\tName: word,\n\t\t\t\tURL: url,\n\t\t\t}\n\t\t\tresult = append(result, wordObject)\n\t\t}\n\t})\n\n\treturn result\n}", "func (obj *request) Content() Content {\n\treturn obj.content\n}", "func (d *Dao) Content(c context.Context, oid, dmid int64) (ct *model.Content, err error) {\n\tct = &model.Content{}\n\trow := d.dmMetaReader.QueryRow(c, fmt.Sprintf(_contentSQL, d.hitContent(oid)), dmid)\n\tif err = row.Scan(&ct.ID, &ct.FontSize, &ct.Color, &ct.Mode, &ct.IP, &ct.Plat, &ct.Msg, &ct.Ctime, &ct.Mtime); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tct = nil\n\t\t\terr = nil\n\t\t} else {\n\t\t\tlog.Error(\"row.Scan() error(%v)\", err)\n\t\t}\n\t}\n\treturn\n}", "func parseFileContent(s *setup, content []byte) error {\n\tdecoder := s.conf.FileDecoder\n\tif decoder == nil {\n\t\t// Look for the config file extension to determine the encoding.\n\t\tswitch path.Ext(s.configFilePath) {\n\t\tcase \"json\":\n\t\t\tdecoder = DecoderJSON\n\t\tcase \"toml\":\n\t\t\tdecoder = DecoderTOML\n\t\tcase \"yaml\", \"yml\":\n\t\t\tdecoder = DecoderYAML\n\t\tdefault:\n\t\t\tdecoder = DecoderTryAll\n\t\t}\n\t}\n\n\tm, err := decoder(content)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse file at %v: %v\",\n\t\t\ts.configFilePath, err)\n\t}\n\n\t// Parse the map for the options.\n\tif err := parseMapOpts(m, s.opts); err != nil {\n\t\treturn fmt.Errorf(\"error loading config vars from config file: %v\", err)\n\t}\n\n\treturn nil\n}", "func (_BaseLibrary *BaseLibraryFilterer) ParseContentObjectCreated(log types.Log) (*BaseLibraryContentObjectCreated, error) {\n\tevent := new(BaseLibraryContentObjectCreated)\n\tif err := _BaseLibrary.contract.UnpackLog(event, \"ContentObjectCreated\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func ReadMessageContent(s Stream) (content []byte, err error) {\n\tvar (\n\t\tr = bufio.NewReader(s)\n\t)\n\ttimeoutDuration := 1 * time.Second\n\tif err = s.SetReadDeadline(time.Now().Add(timeoutDuration)); err != nil {\n\t\tlog.Error(\"cannot reset deadline for message header read\", \"error\", err)\n\t\treturn\n\t}\n\t//// Read 1 byte for message type\n\tif _, err = r.ReadByte(); err != nil {\n\t\tlog.Error(\"failed to read p2p message type field\", \"error\", err)\n\t\treturn\n\t}\n\t// TODO: check on msgType and take actions accordingly\n\t//// Read 4 bytes for message size\n\tfourBytes := make([]byte, 4)\n\tif _, err = io.ReadFull(r, fourBytes); err != nil {\n\t\tlog.Error(\"failed to read p2p message size field\", \"error\", err)\n\t\treturn\n\t}\n\n\tcontentLength := int(binary.BigEndian.Uint32(fourBytes))\n\tcontentBuf := make([]byte, contentLength)\n\ttimeoutDuration = 20 * time.Second\n\tif err = s.SetReadDeadline(time.Now().Add(timeoutDuration)); err != nil {\n\t\tlog.Error(\"cannot reset deadline for message content read\", \"error\", err)\n\t\treturn\n\t}\n\tif _, err = io.ReadFull(r, contentBuf); err != nil {\n\t\tlog.Error(\"failed to read p2p message contents\", \"error\", err)\n\t\treturn\n\t}\n\tcontent = contentBuf\n\treturn\n}", "func (pb *PostBody) Content() string {\n\tif pb == nil {\n\t\treturn \"\"\n\t}\n\treturn pb.body\n}", "func (r *Response) Content() (string, error) {\n\tb, err := r.Body()\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\treturn string(b), nil\n}", "func (d *Dao) Contents(c context.Context, oid int64, dmids []int64) (res []*model.Content, err error) {\n\tvar (\n\t\twg errgroup.Group\n\t\tlock sync.Mutex\n\t)\n\tpageNum := len(dmids) / _pagesize\n\tif len(dmids)%_pagesize > 0 {\n\t\tpageNum = pageNum + 1\n\t}\n\tfor i := 0; i < pageNum; i++ {\n\t\tstart := i * _pagesize\n\t\tend := (i + 1) * _pagesize\n\t\tif end > len(dmids) {\n\t\t\tend = len(dmids)\n\t\t}\n\t\twg.Go(func() (err error) {\n\t\t\trows, err := d.dmMetaReader.Query(c, fmt.Sprintf(_contentsSQL, d.hitContent(oid), xstr.JoinInts(dmids[start:end])))\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"db.Query(%s) error(%v)\", fmt.Sprintf(_contentsSQL, d.hitContent(oid), xstr.JoinInts(dmids)), err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer rows.Close()\n\t\t\tfor rows.Next() {\n\t\t\t\tct := &model.Content{}\n\t\t\t\tif err = rows.Scan(&ct.ID, &ct.FontSize, &ct.Color, &ct.Mode, &ct.IP, &ct.Plat, &ct.Msg, &ct.Ctime, &ct.Mtime); err != nil {\n\t\t\t\t\tlog.Error(\"rows.Scan() error(%v)\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlock.Lock()\n\t\t\t\tres = append(res, ct)\n\t\t\t\tlock.Unlock()\n\t\t\t}\n\t\t\terr = rows.Err()\n\t\t\treturn\n\t\t})\n\t}\n\tif err = wg.Wait(); err != nil {\n\t\tlog.Error(\"wg.Wait() error(%v)\", err)\n\t}\n\treturn\n}", "func (client *Client) GetContent(path string) *VoidResponse {\n\tendpoint := client.baseURL + fmt.Sprintf(EndpointGetContent, client.accessToken, path)\n\trequest := gorequest.New().Get(endpoint).Set(UserAgentHeader, UserAgent+\"/\"+Version)\n\n\treturn &VoidResponse{\n\t\tClient: client,\n\t\tRequest: request,\n\t}\n}", "func (h *Handler) ClientAccessPolicyXMLContent() []byte {\n\treturn h.clientAccessPolicyXMLContent\n}", "func FetchContent(path string) (interface{}, error) {\n\treturn util.LoadFile(path)\n}", "func RequestContent(method string, url string, data ...interface{}) string {\n\treturn client.New().RequestContent(method, url, data...)\n}", "func ParseJSON(content []byte) (*Container, error) {\n\tjsonContainer, err := gabs.ParseJSON(content)\n\treturn &Container{JSONContainer: jsonContainer}, err\n}", "func PbContent(c *table.Content) *Content {\n\tif c == nil {\n\t\treturn nil\n\t}\n\n\treturn &Content{\n\t\tId: c.ID,\n\t\tSpec: PbContentSpec(c.Spec),\n\t\tAttachment: PbContentAttachment(c.Attachment),\n\t\tRevision: pbbase.PbCreatedRevision(c.Revision),\n\t}\n}", "func (s *Service) GetContent(c context.Context, likeSubType int, likes map[int64]*model.Like, ids []int64, wids []int64, mids []int64) (err error) {\n\tswitch likeSubType {\n\tcase model.PICTURE, model.PICTURELIKE, model.DRAWYOO, model.DRAWYOOLIKE, model.TEXT, model.TEXTLIKE, model.QUESTION:\n\t\terr = s.accountAndContent(c, ids, mids, likes)\n\tcase model.VIDEO, model.VIDEOLIKE, model.ONLINEVOTE, model.VIDEO2, model.PHONEVIDEO, model.SMALLVIDEO:\n\t\terr = s.archiveWithTag(c, wids, likes)\n\tcase model.ARTICLE:\n\t\terr = s.articles(c, wids, likes)\n\tcase model.MUSIC:\n\t\terr = s.musicsAndAct(c, wids, mids, likes)\n\tdefault:\n\t\terr = ecode.RequestErr\n\t}\n\treturn\n}", "func (msg *Message) GetContent() interface{} {\n\treturn msg.Content\n}", "func (o ApiImportPtrOutput) ContentFormat() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ApiImport) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ContentFormat\n\t}).(pulumi.StringPtrOutput)\n}", "func (_BaseLibrary *BaseLibraryFilterer) ParseApproveContent(log types.Log) (*BaseLibraryApproveContent, error) {\n\tevent := new(BaseLibraryApproveContent)\n\tif err := _BaseLibrary.contract.UnpackLog(event, \"ApproveContent\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func (msg *Message) Content() []byte {\n\treturn msg.content\n}", "func (obj *Variable) GetContent(ctx context.Context) (*AlfaNumString, error) {\n\tresult := &struct {\n\t\tContent *AlfaNumString `json:\"qContent\"`\n\t}{}\n\terr := obj.RPC(ctx, \"GetContent\", result)\n\treturn result.Content, err\n}", "func NegotiateContent(c echo.Context) Content {\n\theader := c.Request().Header.Get(\"Accept\")\n\tif header == \"\" {\n\t\treturn JSON // default\n\t}\n\n\taccept := goautoneg.ParseAccept(header)\n\tif len(accept) == 0 {\n\t\treturn JSON // default\n\t}\n\n\t// use the first element, because this has the highest priority\n\tswitch accept[0].SubType {\n\tcase \"html\":\n\t\treturn HTML\n\tcase \"json\":\n\t\treturn JSON\n\tcase \"plain\":\n\t\treturn TEXT\n\tdefault:\n\t\treturn JSON\n\t}\n}", "func (r *regulator) GetContent(ctx context.Context, path string) ([]byte, error) {\n\tr.enter()\n\tdefer r.exit()\n\n\treturn r.StorageDriver.GetContent(ctx, path)\n}", "func (s ShowApp) GetContent() map[string]interface{} {\n\treturn map[string]interface{}{}\n}", "func (fh *FilesystemHandler) GetContainerContents(container *models.SimpleContainer) error {\n\n\tfullPath := fh.generateFullPath(container)\n\tdir, err := os.OpenFile(fullPath, os.O_RDONLY, 0)\n\tif err != nil {\n\t\tlog.Fatal(\"ERR OpenFile \", err)\n\t}\n\n\tfileInfos, err := dir.Readdir(0)\n\tif err != nil {\n\t\tlog.Fatal(\"ERR ReadDir\", err)\n\t}\n\n\tfor _, f := range fileInfos {\n\n\t\t// determine if file or directory.\n\t\t// do we go recursive?\n\t\tif f.IsDir() {\n\t\t\tsc := models.NewSimpleContainer()\n\t\t\tsc.Name = f.Name()\n\t\t\tsc.Origin = models.Filesystem\n\t\t\tsc.ParentContainer = container\n\t\t\tsc.Populated = false\n\t\t\tsc.IsRootContainer = false\n\t\t\tfh.GetContainerContents(sc)\n\t\t\tcontainer.ContainerSlice = append(container.ContainerSlice, sc)\n\n\t\t} else {\n\t\t\tb := models.SimpleBlob{}\n\t\t\tb.Name = f.Name()\n\t\t\tb.ParentContainer = container\n\t\t\tb.Origin = models.Filesystem\n\t\t\tb.URL = filepath.Join(fh.generateFullPath(container), b.Name)\n\t\t\tcontainer.BlobSlice = append(container.BlobSlice, &b)\n\n\t\t}\n\t}\n\tcontainer.Populated = true\n\n\treturn nil\n}", "func (_BaseContent *BaseContentFilterer) ParseContentObjectCreate(log types.Log) (*BaseContentContentObjectCreate, error) {\n\tevent := new(BaseContentContentObjectCreate)\n\tif err := _BaseContent.contract.UnpackLog(event, \"ContentObjectCreate\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func ParseContentString(text string) (*Appcast, error) {\n\tvar appcast = New()\n\tif err := xml.Unmarshal([]byte(text), appcast); err != nil {\n\t\treturn nil, err\n\t}\n\treturn appcast, nil\n}", "func ContentDecoder(contentType string) func(r io.Reader) Decoder {\n\tswitch contentType {\n\tcase \"application/json\":\n\t\treturn func(r io.Reader) Decoder { return json.NewDecoder(r) }\n\tcase \"application/xml\", \"text/xml\":\n\t\treturn func(r io.Reader) Decoder { return xml.NewDecoder(r) }\n\tcase \"application/x-www-form-urlencoded\", \"multipart/form-data\":\n\t\treturn func(r io.Reader) Decoder { return form.NewDecoder(r) }\n\tdefault:\n\t\treturn func(r io.Reader) Decoder { return json.NewDecoder(r) }\n\t}\n}", "func (o LookupDocumentResultOutput) Content() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupDocumentResult) string { return v.Content }).(pulumi.StringOutput)\n}", "func NewContent(toRead interface{}) *Content {\n\treturn &Content{read: toRead, eof: false}\n}" ]
[ "0.57283705", "0.56128794", "0.55986345", "0.55372673", "0.54029614", "0.5345638", "0.5332285", "0.5297525", "0.5254313", "0.5217522", "0.51418024", "0.5105939", "0.509732", "0.50940305", "0.5086418", "0.5086146", "0.50813574", "0.50558066", "0.50556326", "0.50510985", "0.50381976", "0.5036844", "0.50088984", "0.5005999", "0.50050104", "0.5003388", "0.49737796", "0.49687752", "0.49628815", "0.4957375", "0.49499902", "0.49493366", "0.4915526", "0.4909735", "0.48736137", "0.48725843", "0.4871402", "0.4857189", "0.48482195", "0.48469415", "0.4823832", "0.48157775", "0.48028404", "0.48009917", "0.47999138", "0.47791368", "0.47769597", "0.47660735", "0.4759403", "0.47577474", "0.47565818", "0.4753495", "0.47530136", "0.47451478", "0.47422272", "0.47324726", "0.4722217", "0.47094464", "0.47020376", "0.4659754", "0.4654114", "0.46355176", "0.46340975", "0.46284562", "0.46261543", "0.46255526", "0.46245244", "0.46184024", "0.46177518", "0.46130514", "0.4612625", "0.46105963", "0.46078616", "0.46044636", "0.45995834", "0.45983407", "0.45972654", "0.45860955", "0.45778236", "0.45529553", "0.45519978", "0.45404127", "0.45309827", "0.452757", "0.45239112", "0.45196354", "0.45143345", "0.44995764", "0.44953468", "0.44910264", "0.44909567", "0.44891688", "0.44876194", "0.44847643", "0.44774032", "0.44762656", "0.44761902", "0.4474418", "0.44701836", "0.44604078" ]
0.728402
0
doList list all entities inside a folder.
func doList(clnt Client, isRecursive, isIncomplete bool) error { prefixPath := clnt.GetURL().Path separator := string(clnt.GetURL().Separator) if !strings.HasSuffix(prefixPath, separator) { prefixPath = prefixPath[:strings.LastIndex(prefixPath, separator)+1] } var cErr error for content := range clnt.List(isRecursive, isIncomplete, false, DirNone) { if content.Err != nil { switch content.Err.ToGoError().(type) { // handle this specifically for filesystem related errors. case BrokenSymlink: errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list broken link.") continue case TooManyLevelsSymlink: errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list too many levels link.") continue case PathNotFound: errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.") continue case PathInsufficientPermission: errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.") continue } errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.") cErr = exitStatus(globalErrorExitStatus) // Set the exit status. continue } if content.StorageClass == s3StorageClassGlacier { continue } // Convert any os specific delimiters to "/". contentURL := filepath.ToSlash(content.URL.Path) prefixPath = filepath.ToSlash(prefixPath) // Trim prefix of current working dir prefixPath = strings.TrimPrefix(prefixPath, "."+separator) // Trim prefix path from the content path. contentURL = strings.TrimPrefix(contentURL, prefixPath) content.URL.Path = contentURL parsedContent := parseContent(content) // Print colorized or jsonized content info. printMsg(parsedContent) } return cErr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\tvar iErr error\n\t_, err = f.listAll(ctx, dir, false, false, defaultDepth, func(remote string, isDir bool, info *api.Prop) bool {\n\t\tif isDir {\n\t\t\td := fs.NewDir(remote, time.Time(info.Modified))\n\t\t\t// .SetID(info.ID)\n\t\t\t// FIXME more info from dir? can set size, items?\n\t\t\tentries = append(entries, d)\n\t\t} else {\n\t\t\to, err := f.newObjectWithInfo(ctx, remote, info)\n\t\t\tif err != nil {\n\t\t\t\tiErr = err\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tentries = append(entries, o)\n\t\t}\n\t\treturn false\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif iErr != nil {\n\t\treturn nil, iErr\n\t}\n\treturn entries, nil\n}", "func (a *app) List(w http.ResponseWriter, request provider.Request, message rendererModel.Message) {\n\tfiles, err := a.storage.List(request.GetFilepath(\"\"))\n\tif err != nil {\n\t\ta.renderer.Error(w, request, provider.NewError(http.StatusInternalServerError, err))\n\t\treturn\n\t}\n\n\turi := request.GetURI(\"\")\n\n\titems := make([]provider.RenderItem, len(files))\n\tfor index, file := range files {\n\t\titems[index] = provider.RenderItem{\n\t\t\tID: sha.Sha1(file.Name),\n\t\t\tURI: uri,\n\t\t\tStorageItem: file,\n\t\t}\n\t}\n\n\tcontent := map[string]interface{}{\n\t\t\"Paths\": getPathParts(uri),\n\t\t\"Files\": items,\n\t\t\"Cover\": a.getCover(files),\n\t}\n\n\tif request.CanShare {\n\t\tcontent[\"Shares\"] = a.metadatas\n\t}\n\n\ta.renderer.Directory(w, request, content, message)\n}", "func (c *Client) List(path string) (entries []client.DirEnt, err error) {\n\tvar ret internal.ListReturn\n\terr = c.server.Call(\"list\", &ret, path, c.session)\n\tif err != nil {\n\t\treturn nil, client.MakeFatalError(err)\n\t}\n\tif ret.Err != \"\" {\n\t\treturn nil, fmt.Errorf(ret.Err)\n\t}\n\tvar ents []client.DirEnt\n\tfor _, e := range ret.Entries {\n\t\tents = append(ents, e)\n\t}\n\treturn ents, nil\n}", "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\tdirectoryID, err := f.dirCache.FindDir(ctx, dir, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar iErr error\n\t_, err = f.listAll(ctx, directoryID,\n\t\tfunc(info *api.File) bool {\n\t\t\tremote := path.Join(dir, info.Name)\n\t\t\to, err := f.newObjectWithInfo(ctx, remote, info)\n\t\t\tif err != nil {\n\t\t\t\tiErr = err\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tentries = append(entries, o)\n\t\t\treturn false\n\t\t},\n\t\tfunc(info *api.Collection) bool {\n\t\t\tremote := path.Join(dir, info.Name)\n\t\t\tid := info.Ref\n\t\t\t// cache the directory ID for later lookups\n\t\t\tf.dirCache.Put(remote, id)\n\t\t\td := fs.NewDir(remote, info.TimeCreated).SetID(id)\n\t\t\tentries = append(entries, d)\n\t\t\treturn false\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif iErr != nil {\n\t\treturn nil, iErr\n\t}\n\treturn entries, nil\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 doList(ctx context.Context, clnt Client, isRecursive, isIncomplete bool, timeRef time.Time, withOlderVersions bool) error {\n\n\tvar (\n\t\tlastPath string\n\t\tperObjectVersions []*ClientContent\n\t\tcErr error\n\t)\n\n\tfor content := range clnt.List(ctx, ListOptions{\n\t\tisRecursive: isRecursive,\n\t\tisIncomplete: isIncomplete,\n\t\ttimeRef: timeRef,\n\t\twithOlderVersions: withOlderVersions || !timeRef.IsZero(),\n\t\twithDeleteMarkers: true,\n\t\tshowDir: DirNone,\n\t}) {\n\t\tif content.Err != nil {\n\t\t\tswitch content.Err.ToGoError().(type) {\n\t\t\t// handle this specifically for filesystem related errors.\n\t\t\tcase BrokenSymlink:\n\t\t\t\terrorIf(content.Err.Trace(clnt.GetURL().String()), \"Unable to list broken link.\")\n\t\t\t\tcontinue\n\t\t\tcase TooManyLevelsSymlink:\n\t\t\t\terrorIf(content.Err.Trace(clnt.GetURL().String()), \"Unable to list too many levels link.\")\n\t\t\t\tcontinue\n\t\t\tcase PathNotFound:\n\t\t\t\terrorIf(content.Err.Trace(clnt.GetURL().String()), \"Unable to list folder.\")\n\t\t\t\tcontinue\n\t\t\tcase PathInsufficientPermission:\n\t\t\t\terrorIf(content.Err.Trace(clnt.GetURL().String()), \"Unable to list folder.\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terrorIf(content.Err.Trace(clnt.GetURL().String()), \"Unable to list folder.\")\n\t\t\tcErr = exitStatus(globalErrorExitStatus) // Set the exit status.\n\t\t\tcontinue\n\t\t}\n\n\t\tif content.StorageClass == s3StorageClassGlacier {\n\t\t\tcontinue\n\t\t}\n\n\t\tif lastPath != content.URL.Path {\n\t\t\t// Print any object in the current list before reinitializing it\n\t\t\tprintObjectVersions(clnt.GetURL(), perObjectVersions, withOlderVersions)\n\t\t\tlastPath = content.URL.Path\n\t\t\tperObjectVersions = []*ClientContent{}\n\t\t}\n\n\t\tperObjectVersions = append(perObjectVersions, content)\n\t}\n\n\tprintObjectVersions(clnt.GetURL(), perObjectVersions, withOlderVersions)\n\treturn cErr\n}", "func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {\n\tentries, err = f.Fs.List(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f.processEntries(entries)\n}", "func (s *fsStore) List(typ namespace.Type) []string {\n\tout := []string{}\n\tdir := filepath.Join(s.root, typ.StringLower())\n\tfl, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn out\n\t}\n\tfor _, inf := range fl {\n\t\tout = append(out, inf.Name())\n\t}\n\treturn out\n}", "func (_Bfs *BfsSession) List(absolutePath string, offset *big.Int, limit *big.Int) (*big.Int, []BfsInfo, error) {\n\treturn _Bfs.Contract.List(&_Bfs.CallOpts, absolutePath, offset, limit)\n}", "func (_Bfs *BfsCallerSession) List(absolutePath string, offset *big.Int, limit *big.Int) (*big.Int, []BfsInfo, error) {\n\treturn _Bfs.Contract.List(&_Bfs.CallOpts, absolutePath, offset, limit)\n}", "func (f *Fs) listAll(ctx context.Context, dirID string, fileFn listAllFileFn, folderFn listAllFolderFn) (found bool, err error) {\n\topts := rest.Opts{\n\t\tMethod: \"GET\",\n\t\tRootURL: dirID,\n\t\tPath: \"/contents\",\n\t\tParameters: url.Values{},\n\t}\n\topts.Parameters.Set(\"max\", strconv.Itoa(listChunks))\n\tstart := 0\nOUTER:\n\tfor {\n\t\topts.Parameters.Set(\"start\", strconv.Itoa(start))\n\n\t\tvar result api.CollectionContents\n\t\tvar resp *http.Response\n\t\terr = f.pacer.Call(func() (bool, error) {\n\t\t\tresp, err = f.srv.CallXML(ctx, &opts, nil, &result)\n\t\t\treturn shouldRetry(ctx, resp, err)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn found, fmt.Errorf(\"couldn't list files: %w\", err)\n\t\t}\n\t\tif fileFn != nil {\n\t\t\tfor i := range result.Files {\n\t\t\t\titem := &result.Files[i]\n\t\t\t\titem.Name = f.opt.Enc.ToStandardName(item.Name)\n\t\t\t\tif fileFn(item) {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak OUTER\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif folderFn != nil {\n\t\t\tfor i := range result.Collections {\n\t\t\t\titem := &result.Collections[i]\n\t\t\t\titem.Name = f.opt.Enc.ToStandardName(item.Name)\n\t\t\t\tif folderFn(item) {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak OUTER\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !result.HasMore {\n\t\t\tbreak\n\t\t}\n\t\tstart = result.End + 1\n\t}\n\treturn\n}", "func (d *Directory) List(p string) ([]INodeInfo, error) {\n\tdir, err := d.checkPathExists(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn generateINodeInfos(dir.INodes), nil\n}", "func List(w http.ResponseWriter, r *http.Request) {\n\tvar dl models.DirList\n\tdl.Path = r.URL.Path\n\t// scan the current path\n\terr := dl.ScanPath(r.URL.Path)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// repair url if someone misses a /\n\tif dl.Redirect {\n\t\thttp.Redirect(w, r, r.URL.Path+\"/\", http.StatusMovedPermanently)\n\t}\n\t// if the path ends in a file\n\tif dl.IsFile {\n\t\t// either use reverse proxy\n\t\tif models.ReverseProxy {\n\t\t\turi, _ := url.Parse(models.DirectUrl + r.URL.Path)\n\t\t\tproxy := httputil.ReverseProxy{Director: func(r *http.Request) {\n\t\t\t\tr.URL.Scheme = uri.Scheme\n\t\t\t\tr.URL.Host = uri.Host\n\t\t\t\tr.URL.Path = uri.Path\n\t\t\t\tr.Host = uri.Host\n\t\t\t}}\n\t\t\tproxy.ServeHTTP(w, r)\n\t\t} else {\n\t\t\t// or just redirect\n\t\t\thttp.Redirect(w, r, models.DirectUrl+r.URL.Path, http.StatusTemporaryRedirect)\n\t\t}\n\n\t} else {\n\t\t// if no files/folders scanned and not in root path in an empty bucket\n\t\tif len(dl.Folders) < 1 && len(dl.Files) < 1 && r.URL.Path != \"/\" {\n\t\t\thttp.Error(w, \"file/folder not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\t// if all fine, render the html template\n\t\tres, err := dl.RenderHtml()\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// and return the rendered html file\n\t\t_, err = w.Write(res)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n}", "func (fs *Ipfs) List(path string) ([]*oss.Object, error) {\n\tdir := ipath.New(path)\n\tentries, err := fs.coreAPI.Unixfs().Ls(context.Background(), dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdl := make([]*oss.Object, 0)\n\tnow := time.Now()\nloop:\n\tfor {\n\t\tselect {\n\t\tcase entry, ok := <-entries:\n\t\t\tif !ok {\n\t\t\t\tbreak loop\n\t\t\t}\n\n\t\t\tvar n string\n\t\t\tp := entry.Cid.String()\n\t\t\tif strings.HasPrefix(p, \"/ipfs/\") {\n\t\t\t\tn = strings.Split(p, \"/\")[2]\n\t\t\t} else {\n\t\t\t\tn = p\n\t\t\t\tp = \"/ipfs/\" + p\n\t\t\t}\n\n\t\t\tdl = append(dl, &oss.Object{\n\t\t\t\tPath: p,\n\t\t\t\tName: n,\n\t\t\t\tLastModified: &now,\n\t\t\t\tStorageInterface: fs,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn dl, nil\n}", "func listHandler(w http.ResponseWriter, r *http.Request, opts config.CookieSettings, isOverlay bool) {\n\tif gallery.ContainsDotFile(r.URL.Path) {\n\t\tfail404(w, r)\n\t\treturn\n\t}\n\tvar (\n\t\tparentUrl string\n\t\ttitle string\n\t\terr error\n\t\tcontents []os.FileInfo\n\t\tfolderPath string\n\t)\n\tfolderPath = strings.TrimPrefix(r.URL.Path, urlPrefix)\n\tif isOverlay {\n\t\tfolderPath = filepath.Dir(folderPath)\n\t}\n\tfs, err := storage.Root.Open(folderPath)\n\tif err != nil {\n\t\tfail500(w, err, r)\n\t\treturn\n\t}\n\tdefer fs.Close()\n\tcontents, err = fs.Readdir(-1)\n\tif err != nil {\n\t\tfail500(w, err, r)\n\t\treturn\n\t}\n\n\tfolderInfo, _ := fs.Stat()\n\tif folderPath != \"/\" && folderPath != \"\" {\n\t\ttitle = filepath.Base(r.URL.Path)\n\t\tparentUrl = path.Join(urlPrefix, folderPath, \"..\")\n\t} else if config.Global.PublicHost != \"\" {\n\t\ttitle = config.Global.PublicHost\n\t}\n\n\tchildren := make([]templates.ListItem, 0, len(contents))\n\tfor _, child := range contents {\n\t\tif gallery.ContainsDotFile(child.Name()) {\n\t\t\tcontinue\n\t\t}\n\t\tmediaClass := gallery.GetMediaClass(child.Name())\n\t\tif !child.IsDir() && mediaClass == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tchildPath := filepath.Join(urlPrefix, folderPath, child.Name())\n\t\tchildPath = gallery.EscapePath(filepath.ToSlash(childPath))\n\t\tthumb := urlPrefix + \"/?static=folder.svg\"\n\t\tclass := \"folder\"\n\t\tif !child.IsDir() {\n\t\t\tthumb = gallery.EscapePath(filepath.Join(urlPrefix, folderPath, child.Name())) + \"?thumb\"\n\t\t\tclass = mediaClass\n\t\t\tif config.Global.Ffmpeg == \"\" {\n\t\t\t\tclass += \" nothumb\"\n\t\t\t}\n\t\t}\n\t\tif child.ModTime().Before(faultyDate) {\n\t\t\t// TODO: find the reason for afero bad dates and remove this fix\n\t\t\tlogger.Printf(\"Invalid date detected for %s\", childPath)\n\t\t\tchild, _ = storage.Root.Stat(filepath.Join(folderPath, child.Name()))\n\t\t}\n\t\tchildren = append(children, templates.ListItem{\n\t\t\tId: gallery.EscapePath(child.Name()),\n\t\t\tModTime: child.ModTime(),\n\t\t\tUrl: childPath,\n\t\t\tName: child.Name(),\n\t\t\tThumb: thumb,\n\t\t\tClass: class,\n\t\t\tW: config.Global.ThumbWidth,\n\t\t\tH: config.Global.ThumbHeight,\n\t\t})\n\t}\n\tif opts.Sort == \"date\" {\n\t\tsort.Slice(children, func(i, j int) bool {\n\t\t\tif opts.Order {\n\t\t\t\tj, i = i, j\n\t\t\t}\n\t\t\treturn children[i].ModTime.Before(children[j].ModTime)\n\t\t})\n\t} else { // Sort by name\n\t\tsort.Slice(children, func(i, j int) bool {\n\t\t\tif opts.Order {\n\t\t\t\tj, i = i, j\n\t\t\t}\n\t\t\treturn gallery.NaturalLess(\n\t\t\t\tstrings.ToLower(children[i].Name),\n\t\t\t\tstrings.ToLower(children[j].Name))\n\t\t})\n\t}\n\tpUrl, _ := url.Parse(folderPath)\n\tcrumbs := splitUrlToBreadCrumbs(pUrl)\n\tw.Header().Set(\"Date\", folderInfo.ModTime().UTC().Format(http.TimeFormat))\n\titemCount := \"\"\n\tif folderPath != \"/\" && folderPath != \"\" && len(children) > 0 {\n\t\titemCount = fmt.Sprintf(\"%v \", len(children))\n\t}\n\terr = templates.Html.ExecuteTemplate(w, \"layout\", &templates.List{\n\t\tPage: templates.Page{\n\t\t\tTitle: title,\n\t\t\tPrefix: urlPrefix,\n\t\t\tAppVersion: BuildVersion,\n\t\t\tAppBuildTime: BuildTimestamp,\n\t\t\tShowOverlay: isOverlay,\n\t\t},\n\t\tBreadCrumbs: crumbs,\n\t\tItemCount: itemCount,\n\t\tSortedBy: opts.Sort,\n\t\tIsReversed: opts.Order,\n\t\tDisplayMode: opts.Show,\n\t\tParentUrl: parentUrl,\n\t\tItems: children,\n\t})\n\tif err != nil {\n\t\tfail500(w, err, r)\n\t\treturn\n\t}\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 (db database) list(w http.ResponseWriter, req *http.Request) {\n\n\tif err := itemList.Execute(w, db); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (d *Dirs) List() {\n\tfor a, p := range *d {\n\t\tfmt.Printf(\"%s: %s\\n\", a, p)\n\t}\n}", "func (s *Service) ListAll() ([]*basefs.File, error) {\n\tret := []*basefs.File{}\n\n\trootNode := s.megaCli.FS.GetRoot()\n\n\tvar addAll func(*mega.Node, string) // Closure that basically appends entries to local ret\n\taddAll = func(n *mega.Node, pathstr string) {\n\t\tchildren, err := s.megaCli.FS.GetChildren(n)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t// Add to ret\n\t\tfor _, childNode := range children {\n\t\t\tspath := pathstr + \"/\" + childNode.GetName()\n\t\t\tret = append(ret, File(&MegaPath{Path: spath, Node: childNode}))\n\t\t\tif childNode.GetType() == mega.FOLDER {\n\t\t\t\taddAll(childNode, pathstr+\"/\"+childNode.GetName())\n\t\t\t}\n\t\t}\n\t}\n\n\taddAll(rootNode, \"\")\n\n\treturn ret, nil\n\n}", "func (fs *IPfsfs) List(path string) (items []string, err error) {\n\tli, err := fs.fullListing(path)\n\tref := li.Arguments[\"/ipfs/\"+fs.base+\"/\"+path]\n\tfor _, it := range li.Objects[ref].Links {\n\t\titems = append(items, it.Name)\n\t}\n\treturn items, nil\n}", "func (td *TreeDirectory) List() []TreeDirectoryEntry {\n\tvar o []TreeDirectoryEntry\n\tfor _, e := range td.flatDents {\n\t\to = append(o, *e)\n\t}\n\treturn o\n}", "func (hp *hdfsProvider) ListObjects(bck *meta.Bck, msg *apc.LsoMsg, lst *cmn.LsoResult) (int, error) {\n\tvar (\n\t\th = cmn.BackendHelpers.HDFS\n\t\tidx int\n\t)\n\tmsg.PageSize = calcPageSize(msg.PageSize, hp.MaxPageSize())\n\n\terr := hp.c.Walk(bck.Props.Extra.HDFS.RefDirectory, func(path string, fi os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tif cos.IsEOF(err) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tif uint(len(lst.Entries)) >= msg.PageSize {\n\t\t\treturn skipDir(fi)\n\t\t}\n\t\tobjName := strings.TrimPrefix(strings.TrimPrefix(path, bck.Props.Extra.HDFS.RefDirectory), string(filepath.Separator))\n\t\tif msg.Prefix != \"\" {\n\t\t\tif fi.IsDir() {\n\t\t\t\tif !cmn.DirHasOrIsPrefix(objName, msg.Prefix) {\n\t\t\t\t\treturn skipDir(fi)\n\t\t\t\t}\n\t\t\t} else if !cmn.ObjHasPrefix(objName, msg.Prefix) {\n\t\t\t\treturn skipDir(fi)\n\t\t\t}\n\t\t}\n\t\tif msg.ContinuationToken != \"\" && objName <= msg.ContinuationToken {\n\t\t\treturn nil\n\t\t}\n\t\tif msg.StartAfter != \"\" && objName <= msg.StartAfter {\n\t\t\treturn nil\n\t\t}\n\t\tif fi.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tvar entry *cmn.LsoEntry\n\t\tif idx < len(lst.Entries) {\n\t\t\tentry = lst.Entries[idx]\n\t\t} else {\n\t\t\tentry = &cmn.LsoEntry{Name: objName}\n\t\t\tlst.Entries = append(lst.Entries, entry)\n\t\t}\n\t\tidx++\n\t\tentry.Size = fi.Size()\n\t\tif msg.WantProp(apc.GetPropsChecksum) {\n\t\t\tfr, err := hp.c.Open(path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer fr.Close()\n\t\t\tcksum, err := fr.Checksum()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif v, ok := h.EncodeCksum(cksum); ok {\n\t\t\t\tentry.Checksum = v\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn hdfsErrorToAISError(err)\n\t}\n\tlst.Entries = lst.Entries[:idx]\n\t// Set continuation token only if we reached the page size.\n\tif uint(len(lst.Entries)) >= msg.PageSize {\n\t\tlst.ContinuationToken = lst.Entries[len(lst.Entries)-1].Name\n\t}\n\treturn 0, 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 listDir(itemsDir string) []string {\n\tf, err := os.Open(itemsDir)\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot open dir \", itemsDir)\n\t}\n\titems, err := f.Readdirnames(0)\n\tif err != nil {\n\t\tlog.Fatal(\"Cannot get list of items from \", itemsDir)\n\t}\n\treturn items\n}", "func (a *API) List(path string) (*ListObject, error) {\n\tvar out struct {\n\t\tObjects []*ListObject\n\t}\n\terr := a.Request(\"ls\", path).Exec(context.Background(), &out)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(out.Objects) != 1 {\n\t\treturn nil, errors.New(\"bad response from server\")\n\t}\n\treturn out.Objects[0], nil\n}", "func (c *Client) List(prefix string, opts ...backend.ListOption) (*backend.ListResult, error) {\n\toptions := backend.DefaultListOptions()\n\tfor _, opt := range opts {\n\t\topt(options)\n\t}\n\n\tif options.Paginated {\n\t\treturn nil, errors.New(\"pagination not supported\")\n\t}\n\n\troot := path.Join(c.pather.BasePath(), prefix)\n\n\tlistJobs := make(chan string)\n\tresults := make(chan listResult)\n\tdone := make(chan struct{})\n\n\tvar wg sync.WaitGroup\n\n\tfor i := 0; i < c.config.ListConcurrency; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tc.lister(done, listJobs, results)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\tdefer func() {\n\t\tclose(done)\n\t\tif c.config.testing {\n\t\t\t// Waiting might be delayed if an early error is encountered but\n\t\t\t// other goroutines are waiting on a long http timeout. Thus, we\n\t\t\t// only wait for each spawned goroutine to exit during testing to\n\t\t\t// assert that no goroutines leak.\n\t\t\twg.Wait()\n\t\t}\n\t}()\n\n\tvar files []string\n\n\t// Pending tracks the number of directories which are pending exploration.\n\t// Invariant: there will be a result received for every increment made to\n\t// pending.\n\tpending := 1\n\tlistJobs <- root\n\n\tfor pending > 0 {\n\t\tres := <-results\n\t\tpending--\n\t\tif res.err != nil {\n\t\t\tif httputil.IsNotFound(res.err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, res.err\n\t\t}\n\t\tvar dirs []string\n\t\tfor _, fs := range res.list {\n\t\t\tp := path.Join(res.dir, fs.PathSuffix)\n\n\t\t\t// TODO(codyg): This is an ugly hack to avoid walking through non-tags\n\t\t\t// during Docker catalog. Ideally, only tags are located in the repositories\n\t\t\t// directory, however in WBU2 HDFS, there are blobs here as well. At some\n\t\t\t// point, we must migrate the data into a structure which cleanly divides\n\t\t\t// blobs and tags (like we do in S3).\n\t\t\tif _ignoreRegex.MatchString(p) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// TODO(codyg): Another ugly hack to speed up catalog performance by stopping\n\t\t\t// early when we hit tags...\n\t\t\tif _stopRegex.MatchString(p) {\n\t\t\t\tp = path.Join(p, \"tags/dummy/current/link\")\n\t\t\t\tfs.Type = \"FILE\"\n\t\t\t}\n\n\t\t\tif fs.Type == \"DIRECTORY\" {\n\t\t\t\t// Flat directory structures are common, so accumulate directories and send\n\t\t\t\t// them to the listers in a single goroutine (as opposed to a goroutine per\n\t\t\t\t// directory).\n\t\t\t\tdirs = append(dirs, p)\n\t\t\t} else {\n\t\t\t\tname, err := c.pather.NameFromBlobPath(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.With(\"path\", p).Errorf(\"Error converting blob path into name: %s\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfiles = append(files, name)\n\t\t\t}\n\t\t}\n\t\tif len(dirs) > 0 {\n\t\t\t// We cannot send list jobs and receive results in the same thread, else\n\t\t\t// deadlock will occur.\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tc.sendAll(done, dirs, listJobs)\n\t\t\t\twg.Done()\n\t\t\t}()\n\t\t\tpending += len(dirs)\n\t\t}\n\t}\n\n\treturn &backend.ListResult{\n\t\tNames: files,\n\t}, nil\n}", "func (s *Store) List(_ context.Context, start string, f func(string) error) error {\n\troots, err := listdir(s.dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, root := range roots {\n\t\tkeys, err := listdir(filepath.Join(s.dir, root))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, tail := range keys {\n\t\t\tkey, err := decodeKey(root + tail)\n\t\t\tif err != nil || key < start {\n\t\t\t\tcontinue // skip non-key files and keys prior to the start\n\t\t\t} else if err := f(key); errors.Is(err, blob.ErrStopListing) {\n\t\t\t\treturn nil\n\t\t\t} else if err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func List(ctx context.Context) ([]meta.SimpleTreeNode, error) {\n\tvar managerService = services.NewManagerService()\n\tvar data, err = managerService.MenuList()\n\treturn data, err\n}", "func (d *dir) list(path string, output []string) []string {\n\tdirPath := filepath.Join(path, d.name)\n\toutput = append(output, dirPath)\n\tfor _, subDir := range d.children {\n\t\toutput = subDir.list(dirPath, output)\n\t}\n\treturn output\n}", "func List(c echo.Context) error {\n\t// TODO: check authorized\n\tctx := ServerContext(c)\n\n\titem := reflect.New(ctx.Type).Interface().(gruff.ArangoObject)\n\n\tparams := item.DefaultQueryParameters()\n\tparams = params.Merge(GetListParametersFromRequest(c))\n\n\tuserID := ActiveUserID(c, ctx)\n\tfilters := gruff.BindVars{}\n\tvar query string\n\tif userID != \"\" && gruff.IsVersionedModel(ctx.Type) {\n\t\tfilters[\"creator\"] = userID\n\t\tquery = gruff.DefaultListQueryForUser(item, params)\n\t} else {\n\t\tquery = gruff.DefaultListQuery(item, params)\n\t}\n\n\titems := []interface{}{}\n\tif err := gruff.FindArangoObjects(ctx, query, filters, &items); err != nil {\n\t\treturn AddError(ctx, c, err)\n\t}\n\n\tctx.Payload[\"results\"] = items\n\treturn c.JSON(http.StatusOK, ctx.Payload)\n}", "func (st *fakeConn) ListDir(ctx context.Context, dirPath string, full bool) (res []DirEntry, err error) {\n\tif dirPath == \"error\" {\n\t\treturn res, fmt.Errorf(\"Dummy error\")\n\n\t}\n\treturn res, err\n}", "func (ep *EtcdClient) ListDir(key string) ([]string, error) {\n\tkeyName := \"/contiv.io/obj/\" + key\n\n\tgetOpts := client.GetOptions{\n\t\tRecursive: true,\n\t\tSort: true,\n\t\tQuorum: true,\n\t}\n\n\t// Get the object from etcd client\n\tresp, err := ep.kapi.Get(context.Background(), keyName, &getOpts)\n\tif err != nil {\n\t\t// Retry few times if cluster is unavailable\n\t\tif err.Error() == client.ErrClusterUnavailable.Error() {\n\t\t\tfor i := 0; i < maxEtcdRetries; i++ {\n\t\t\t\tresp, err = ep.kapi.Get(context.Background(), keyName, &getOpts)\n\t\t\t\tif err == nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\t// Retry after a delay\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\tif !resp.Node.Dir {\n\t\tlog.Errorf(\"ListDir response is not a directory\")\n\t\treturn nil, errors.New(\"Response is not directory\")\n\t}\n\n\tvar retList []string\n\t// Call a recursive function to recurse thru each directory and get all files\n\t// Warning: assumes directory itep is not interesting to the caller\n\t// Warning2: there is also an assumption that keynames are not required\n\t// Which means, caller has to derive the key from value :(\n\tretList = recursAddNode(resp.Node, retList)\n\n\treturn retList, nil\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 List(baseURL, resourceType string) (*jsh.Document, *http.Response, error) {\n\trequest, err := ListRequest(baseURL, resourceType)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn Do(request, jsh.ListMode)\n}", "func (d *driver) List(ctx context.Context, path string) ([]string, error) {\n\tdefer debugTime()()\n\toutput, err := d.shell.FileList(d.fullPath(path))\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"no link named\") {\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: path}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tkeys := make([]string, 0, len(output.Links))\n\tfor _, link := range output.Links {\n\t\tkeys = append(keys, _path.Join(path, link.Name))\n\t}\n\n\treturn keys, nil\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 (d *driver) List(ctx context.Context, path string) ([]string, error) {\n\tif path != delimiter && path[len(path)-1] != delimiter[0] {\n\t\tpath = path + delimiter\n\t}\n\n\titemLists, dirLists, _, err := d.Bucket.List(ctx, path, delimiter, \"\", listLimit)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\tfiles := make([]string, 0, len(itemLists) + len(dirLists))\n\tfor _, value := range itemLists{\n\t\tfiles = append(files, value.Key)\n\t}\n\n\treturn append(files, dirLists...), nil\n}", "func fetchFileListing() ([]string, error) {\n\n\tresp, err := http.Get(rootURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn parseDirectoryListing(resp.Body), nil\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 (ep *EtcdClient) ListDir(key string) ([]string, error) {\n\tkeyName := \"/contiv.io/obj/\" + key\n\n\n\t// Get the object from etcd client\n\tresp, err := ep.client.KV.Get(context.Background(), keyName, client.WithPrefix(), client.WithSort(client.SortByKey, client.SortAscend))\n\tif err != nil {\n\t\t// Retry few times if cluster is unavailable\n\t\tif err.Error() == client.ErrNoAvailableEndpoints.Error() {\n\t\t\tfor i := 0; i < maxEtcdRetries; i++ {\n\t\t\t\tresp, err = ep.client.KV.Get(context.Background(), keyName, client.WithPrefix(), client.WithSort(client.SortByKey, client.SortAscend))\n\t\t\t\tif err == nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\t// Retry after a delay\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif resp.Count == 0 {\n\t\treturn nil, fmt.Errorf(\"Key not found\") \n\t}\n\tvar retList []string\n\n\t// convert all the keys into strings (etcd3 doesn't have directories)\n\tfor _, kv := range resp.Kvs {\n\t\tretList = append(retList, string(kv.Value))\n\t}\n\treturn retList, nil\n}", "func (_Bfs *BfsCaller) List(opts *bind.CallOpts, absolutePath string, offset *big.Int, limit *big.Int) (*big.Int, []BfsInfo, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t\tret1 = new([]BfsInfo)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t}\n\terr := _Bfs.contract.Call(opts, out, \"list\", absolutePath, offset, limit)\n\treturn *ret0, *ret1, err\n}", "func repoList(w http.ResponseWriter, r *http.Request) {}", "func (client *Client) List(path string) ([]*api.LsLink, error) {\n\treturn client.client.List(path)\n}", "func listHandler(usr string, token string, path string) internal.ListReturn {\n\tif IsValidToken(usr, token) {\n\t\tusr_info := GetUser(usr)\n\t\t// authenticate the path\n\t\tvalid, encrypt_path := AuthenticatePath(path, usr_info)\n\t\tif valid {\n\t\t\treturn ReadDir(encrypt_path, path, usr_info)\n\t\t}\n\t}\n\treturn internal.ListReturn{Err: ErrorMessage(\"open\", path)}\n}", "func (d *DiskStore) list() ([]string, error) {\n\terr := d.initOnce()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn speedwalk.AllFiles(d.blobDir, true)\n}", "func (f *Fs) listAll(ctx context.Context, dir string, directoriesOnly bool, filesOnly bool, depth string, fn listAllFn) (found bool, err error) {\n\topts := rest.Opts{\n\t\tMethod: \"PROPFIND\",\n\t\tPath: f.dirPath(dir), // FIXME Should not start with /\n\t\tExtraHeaders: map[string]string{\n\t\t\t\"Depth\": depth,\n\t\t},\n\t}\n\tif f.hasOCMD5 || f.hasOCSHA1 {\n\t\topts.Body = bytes.NewBuffer(owncloudProps)\n\t}\n\tvar result api.Multistatus\n\tvar resp *http.Response\n\terr = f.pacer.Call(func() (bool, error) {\n\t\tresp, err = f.srv.CallXML(ctx, &opts, nil, &result)\n\t\treturn f.shouldRetry(ctx, resp, err)\n\t})\n\tif err != nil {\n\t\tif apiErr, ok := err.(*api.Error); ok {\n\t\t\t// does not exist\n\t\t\tif apiErr.StatusCode == http.StatusNotFound {\n\t\t\t\tif f.retryWithZeroDepth && depth != \"0\" {\n\t\t\t\t\treturn f.listAll(ctx, dir, directoriesOnly, filesOnly, \"0\", fn)\n\t\t\t\t}\n\t\t\t\treturn found, fs.ErrorDirNotFound\n\t\t\t}\n\t\t}\n\t\treturn found, fmt.Errorf(\"couldn't list files: %w\", err)\n\t}\n\t//fmt.Printf(\"result = %#v\", &result)\n\tbaseURL, err := rest.URLJoin(f.endpoint, opts.Path)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"couldn't join URL: %w\", err)\n\t}\n\tfor i := range result.Responses {\n\t\titem := &result.Responses[i]\n\t\tisDir := itemIsDir(item)\n\n\t\t// Find name\n\t\tu, err := rest.URLJoin(baseURL, item.Href)\n\t\tif err != nil {\n\t\t\tfs.Errorf(nil, \"URL Join failed for %q and %q: %v\", baseURL, item.Href, err)\n\t\t\tcontinue\n\t\t}\n\t\t// Make sure directories end with a /\n\t\tif isDir {\n\t\t\tu.Path = addSlash(u.Path)\n\t\t}\n\t\tif !strings.HasPrefix(u.Path, baseURL.Path) {\n\t\t\tfs.Debugf(nil, \"Item with unknown path received: %q, %q\", u.Path, baseURL.Path)\n\t\t\tcontinue\n\t\t}\n\t\tsubPath := u.Path[len(baseURL.Path):]\n\t\tsubPath = strings.TrimPrefix(subPath, \"/\") // ignore leading / here for davrods\n\t\tif f.opt.Enc != encoder.EncodeZero {\n\t\t\tsubPath = f.opt.Enc.ToStandardPath(subPath)\n\t\t}\n\t\tremote := path.Join(dir, subPath)\n\t\tremote = strings.TrimSuffix(remote, \"/\")\n\n\t\t// the listing contains info about itself which we ignore\n\t\tif remote == dir {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check OK\n\t\tif !item.Props.StatusOK() {\n\t\t\tfs.Debugf(remote, \"Ignoring item with bad status %q\", item.Props.Status)\n\t\t\tcontinue\n\t\t}\n\n\t\tif isDir {\n\t\t\tif filesOnly {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tif directoriesOnly {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t// \titem.Name = restoreReservedChars(item.Name)\n\t\tif fn(remote, isDir, &item.Props) {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\t// defer log.Trace(f, \"dir=%q\", dir)(\"entries = %v, err=%v\", &entries, &err)\n\tif f.root == \"\" && dir == \"\" {\n\t\tentries = make(fs.DirEntries, 0, len(f.upstreams))\n\t\tfor combineDir := range f.upstreams {\n\t\t\td := fs.NewDir(combineDir, f.when)\n\t\t\tentries = append(entries, d)\n\t\t}\n\t\treturn entries, nil\n\t}\n\tu, uRemote, err := f.findUpstream(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tentries, err = u.f.List(ctx, uRemote)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn u.wrapEntries(ctx, entries)\n}", "func List(args []string) {\n\tvar filesOrDirs []string\n\tvar recursive, hidden, longListing bool\n\tfor _, s := range args {\n\t\tif s == \"-R\" {\n\t\t\trecursive = true\n\t\t}\n\t\tif s == \"-a\" {\n\t\t\thidden = true\n\t\t}\n\t\tif s == \"-al\" || s == \"-la\" {\n\t\t\t// TODO: Still implement long listing\n\t\t\tlongListing = true\n\t\t\thidden = true\n\t\t}\n\t\tif !strings.HasPrefix(s, \"-\") {\n\t\t\tfilesOrDirs = append(filesOrDirs, s)\n\t\t}\n\t}\n\n\tfor _, s := range filesOrDirs {\n\t\tfi, err := os.Stat(s)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\treturn\n\t\t}\n\t\tswitch mode := fi.Mode(); {\n\t\tcase mode.IsDir():\n\t\t\tprintDirContents(s, hidden, recursive, longListing)\n\t\tcase mode.IsRegular():\n\t\t\tprintFile(s)\n\n\t\t}\n\t}\n\n}", "func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) {\n\tif !strings.HasSuffix(dir, \"/\") && dir != \"\" {\n\t\tdir += \"/\"\n\t}\n\tnames, err := f.readDir(ctx, dir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing %q: %w\", dir, err)\n\t}\n\tvar (\n\t\tentriesMu sync.Mutex // to protect entries\n\t\twg sync.WaitGroup\n\t\tcheckers = f.ci.Checkers\n\t\tin = make(chan string, checkers)\n\t)\n\tadd := func(entry fs.DirEntry) {\n\t\tentriesMu.Lock()\n\t\tentries = append(entries, entry)\n\t\tentriesMu.Unlock()\n\t}\n\tfor i := 0; i < checkers; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor remote := range in {\n\t\t\t\tfile := &Object{\n\t\t\t\t\tfs: f,\n\t\t\t\t\tremote: remote,\n\t\t\t\t}\n\t\t\t\tswitch err := file.head(ctx); err {\n\t\t\t\tcase nil:\n\t\t\t\t\tadd(file)\n\t\t\t\tcase fs.ErrorNotAFile:\n\t\t\t\t\t// ...found a directory not a file\n\t\t\t\t\tadd(fs.NewDir(remote, time.Time{}))\n\t\t\t\tdefault:\n\t\t\t\t\tfs.Debugf(remote, \"skipping because of error: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\tfor _, name := range names {\n\t\tisDir := name[len(name)-1] == '/'\n\t\tname = strings.TrimRight(name, \"/\")\n\t\tremote := path.Join(dir, name)\n\t\tif isDir {\n\t\t\tadd(fs.NewDir(remote, time.Time{}))\n\t\t} else {\n\t\t\tin <- remote\n\t\t}\n\t}\n\tclose(in)\n\twg.Wait()\n\treturn entries, nil\n}", "func (v *dir) List(ctx context.Context) ([]plugin.Entry, error) {\n\tif v.dirmap != nil {\n\t\t// Children have been pre-populated by a source parent.\n\t\treturn v.generateChildren(v.dirmap), nil\n\t}\n\n\t// Generate child hierarchy. Don't store it on this entry, but populate new dirs from it.\n\tdirmap, err := v.impl.VolumeList(ctx, v.path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v.generateChildren(&dirMap{mp: dirmap}), nil\n}", "func (s *SwiftLocation) ListAllFiles(out chan<- FileSpec) *ListEntriesError {\n\tobjectPath := string(s.ObjectNamePrefix)\n\tif objectPath != \"\" && !strings.HasSuffix(objectPath, \"/\") {\n\t\tobjectPath += \"/\"\n\t}\n\tlogg.Debug(\"listing objects at %s/%s recursively\", s.ContainerName, objectPath)\n\n\titer := s.Container.Objects()\n\titer.Prefix = objectPath\n\terr := iter.ForeachDetailed(func(info schwift.ObjectInfo) error {\n\t\tout <- s.getFileSpec(info)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn &ListEntriesError{\n\t\t\tLocation: string(s.ContainerName) + \"/\" + objectPath,\n\t\t\tMessage: \"GET failed\",\n\t\t\tInner: err,\n\t\t}\n\t}\n\n\treturn nil\n}", "func (hpSrv *HomePageServ) List() {\n\tvar (\n\t\tarticelMd []serializer.ArticleModel\n\t)\n\tconf.MYSQL_CONNECT.Order(\"created_at desc\").Find(&articelMd)\n\tif hpSrv.Limit == 0 {\n\t\thpSrv.Limit = 4\n\t}\n\thpSrv.setArticleSet(articelMd)\n\thpSrv.pageCount = setPageCount(len(articelMd), hpSrv.Limit)\n\thpSrv.setPage()\n}", "func runList(cmd *cobra.Command, args []string) error {\n\tverb := \"GET\"\n\turl := \"/v1/query\"\n\n\tresp, err := web.Request(cmd, verb, url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmd.Printf(\"\\n%s\\n\\n\", resp)\n\treturn nil\n}", "func (f *FS) List(path string) (folders []string, files []string, err error) {\n\tp := filepath.Join(f.Root, path)\n\tinfo, err := ioutil.ReadDir(p)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfolders = make([]string, 0, len(info))\n\tfiles = make([]string, 0, len(info))\n\n\tfor _, i := range info {\n\t\tif i.IsDir() {\n\t\t\tfolders = append(folders, i.Name())\n\t\t} else {\n\t\t\tfiles = append(files, i.Name())\n\t\t}\n\t}\n\n\treturn folders, files, err\n}", "func (ext *ListFolderExt) ListObjectsAsMarkdown(url string) (Resource, error) {\n\n\t// normalize url to directory\n\tswitch n := len(url); {\n\tcase n == 0:\n\t\turl = \"/\"\n\tcase url[n-1] != '/':\n\t\turl = url + \"/\"\n\t}\n\n\tbucketName, prefix := ext.helper.GetBucketNameAndPrefix(url)\n\tif bucketName == \"\" {\n\t\treturn Resource{Msg: fmt.Sprintf(\"GET[%s]: Bucket name not known\", url)}, errors.New(\"Bucket name not known\")\n\t}\n\n\t// Create a done channel to control 'ListObjectsV2' go routine.\n\tdoneCh := make(chan struct{})\n\n\t// Indicate to our routine to exit cleanly upon return.\n\tdefer close(doneCh)\n\n\t// add user provided prefix if any\n\tprefix = ext.helper.Prefix + prefix\n\n\t// list folders inside folder\n\tisRecursive := false\n\tobjectCh := ext.helper.Client.ListObjectsV2(bucketName, prefix, isRecursive, doneCh)\n\tvar items []listingItem\n\tfor info := range objectCh {\n\t\t// get actual filename\n\t\tname := strings.Replace(info.Key, prefix, \"\", 1)\n\n\t\t// in case of errors\n\t\tif len(name) <= 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// filter hidden files\n\t\tif name[0] == '.' {\n\t\t\tcontinue\n\t\t}\n\n\t\t// filter objects don't match glob\n\t\tif info.Size != 0 && !ext.pattern.Match(name) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// dun render 0 bytes\n\t\tvar size string\n\t\tif info.Size == 0 {\n\t\t\tsize = \"\"\n\t\t} else {\n\t\t\tsize = humanize.Bytes(uint64(info.Size))\n\t\t}\n\n\t\t// dun render 0 timestamp\n\t\tvar lastModified string\n\t\tif info.LastModified == (time.Time{}) {\n\t\t\tlastModified = \"\"\n\t\t} else {\n\t\t\tlastModified = humanize.Time(info.LastModified)\n\t\t}\n\n\t\titems = append(items,\n\t\t\tlistingItem{\n\t\t\t\tName: name,\n\t\t\t\tPath: url + name,\n\t\t\t\tSize: size,\n\t\t\t\tLastModified: lastModified})\n\t}\n\n\tvar renderedMarkdown bytes.Buffer\n\terr := ext.listFolderTemplate.Execute(&renderedMarkdown,\n\t\tlisting{\n\t\t\tBucketName: ext.helper.BucketName,\n\t\t\tPrefix: prefix,\n\t\t\tURL: url,\n\t\t\tListingItems: items})\n\tif err != nil {\n\t\treturn Resource{}, err\n\t}\n\n\treturn Resource{\n\t\tMsg: fmt.Sprintf(\"ListObjectsV2[%s/%s] ok\", bucketName, prefix),\n\t\tData: bytes.NewReader(renderedMarkdown.Bytes()),\n\t\tInfo: ResourceInfo{\n\t\t\tSize: int64(len(renderedMarkdown.Bytes())),\n\t\t\tContentType: \"text/markdown\",\n\t\t\tLastModified: time.Now()}}, nil\n}", "func (e *Entry) List(options tree.ListOptions) ([]tree.Entry, error) {\n\tdirfp, err := os.OpenFile(e.fullPath(), unix.O_RDONLY|unix.O_DIRECTORY, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer dirfp.Close()\n\n\t// Read the list of names from the directory.\n\tnameList, err := dirfp.Readdirnames(-1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Strings(nameList)\n\n\t// Fill Entry structs.\n\tentryList := make([]tree.Entry, len(nameList))\n\tfor i, name := range nameList {\n\t\tentry := &Entry{\n\t\t\troot: e.root,\n\t\t\tpath: e.childPath(name),\n\t\t}\n\n\t\tentry.st, err = entry.readStat(dirfp, options.Follow != nil && options.Follow(entry.RelativePath()))\n\t\tif os.IsNotExist(err) || isLoop(err) {\n\t\t\terr = nil\n\t\t\tentry = &Entry{\n\t\t\t\troot: e.root,\n\t\t\t\tpath: e.childPath(name),\n\t\t\t\tnotFound: true,\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tentryList[i] = entry\n\t}\n\n\treturn entryList, nil\n}", "func (s Storage) List(path string) ([]string, error) {\n\tdir, err := s.fullPath(path)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\td, err := os.Open(dir)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tdefer d.Close()\n\n\treturn d.Readdirnames(-1)\n}", "func (a *DefaultClient) List(l vfs.Location) ([]string, error) {\n\tURL, err := url.Parse(l.(*Location).ContainerURL())\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tcontainerURL := azblob.NewContainerURL(*URL, a.pipeline)\n\tctx := context.Background()\n\tvar list []string\n\tfor marker := (azblob.Marker{}); marker.NotDone(); {\n\t\tlistBlob, err := containerURL.ListBlobsHierarchySegment(ctx, marker, \"/\",\n\t\t\tazblob.ListBlobsSegmentOptions{Prefix: utils.RemoveLeadingSlash(l.Path())})\n\t\tif err != nil {\n\t\t\treturn []string{}, err\n\t\t}\n\n\t\tmarker = listBlob.NextMarker\n\n\t\tfor i := range listBlob.Segment.BlobItems {\n\t\t\tlist = append(list, listBlob.Segment.BlobItems[i].Name)\n\t\t}\n\t}\n\treturn list, nil\n}", "func (c *Client) List(path gfs.Path) ([]gfs.PathInfo, error) {\n\tvar reply gfs.ListReply\n\terr := util.Call(c.master, \"Master.RPCList\", gfs.ListArg{path}, &reply)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn reply.Files, nil\n}", "func (rfs *RootFileSystem) ListDirectory(path string) ([]string, error) {\n\t// As a test, simply return the names of things at this path. Later on we'll return a structure that defines names, types and stats\n\n\tdn, _ := rfs.ChangeCache.GetDirectoryNode(rfs.SuperBlock.RootDirectory)\n\n\tvar dnReal *DirectoryNode\n\tvar err error\n\n\tif path == \"/\" {\n\t\tdnReal = dn\n\t} else {\n\t\tparts := strings.Split(path, \"/\")\n\t\tdnReal, err = dn.findDirectoryNode(parts[1:], rfs)\n\t\t// And now get the names of things and add them to \"entries\"\n\t\t// for now, don't do the continuation\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tsize := len(dnReal.Folders) + len(dnReal.Files)\n\tentries := make([]string, size)\n\tpoint := 0\n\tfor name, _ := range dnReal.Folders {\n\t\tentries[point] = name\n\t\tpoint++\n\t}\n\tfor name, _ := range dnReal.Files {\n\t\tentries[point] = name\n\t\tpoint++\n\t}\n\treturn entries, nil\n}", "func (db *DB) List(key string) ([]string, error) {\n\treturn TreeList(db.repo, db.tree, path.Join(db.scope, key))\n}", "func (c *Client) List(prefix string, opts *ListOpts) FileIterator {\n\treturn c.ListWithContext(context.Background(), prefix, opts)\n}", "func (d *driver) List(ctx context.Context, opath string) ([]string, error) {\n\tpath := opath\n\tif path != \"/\" && opath[len(path)-1] != '/' {\n\t\tpath = path + \"/\"\n\t}\n\n\t// This is to cover for the cases when the rootDirectory of the driver is either \"\" or \"/\".\n\t// In those cases, there is no root prefix to replace and we must actually add a \"/\" to all\n\t// results in order to keep them as valid paths as recognized by storagedriver.PathRegexp\n\tprefix := \"\"\n\tif d.obsPath(\"\") == \"\" {\n\t\tprefix = \"/\"\n\t}\n\n\toutput, err := d.Client.ListObjects(&obs.ListObjectsInput{\n\t\tListObjsInput: obs.ListObjsInput{\n\t\t\tPrefix: d.obsPath(path),\n\t\t\tMaxKeys: listMax,\n\t\t\tDelimiter: \"/\",\n\t\t},\n\t\tBucket: d.Bucket,\n\t})\n\tif err != nil {\n\t\treturn nil, parseError(opath, err)\n\t}\n\n\tfiles := []string{}\n\tdirectories := []string{}\n\n\tfor {\n\t\tfor _, key := range output.Contents {\n\t\t\tfiles = append(files, strings.Replace(key.Key, d.obsPath(\"\"), prefix, 1))\n\t\t}\n\n\t\tfor _, commonPrefix := range output.CommonPrefixes {\n// commonPrefix := commonPrefix>Prefix\n\t\t\tdirectories = append(directories, strings.Replace(commonPrefix[0:len(commonPrefix)-1], d.obsPath(\"\"), prefix, 1))\n\t\t}\n\n\t\tif output.IsTruncated {\n\t\t\toutput, err = d.Client.ListObjects(&obs.ListObjectsInput{\n\t\t\t\tListObjsInput: obs.ListObjsInput{\n\t\t\t\t\tPrefix: d.obsPath(path),\n\t\t\t\t\tDelimiter: \"/\",\n\t\t\t\t\tMaxKeys: listMax,\n\t\t\t\t},\n\t\t\t\tBucket: d.Bucket,\n\t\t\t\tMarker: output.NextMarker,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif opath != \"/\" {\n\t\tif len(files) == 0 && len(directories) == 0 {\n\t\t\t// Treat empty output as missing directory, since we don't actually\n\t\t\t// have directories in obs.\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: opath}\n\t\t}\n\t}\n\treturn append(files, directories...), nil\n}", "func (this *RanServer) listDir(w http.ResponseWriter, serveAll bool, c *context) (size int64, err error) {\n\n\tif !c.exist {\n\t\tsize = Error(w, 404)\n\t\treturn\n\t}\n\n\tif !c.isDir {\n\t\terr = fmt.Errorf(\"Cannot list contents of a non-directory\")\n\t\treturn\n\t}\n\n\tf, err := os.Open(c.absFilePath)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\tinfo, err := f.Readdir(0)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Override below if listdirasjson was set\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\n\ttitle := html.EscapeString(path.Base(c.cleanPath))\n\n\tvar files []dirListFiles\n\n\tfor n, i := range info {\n\t\tname := i.Name()\n\t\tif i.IsDir() {\n\t\t\tname += \"/\"\n\t\t}\n\n\t\t// Check if the extension of this file is in the ignore list\n\t\text := filepath.Ext(name)\n\t\tif isStringInCSV(ext, c.ignorefileext) {\n\t\t\tcontinue\n\t\t}\n\n\t\tname = html.EscapeString(name)\n\n\t\t// skip hidden path\n\t\tif !serveAll && strings.HasPrefix(name, \".\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tfileUrl := url.URL{Path: name}\n\n\t\t// write parent dir\n\t\tif n == 0 && c.cleanPath != \"/\" {\n\t\t\tparent := c.parent()\n\n\t\t\t// unescape parent before get it's modification time\n\t\t\tvar parentUnescape string\n\t\t\tparentUnescape, err = url.QueryUnescape(parent)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar info os.FileInfo\n\t\t\tinfo, err = os.Stat(filepath.Join(this.config.Root, parentUnescape))\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfiles = append(files, dirListFiles{Name: \"[..]\", Url: parent, ModTime: info.ModTime(), IsDir: true})\n\t\t}\n\n\t\tfiles = append(files, dirListFiles{Name: name, Url: fileUrl.String(), Size: i.Size(), ModTime: i.ModTime(), IsDir: i.IsDir(), Mode: i.Mode()})\n\t}\n\n\tdata := dirList{Title: title, Files: files}\n\n\tbuf := bufferPool.Get()\n\tdefer bufferPool.Put(buf)\n\n\tif c.listDirAsJSON {\n\t\t// Return entities as JSON structure\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t\tencoded_json, _ := json.Marshal(data)\n\t\tio.WriteString(buf, string(encoded_json))\n\t} else {\n\t\t// Return HTML table\n\t\ttplDirList.Execute(buf, data)\n\t}\n\n\tsize, _ = buf.WriteTo(w)\n\treturn\n}", "func List(g *types.Cmd) {\n\tg.AddOptions(\"list\")\n}", "func (fo *stubFooService) List(ctx context.Context, limit uint64, offset uint64) (res model.FooItemPage, err error) {\n\treturn fo.repo.RetrieveAll(ctx, offset, limit)\n}", "func List(c *gin.Context) {\n\tvar todos []todo\n\n\tdb := Database()\n\tdb.Find(&todos)\n\n\tif len(todos) <= 0 {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": \"Todo Not Found\",\n\t\t})\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"data\": todos,\n\t})\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 (d *KrakenStorageDriver) List(ctx context.Context, path string) ([]string, error) {\n\tlog.Debugf(\"(*KrakenStorageDriver).List %s\", path)\n\tpathType, pathSubType, err := ParsePath(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar l []string\n\tswitch pathType {\n\tcase _uploads:\n\t\tl, err = d.uploads.list(path, pathSubType)\n\tcase _manifests:\n\t\tl, err = d.manifests.list(path)\n\tdefault:\n\t\treturn nil, InvalidRequestError{path}\n\t}\n\tif err != nil {\n\t\treturn nil, toDriverError(err, path)\n\t}\n\treturn l, nil\n}", "func (z *zfsctl) List(ctx context.Context, name, options, max string, oProperties []string, sProperty, SProperty, t string) *execute {\n\targs := []string{\"list\"}\n\tif len(options) > 0 {\n\t\targs = append(args, options)\n\t}\n\tif len(max) > 0 {\n\t\targs = append(args, max)\n\t}\n\tif oProperties != nil {\n\t\to := \"-o \"\n\t\tfor _, p := range oProperties {\n\t\t\to += p + \",\"\n\t\t}\n\t\targs = append(args, strings.TrimSuffix(o, \",\"))\n\t}\n\tif len(sProperty) > 0 {\n\t\targs = append(args, sProperty)\n\t}\n\tif len(SProperty) > 0 {\n\t\targs = append(args, SProperty)\n\t}\n\tif len(t) > 0 {\n\t\targs = append(args, \"-t \"+t)\n\t}\n\tif len(name) > 0 {\n\t\targs = append(args, name)\n\t}\n\treturn &execute{ctx: ctx, name: z.cmd, args: args}\n}", "func ListDir(type_ string, user string) []map[string]string {\n\tuserDir := c.FileStore + \"/\" + glb.MD5Sum(user)\n\tglb.ReplaceRept(&userDir, \"/\")\n\tuserDir = strings.TrimRight(userDir, \"/\")\n\t\n\t//fmt.Println(userDir)\n\tif glb.FileExist(userDir) {\n\t\tos.Remove(userDir)\n\t}\n\tif !glb.DirExist(userDir) {\n\t\tos.MkdirAll(userDir+\"/plain\", 0775)\n\t\tos.MkdirAll(userDir+\"/secret/cache\", 0775)\n\t\tos.MkdirAll(userDir+\"/plain_share\", 0775)\n\t\tos.MkdirAll(userDir+\"/secret_share\", 0775)\n\t}\n\t\n\tvar (\n\t\tfileList []map[string]string\n\t\tdirToRead string\n\t)\n\tswitch type_ {\n\tcase \"plain\":\n\t\tdirToRead = userDir + \"/plain\"\n\t\tlist, _ := ioutil.ReadDir(dirToRead)\n\t\tfor _, file := range list {\n\t\t\tfileList = append(fileList, map[string]string{\n\t\t\t\t\"name\": file.Name(),\n\t\t\t\t\"size\": glb.ComputeSize(file.Size()),\n\t\t\t\t\"date\": file.ModTime().Format(\"2006-01-02 15:04:05\"),\n\t\t\t\t\"link\": \"\",\n\t\t\t})\n\t\t}\n\t\treturn fileList\n\tcase \"plain_share\":\n\t\tdirToRead = userDir + \"/plain_share\"\n\t\tlist, _ := ioutil.ReadDir(dirToRead)\n\t\tfor _, file := range list {\n\t\t\tfileList = append(fileList, map[string]string{\n\t\t\t\t\"name\": file.Name(),\n\t\t\t\t\"size\": glb.ComputeSize(file.Size()),\n\t\t\t\t\"date\": file.ModTime().Format(\"2006-01-02 15:04:05\"),\n\t\t\t\t\"link\": \"\",\n\t\t\t})\n\t\t}\n\t\treturn fileList\n\tcase \"secret\":\n\t\tdirToRead = userDir + \"/secret\"\n\t\tlist, _ := ioutil.ReadDir(dirToRead)\n\t\tfor _, file := range list {\n\t\t\tfileList = append(fileList, map[string]string{\n\t\t\t\t\"name\": file.Name(),\n\t\t\t\t\"size\": glb.ComputeSize(file.Size()),\n\t\t\t\t\"date\": file.ModTime().Format(\"2006-01-02 15:04:05\"),\n\t\t\t\t\"link\": \"\",\n\t\t\t})\n\t\t}\n\t\treturn fileList\n\t\n\tcase \"secret_share\":\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (db *DB) List(glob string) ([]Entry, error) {\n\t// FIXME: first-pass - ignore glob\n\tmappings, err := db.readDB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Extract codes and sort\n\tcodes := make([]string, len(mappings))\n\ti := 0\n\tfor code := range mappings {\n\t\tcodes[i] = code\n\t\ti++\n\t}\n\tsort.Strings(codes)\n\n\t// Compile entries\n\tvar entries = make([]Entry, len(mappings))\n\ti = 0\n\tfor _, code := range codes {\n\t\tentries[i] = Entry{Code: code, Url: mappings[code]}\n\t\ti++\n\t}\n\n\treturn entries, nil\n}", "func (f *firestoreDir) List(ctx context.Context) ([]plugin.Entry, error) {\n\tcolls, err := f.client.Collections(ctx).GetAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn toCollectionEntries(f.client, \"\", colls), nil\n}", "func (h Client) list(namespace string, extraArgs ...string) (string, error) {\n\targs := []string{\"list\", \"--namespace\", namespace}\n\targs = append(args, extraArgs...)\n\tstdOut, stdErr, err := h.Exec(args...)\n\tif err != nil && stdErr != \"\" {\n\t\treturn \"\", errors.New(stdErr)\n\t}\n\treturn stdOut, nil\n}", "func (c orderController) list(ctx *routing.Context) error {\n\tcond := &selection_condition.SelectionCondition{\n\t\tSortOrder: []map[string]string{{\n\t\t\t\"name\": \"asc\",\n\t\t}},\n\t}\n\n\titems, err := c.Service.Query(ctx.Request.Context(), cond)\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\treturn ctx.Write(items)\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 (svc *GCSclient) list(bucketName string, filePrefix string) ([]string, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)\n\tdefer cancel()\n\t// List all objects in a bucket using pagination\n\tvar files []string\n\tit := svc.Bucket(bucketName).Objects(ctx, &storage.Query{Prefix: filePrefix})\n\tfor {\n\t\tobj, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfiles = append(files, obj.Name)\n\t}\n\tsort.Strings(files)\n\treturn files, nil\n}", "func (s Store) ListArticles() ([]string, error) {\n\tdir, err := os.Open(s.basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer dir.Close()\n\treturn dir.Readdirnames(0)\n}", "func (s *Service) List(ctx context.Context, req *api.ListRequest) (*api.ListResults, error) {\n\tvar resp = api.ListResults{Type: req.Type, Request: req}\n\tvar searchRequest *bleve.SearchRequest\n\n\tif _, ok := Index[req.Type]; !ok {\n\t\tresp.Err = api.ErrorInvalidContentType.Error()\n\t\treturn &resp, nil\n\t}\n\n\tquery := bleve.NewMatchAllQuery()\n\tsearchRequest = bleve.NewSearchRequest(query)\n\n\tif req.SortBy == \"\" {\n\t\treq.SortBy = \"id\"\n\t}\n\tsearchRequest.SortBy([]string{req.SortBy})\n\tsearchRequest.Fields = []string{\"*\"}\n\tsearchRequest.Size = req.Size\n\tif searchRequest.Size <= 0 {\n\t\tsearchRequest.Size = 10\n\t}\n\tsearchRequest.From = req.Skip\n\n\tindex, err := getIndex(req.Type, req.Language)\n\tif err != nil {\n\t\tresp.Err = api.ErrorNotFound.Error()\n\t\treturn &resp, nil\n\t}\n\tsearchResult, err := index.Search(searchRequest)\n\tif err != nil {\n\t\tresp.Err = api.ErrorNotFound.Error()\n\t\treturn &resp, nil\n\t}\n\n\tresp.Total = searchResult.Total\n\n\tfor _, hit := range searchResult.Hits {\n\t\tresp.List = append(resp.List, hit.Fields)\n\t}\n\n\treturn &resp, nil\n}", "func (v SongsResource) 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\tsongs := &models.Songs{}\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 Songs from the DB\n\tif err := q.All(songs); 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, songs))\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 TestList(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\t// Prepare a siadirset\n\troot := filepath.Join(testDir(t.Name()), \"fs-root\")\n\tos.RemoveAll(root)\n\tfs := newTestFileSystem(root)\n\n\t// Specify a directory structure for this test.\n\tvar dirStructure = []string{\n\t\t\"dir1\",\n\t\t\"dir1/subdir1\",\n\t\t\"dir1/subdir1/subsubdir1\",\n\t\t\"dir1/subdir1/subsubdir2\",\n\t\t\"dir1/subdir1/subsubdir3\",\n\t\t\"dir1/subdir2\",\n\t\t\"dir1/subdir2/subsubdir1\",\n\t\t\"dir1/subdir2/subsubdir2\",\n\t\t\"dir1/subdir2/subsubdir3\",\n\t\t\"dir1/subdir3\",\n\t\t\"dir1/subdir3/subsubdir1\",\n\t\t\"dir1/subdir3/subsubdir2\",\n\t\t\"dir1/subdir3/subsubdir3\",\n\t}\n\n\t// Create filesystem\n\tfor _, d := range dirStructure {\n\t\t// Create directory\n\t\tsiaPath := newSiaPath(d)\n\t\terr := fs.NewSiaDir(siaPath, persist.DefaultDiskPermissionsTest)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\t// Add a file\n\t\tfileSiaPath, err := siaPath.Join(\"file\")\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tfs.addTestSiaFile(fileSiaPath)\n\t}\n\n\t// Get the cached information\n\tfis, dis, err := fs.CachedListCollect(newSiaPath(dirStructure[0]), true)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(fis) != len(dirStructure) {\n\t\tt.Fatal(\"wrong number of files\", len(fis), len(dirStructure))\n\t}\n\tif len(dis) != len(dirStructure) {\n\t\tt.Fatal(\"wrong number of dirs\", len(dis), len(dirStructure))\n\t}\n}", "func (m *MockFinder) List() [][]byte {\n\treturn m.fnd.List()\n}", "func ListingDirectory(ctx Ctx, folder string) ([]*FileInfo, error) {\n\tfullPath := path.Join(ctx.GetRoot(), folder)\n\tvar files []*FileInfo\n\tf, err := os.Open(fullPath)\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist, err := f.Readdir(-1)\n\tfor _, i := range list {\n\n\t\titem := &FileInfo{\n\t\t\tName: i.Name(),\n\t\t\tSize: i.Size(),\n\t\t\tExtension: filepath.Ext(i.Name()),\n\t\t\tModTime: i.ModTime(),\n\t\t\tIsDir: i.IsDir(),\n\t\t\tPath: folder,\n\t\t}\n\t\tfiles = append(files, item)\n\n\t}\n\treturn files, nil\n\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 list(db *sql.DB) ([]Todo, error) {\n\treturn read(db, -1)\n}", "func (g *Goods) List(c Context) {\n\t// TODO\n\tc.String(http.StatusOK, \"get goods list\")\n}", "func (zk *dbZk) List(path string) ([]string, error) {\n\tb, _ := zk.ZkCli.Exist(path)\n\tif !b {\n\t\treturn nil, nil\n\t}\n\n\tvar failed bool\n\tstarted := time.Now()\n\n\tchilds, err := zk.ZkCli.GetChildren(path)\n\tif err != nil {\n\t\tfailed = true\n\t}\n\n\tstore.ReportStorageOperatorMetrics(store.StoreOperatorFetch, started, failed)\n\treturn childs, err\n}", "func list_arches(w rest.ResponseWriter, r *rest.Request) {\n\t// Use caching to reduce calls to the Dropbox API\n\tcache_path := \"arches\"\n\tdata, found := cache_instance.Get(cache_path)\n\tif found {\n\t\tif cached, ok := data.([]string); ok {\n\t\t\tw.WriteJson(cached)\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.Println(\"Error: Unable to retrieve from cache\")\n\t\t}\n\t}\n\n\tarches := []string{}\n\tdirectories := get_directories(cache_instance, db, \"/\")\n\tfor _, arch := range directories {\n\t\tarches = append(arches, strings.Replace(arch.Path, \"/\", \"\", -1))\n\t}\n\tcache_instance.Set(cache_path, arches, 0)\n\tw.WriteJson(arches)\n}", "func (t *FakeObjectTracker) List(gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, ns string) (runtime.Object, error) {\n\tif t.fakingOptions.failAll != nil {\n\t\terr := t.fakingOptions.failAll.RunFakeInvocations()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn t.delegatee.List(gvr, gvk, ns)\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 (h *Handler) list() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tentities, err := h.UserDAO.FetchAll(r.Context())\n\t\tswitch {\n\t\tcase errors.Is(err, errorx.ErrNoUser):\n\t\t\tmsg := &errorMessage{\n\t\t\t\tMessage: fmt.Sprintf(\"no users exist\"),\n\t\t\t}\n\t\t\tresponse.JSON(w, http.StatusNotFound, msg)\n\t\t\treturn\n\t\tcase err != nil:\n\t\t\tmsg := &errorMessage{\n\t\t\t\tError: err.Error(),\n\t\t\t\tMessage: \"user datastore error\",\n\t\t\t}\n\t\t\tresponse.JSON(w, http.StatusInternalServerError, msg)\n\t\t\treturn\n\t\tdefault:\n\t\t\tresponse.JSON(w, http.StatusOK, entities)\n\t\t}\n\t}\n}", "func (a DBFSAPI) List(path string, recursive bool) ([]model.DBFSFileInfo, error) {\n\tif recursive {\n\t\tvar paths []model.DBFSFileInfo\n\t\terr := a.recursiveAddPaths(path, &paths)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn paths, err\n\t}\n\treturn a.list(path)\n}", "func (c *ImageController) List(ctx *app.ListImageContext) error {\n\t// ImageController_List: start_implement\n\n\t// Put your logic here\n\n\t// ImageController_List: end_implement\n\tres := app.ImageCollection{}\n\treturn ctx.OK(res)\n}", "func (crud *CrudStoreClient) List(result interface{}) error {\n\t_, err := crud.ListWithPagination(result, \"\", 0)\n\treturn err\n}", "func (u *App) List(c echo.Context, p *model.Pagination) ([]model.File, string, string, int64, int64, error) {\n\tau := u.rbac.User(c)\n\tq, err := query.List(au, model.ResourceFile)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", 0, 0, err\n\t}\n\n\treturn u.udb.List(u.db, q, p)\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 (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 (c *Client) List(page int, limit int) (List, error) {\n\tURL := c.url\n\tif page != 0 || limit != 0 {\n\t\tif page != 0 {\n\t\t\tURL.RawQuery = url.QueryEscape(strconv.Itoa(page))\n\t\t}\n\t\tif limit != 0 {\n\t\t\tURL.RawQuery = url.QueryEscape(strconv.Itoa(limit))\n\t\t}\n\t}\n\tres, err := c.get(c.url.String())\n\tif err != nil {\n\t\treturn List{}, err\n\t}\n\tlist := List{}\n\terr = json.Unmarshal(res, &list)\n\treturn list, err\n}", "func (controller *LinkController) List(w http.ResponseWriter, r *http.Request) {\n\topts := options.NewOptionsFromContext(r.Context())\n\tuser, _ := models.NewUserFromContext(r.Context())\n\n\tlinks, err := controller.linkRepository.FindAllByUserWithContext(r.Context(), *user, *opts)\n\n\tif err != nil {\n\t\tutils.RespondWithError(&w, http.StatusBadRequest, models.NewError(\"Id is not provided\"))\n\t\treturn\n\t}\n\n\tutils.RespondWithJSON(&w, http.StatusOK, links)\n}" ]
[ "0.64790565", "0.64580345", "0.6365296", "0.6312116", "0.6310774", "0.625049", "0.62205535", "0.61772364", "0.6176329", "0.61612606", "0.6157272", "0.6146246", "0.6144315", "0.6109358", "0.6099333", "0.6089955", "0.6079026", "0.607171", "0.6060557", "0.6041071", "0.6028603", "0.60242575", "0.6005124", "0.5989352", "0.5982823", "0.5969552", "0.5948907", "0.5936009", "0.59333235", "0.59275216", "0.59054404", "0.588808", "0.58814675", "0.5870703", "0.5799635", "0.5799143", "0.5790435", "0.5776447", "0.5738886", "0.57375586", "0.57218254", "0.5720608", "0.5719444", "0.57117295", "0.57094103", "0.5699264", "0.56971073", "0.569611", "0.5683739", "0.5676225", "0.567525", "0.56622154", "0.56585336", "0.5645197", "0.5630706", "0.5629195", "0.5620862", "0.5620285", "0.5609634", "0.5605366", "0.5600618", "0.5596594", "0.5579732", "0.5574877", "0.5570968", "0.55599064", "0.5555344", "0.5555108", "0.5554703", "0.55546504", "0.5523718", "0.55202824", "0.55086684", "0.55062914", "0.5506258", "0.5499843", "0.5482657", "0.5482308", "0.54766047", "0.54669493", "0.54666275", "0.5465725", "0.5454517", "0.5452823", "0.54478514", "0.54461527", "0.5444765", "0.5443392", "0.5441833", "0.54378355", "0.5429443", "0.5427315", "0.5424885", "0.54197663", "0.54117936", "0.54034793", "0.5403452", "0.5401838", "0.54010594", "0.53951013" ]
0.67182887
0
BeforeNow checks a mm/dd/yyyy string to determine if it is before now.
func BeforeNow(d string) bool { f := strings.FieldsFunc(d, func(r rune) bool { return r == '/' }) t := time.Date(atoi(f[2]), time.Month(atoi(f[0])), atoi(f[1]), 0, 0, 0, 0, time.UTC) return t.Before(time.Now()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ISODateStringBeforeToday(datetime string) (bool, error) {\n\tdate, err := IsoDateFormatter(datetime)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\ttoday := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, date.Location())\n\tif date.Before(today) {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "func (t UnixTime) Before(t2 UnixTime) bool {\n\treturn time.Time(t).Before(time.Time(t2))\n}", "func (d Date) Before(d2 Date) bool {\n\tif d.Year != d2.Year {\n\t\treturn d.Year < d2.Year\n\t}\n\tif d.Month != d2.Month {\n\t\treturn d.Month < d2.Month\n\t}\n\treturn d.Day < d2.Day\n}", "func (h *ValidationHelper) Before(t time.Time) bool {\n\treturn h.now().Before(t.Add(-h.leeway))\n}", "func ExampleTime_Before() {\n\tgt1 := gtime.New(\"2018-08-07\")\n\tgt2 := gtime.New(\"2018-08-08\")\n\n\tfmt.Println(gt1.Before(gt2))\n\n\t// Output:\n\t// true\n}", "func (d Date) Before(t Date) bool {\n\treturn t.After(d)\n}", "func (dt DateTime) Before(u DateTime) bool {\n\n\treturn dt.src.Before(u.src)\n}", "func TestBackupBefore(t *testing.T) {\n\tb := backup{t: time.Unix(2, 0)}\n\tif b.before(time.Unix(1, 0)) {\n\t\tt.Errorf(\"b.before(time.Unix(1, 0)) returns false\")\n\t}\n\n\tif b.before(time.Unix(2, 0)) {\n\t\tt.Errorf(\"b.before(time.Unix(2, 0)) returns false\")\n\t}\n}", "func ShouldHappenBefore(actual interface{}, expected ...interface{}) string {\n\tif fail := need(1, expected); fail != success {\n\t\treturn fail\n\t}\n\tactualTime, firstOk := actual.(time.Time)\n\texpectedTime, secondOk := expected[0].(time.Time)\n\n\tif !firstOk || !secondOk {\n\t\treturn shouldUseTimes\n\t}\n\n\tif !actualTime.Before(expectedTime) {\n\t\treturn fmt.Sprintf(shouldHaveHappenedBefore, actualTime, expectedTime, actualTime.Sub(expectedTime))\n\t}\n\n\treturn success\n}", "func TimestampBefore(ts *tspb.Timestamp, uts *tspb.Timestamp) bool {\n\treturn ts.GetSeconds() < uts.GetSeconds() || ts.GetSeconds() == uts.GetSeconds() && ts.GetNanos() < uts.GetNanos()\n}", "func (t Timestamp) Before(u Timestamp) bool {\n\treturn time.Time(t).Before(time.Time(u))\n}", "func IsDateBeforeUTCToday(requestedDate time.Time) (isBefore bool) {\n\tlocation, err := time.LoadLocation(\"UTC\")\n\tif err != nil {\n\t\treturn true\n\t}\n\tutcDate := time.Now().In(location)\n\t// Can't do the direct time comparison (time.Before() time.After())\n\t// because the actual timestamp doesn't matter, just the year/month/day\n\tisBeforeUTC := requestedDate.Year() <= utcDate.Year() && requestedDate.Month() <= utcDate.Month() && requestedDate.Day() < utcDate.Day()\n\ttoLog(\"IsDateBeforeUTCToday\", \"Requested: \"+requestedDate.Format(time.RFC822)+\", UTC Date: \"+utcDate.Format(time.RFC822)+\" -> BEFORE: \"+strconv.FormatBool(isBeforeUTC))\n\treturn isBeforeUTC\n}", "func (t *timeDataType) Before(after time.Time) *timeDataType {\n\treturn t.Validate(func(t time.Time) error {\n\t\tif t.Before(after) {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"time was not before %s\", after.Format(time.RFC3339))\n\t})\n}", "func (m *dateBefore) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (o BucketLifecycleRuleConditionOutput) CreatedBefore() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleCondition) *string { return v.CreatedBefore }).(pulumi.StringPtrOutput)\n}", "func CheckDateBeforeOrEqual(dateFrom string, dateTo string, layoutFormatDate string) bool {\n\tdateFromTime, _ := time.Parse(layoutFormatDate, dateFrom)\n\tdateToTime, _ := time.Parse(layoutFormatDate, dateTo)\n\n\tif dateFromTime.Before(dateToTime) || dateFromTime.Equal(dateToTime) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o BucketLifecycleRuleItemConditionPtrOutput) CreatedBefore() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleRuleItemCondition) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CreatedBefore\n\t}).(pulumi.StringPtrOutput)\n}", "func (o BucketLifecycleRuleItemConditionOutput) CreatedBefore() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleItemCondition) *string { return v.CreatedBefore }).(pulumi.StringPtrOutput)\n}", "func (o BucketLifecycleRuleItemConditionResponseOutput) CreatedBefore() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleItemConditionResponse) string { return v.CreatedBefore }).(pulumi.StringOutput)\n}", "func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) string {\n\tif fail := need(1, expected); fail != success {\n\t\treturn fail\n\t}\n\tactualTime, firstOk := actual.(time.Time)\n\texpectedTime, secondOk := expected[0].(time.Time)\n\n\tif !firstOk || !secondOk {\n\t\treturn shouldUseTimes\n\t}\n\n\tif actualTime.Equal(expectedTime) {\n\t\treturn success\n\t}\n\treturn ShouldHappenBefore(actualTime, expectedTime)\n}", "func Before(t time.Time) manifest.Filter {\n\treturn func(r *manifest.Resource) bool {\n\t\treturn r.Time.Before(t)\n\t}\n}", "func (o *FiltersApiLog) GetQueryDateBeforeOk() (string, bool) {\n\tif o == nil || o.QueryDateBefore == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.QueryDateBefore, true\n}", "func BusinessDaysBefore(t time.Time, bds int) time.Time {\n\treturn travelBusinessDays(t, bds, false)\n}", "func (m *dateBefore) DateBefore() float64 {\n\treturn m.dateBeforeField\n}", "func dateLessThan(t1 time.Time, t2 time.Time) bool {\n\td1 := time.Date(t1.Year(), t1.Month(), t1.Day(), 0, 0, 0, 0, t1.Location())\n\td2 := time.Date(t2.Year(), t2.Month(), t2.Day(), 0, 0, 0, 0, t2.Location())\n\treturn d1.Unix() < d2.Unix()\n}", "func currentDateEarlierThenOldDate(currentDate string, oldDate string) (bool, error) {\n\tconst shortDate = \"2006-01-02\"\n\tparsedCurrentDate, err := time.Parse(shortDate, currentDate)\n\tif err != nil {\n\t\treturn true, err // Defaults to true so entries in IoDevice Map are not changed\n\t}\n\tparsedOldDate, err := time.Parse(shortDate, oldDate)\n\tif err != nil {\n\t\treturn true, err // Defaults to true so entries in IoDevice Map are not changed\n\t}\n\n\tif parsedCurrentDate.After(parsedOldDate) {\n\t\treturn false, err\n\t}\n\treturn true, err\n}", "func (o BucketLifecycleRuleConditionOutput) NoncurrentTimeBefore() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleCondition) *string { return v.NoncurrentTimeBefore }).(pulumi.StringPtrOutput)\n}", "func (p PartitionRange) SinceBefore(clock PartitionClock) bool {\n\tfor vbNo, seqRange := range p.seqRanges {\n\t\tif seqRange.Since < clock.GetSequence(vbNo) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (v VectorClock) Before(o VectorClock) bool {\n\treturn v.compareTo(o) < 0\n}", "func (o BucketLifecycleRuleItemConditionPtrOutput) NoncurrentTimeBefore() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleRuleItemCondition) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.NoncurrentTimeBefore\n\t}).(pulumi.StringPtrOutput)\n}", "func (o BucketLifecycleRuleItemConditionOutput) NoncurrentTimeBefore() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleItemCondition) *string { return v.NoncurrentTimeBefore }).(pulumi.StringPtrOutput)\n}", "func GetQueryBeforeSince(ctx *context.APIContext) (before, since int64, err error) {\n\tqCreatedBefore, err := prepareQueryArg(ctx, \"before\")\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\n\tqCreatedSince, err := prepareQueryArg(ctx, \"since\")\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\n\tbefore, err = parseTime(qCreatedBefore)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\n\tsince, err = parseTime(qCreatedSince)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\treturn before, since, nil\n}", "func (o *CalendareventsIdJsonEventReminders) SetBefore(v string) {\n\to.Before = &v\n}", "func (s *ListContextsInput) SetCreatedBefore(v time.Time) *ListContextsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (t TimeValue) IsBefore(expected interface{}) bool {\n\treturn t.isBefore(NewTimeValue(expected))\n}", "func CreatedAtLT(v time.Time) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldLT(FieldCreatedAt, v))\n}", "func (o BucketLifecycleRuleItemConditionResponseOutput) NoncurrentTimeBefore() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleItemConditionResponse) string { return v.NoncurrentTimeBefore }).(pulumi.StringOutput)\n}", "func (m *dateBefore) SetDateBefore(val float64) {\n\tm.dateBeforeField = val\n}", "func (o *CalendareventsIdJsonEventReminders) GetBeforeOk() (*string, bool) {\n\tif o == nil || o.Before == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Before, true\n}", "func (s *DatastoreFilter) SetCreatedBefore(v time.Time) *DatastoreFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (current GoVersion) Before(target GoVersion) bool {\n\treturn current.compare(target) == -1\n}", "func (s *ListPipelinesInput) SetCreatedBefore(v time.Time) *ListPipelinesInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ReferenceStoreFilter) SetCreatedBefore(v time.Time) *ReferenceStoreFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func CreatedAtLT(v time.Time) predicate.Agent {\n\treturn predicate.Agent(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func CreatedAtLT(v time.Time) predicate.Step {\n\treturn predicate.Step(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func CreatedAtLT(v time.Time) predicate.Ethnicity {\n\treturn predicate.Ethnicity(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func (s *SequenceStoreFilter) SetCreatedBefore(v time.Time) *SequenceStoreFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func CreatedAtLT(v time.Time) predicate.MetaSchema {\n\treturn predicate.MetaSchema(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t},\n\t)\n}", "func Date(s string) bool { return validateDate(s) }", "func (s *QueryFilters) SetCreatedBefore(v time.Time) *QueryFilters {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ListTrialComponentsInput) SetCreatedBefore(v time.Time) *ListTrialComponentsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ReferenceFilter) SetCreatedBefore(v time.Time) *ReferenceFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ReadSetUploadPartListFilter) SetCreatedBefore(v time.Time) *ReadSetUploadPartListFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func CreatedAtLT(v time.Time) predicate.Block {\n\treturn predicate.Block(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func (s *ListArtifactsInput) SetCreatedBefore(v time.Time) *ListArtifactsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (g *GitLocal) GetRevisionBeforeDate(dir string, t time.Time) (string, error) {\n\treturn g.GitCLI.GetRevisionBeforeDate(dir, t)\n}", "func (s *ListLineageGroupsInput) SetCreatedBefore(v time.Time) *ListLineageGroupsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func CreatedAtLT(v time.Time) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func (s *ImportReferenceFilter) SetCreatedBefore(v time.Time) *ImportReferenceFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func CreatedAtLT(v time.Time) predicate.K8sEvent {\n\treturn predicate.K8sEvent(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func (s *ListExperimentsInput) SetCreatedBefore(v time.Time) *ListExperimentsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ListAssociationsInput) SetCreatedBefore(v time.Time) *ListAssociationsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ListPipelineExecutionsInput) SetCreatedBefore(v time.Time) *ListPipelineExecutionsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ActivateReadSetFilter) SetCreatedBefore(v time.Time) *ActivateReadSetFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ListTrialsInput) SetCreatedBefore(v time.Time) *ListTrialsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func CreatedAtLT(v time.Time) predicate.GameServer {\n\treturn predicate.GameServer(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func CreatedAtLT(v time.Time) predicate.OrderItem {\n\treturn predicate.OrderItem(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func CreatedAtLT(v time.Time) predicate.Job {\n\treturn predicate.Job(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func (o *FiltersApiLog) GetQueryDateBefore() string {\n\tif o == nil || o.QueryDateBefore == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.QueryDateBefore\n}", "func (s *ListActionsInput) SetCreatedBefore(v time.Time) *ListActionsInput {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ReadSetFilter) SetCreatedBefore(v time.Time) *ReadSetFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func (s *ImportReadSetFilter) SetCreatedBefore(v time.Time) *ImportReadSetFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func TestNowf(t *testing.T) {\n\tyear := strconv.Itoa(time.Now().Year())\n\ttestee := &Time{}\n\tif testee.Nowf(\"2006\") != year {\n\t\tt.Error(\"Failed: something wrong with getting time \")\n\t}\n}", "func (o *AdminSearchUsersV2Params) SetBefore(before *string) {\n\to.Before = before\n}", "func CompareOneHourBefore(lastSearch time.Time) bool {\n\ttoday := time.Now()\n\tcomparator := lastSearch.Add(1 * time.Hour)\n\tif today.Before(comparator) {\n\t\treturn false\n\t} else {\n\t\treturn true\n\t}\n}", "func (skeleton *Skeleton) BeforeCreate() error {\n\ttimeNow := time.Now().UTC().Format(time.RFC3339)\n\tformattedTime, err := time.Parse(time.RFC3339, timeNow)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to parse time. %v\", err)\n\t}\n\tskeleton.UpdatedAt = &formattedTime\n\tskeleton.CreatedAt = &formattedTime\n\treturn nil\n}", "func CreatedAtLT(v time.Time) predicate.Permission {\n\treturn predicate.Permission(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func (h *ValidationHelper) ValidateNotBefore(nbf *Time) error {\n\t// 'nbf' claim is not set. ignore.\n\tif nbf == nil {\n\t\treturn nil\n\t}\n\n\t// Nbf hasn't been reached\n\tif h.Before(nbf.Time) {\n\t\tdelta := nbf.Time.Sub(h.now())\n\t\treturn &TokenNotValidYetError{At: h.now(), EarlyBy: delta}\n\t}\n\t// Nbf has been reached. valid.\n\treturn nil\n}", "func IsLessThan(timeLeft time.Time, timeRight time.Time) bool {\n\tdurDelta := timeLeft.Sub(timeRight)\n\tif durZero, _ := time.ParseDuration(\"0ns\"); durDelta < durZero {\n\t\treturn true\n\t}\n\treturn false\n}", "func IsDate(srcDate string) bool {\n\t_, err := strutil.ToTime(srcDate)\n\treturn err == nil\n}", "func (me TxsdPostOfficeSequenceChoicePostOfficeNumberIndicatorOccurrence) IsBefore() bool {\r\n\treturn me == \"Before\"\r\n}", "func CreatedAtLT(v time.Time) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func CreatedAtLT(v time.Time) predicate.OrderLineItem {\n\treturn predicate.OrderLineItem(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func (s *ExportReadSetFilter) SetCreatedBefore(v time.Time) *ExportReadSetFilter {\n\ts.CreatedBefore = &v\n\treturn s\n}", "func NowDate() time.Time {\n\treturn ExtractDateFromDatetime(time.Now())\n}", "func doFindOlder(createTime time.Time, pattern string) bool {\n\ti, err := TimeHelper(pattern)\n\tnow := time.Now()\n\tfatalIf(probe.NewError(err), \"Error parsing string passed to flag older\")\n\n\t//find all time in which the time in which the object was just created is after the current time\n\tt := time.Date(now.Year(), now.Month(), now.Day()-i, now.Hour(), now.Minute(), 0, 0, time.UTC)\n\treturn createTime.Before(t)\n}", "func (o *CalendareventsIdJsonEventReminders) GetBefore() string {\n\tif o == nil || o.Before == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Before\n}", "func (g *GitLocal) GetRevisionBeforeDateText(dir string, dateText string) (string, error) {\n\treturn g.GitCLI.GetRevisionBeforeDateText(dir, dateText)\n}", "func DatetimeLT(v time.Time) predicate.CarRepairrecord {\n\treturn predicate.CarRepairrecord(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDatetime), v))\n\t})\n}", "func ValidateDateStr(str string) bool {\n\tvar re = regexp.MustCompile(`^\\d{4}[\\-\\/\\s]?((((0[13578])|(1[02]))[\\-\\/\\s]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\\-\\/\\s]?(([0-2][0-9])|(30)))|(02[\\-\\/\\s]?[0-2][0-9]))$`)\n\tif len(re.FindStringIndex(str)) > 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func (qs SysDBQuerySet) CreatedAtLt(createdAt time.Time) SysDBQuerySet {\n\treturn qs.w(qs.db.Where(\"created_at < ?\", createdAt))\n}", "func CreatedAtLT(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func CreatedAtLT(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCreatedAt), v))\n\t})\n}", "func TestInitialDateTimeChecks4(t *testing.T) {\n\n\texpected := true\n\n\tcurrDate := time.Now().Add(24 * time.Hour).Format(\"2006-01-02\")\n\tactual, _ := restaurantBooking.InitialDateTimeChecks(currDate, \"15:00\")\n\n\tif actual != expected {\n\t\tt.Fail()\n\t}\n\n}", "func (o *DataExportQuery) SetCreatedBefore(v int32) {\n\to.CreatedBefore = &v\n}", "func CheckDateBoundariesStr(startdate, enddate string) bool {\n\n\tlayout := \"2006-01-02T15:04:05.000Z\"\n\n\ttstart, err := time.Parse(layout, startdate)\n\tif err != nil {\n\t\treturn false //, fmt.Errorf(\"cannot parse startdate: %v\", err)\n\t}\n\ttend, err := time.Parse(layout, enddate)\n\tif err != nil {\n\t\treturn false //, fmt.Errorf(\"cannot parse enddate: %v\", err)\n\t}\n\n\tif tstart.Before(tend) {\n\t\treturn false //, fmt.Errorf(\"startdate < enddate - please set proper data boundaries\")\n\t}\n\treturn true //, err\n}", "func (i Interval) Before(o *Interval) bool {\n\treturn i.Start < o.Start\n}", "func HasPassed(date string) bool {\n\tlayout := \"January 2, 2006 15:04:05\"\n\treturn time.Now().After(ConvertToTime(layout, date))\n}", "func (util *TimeUtil) NowDate() string {\n\treturn time.Now().Format(\"2006-01-02\")\n}", "func (w *Wrapper) Now(formats ...string) function {\n\tquery := \"NOW() \"\n\tunitMap := map[string]string{\n\t\t\"Y\": \"YEAR\",\n\t\t\"M\": \"MONTH\",\n\t\t\"D\": \"DAY\",\n\t\t\"W\": \"WEEK\",\n\t\t\"h\": \"HOUR\",\n\t\t\"m\": \"MINUTE\",\n\t\t\"s\": \"SECOND\",\n\t}\n\tfor _, v := range formats {\n\t\toperator := string(v[0])\n\t\tinterval := v[1 : len(v)-1]\n\t\tunit := string(v[len(v)-1])\n\t\tquery += fmt.Sprintf(\"%s INTERVAL %s %s \", operator, interval, unitMap[unit])\n\t}\n\treturn w.Func(strings.TrimSpace(query))\n}" ]
[ "0.6379344", "0.5772175", "0.57539195", "0.5719056", "0.5665737", "0.5650461", "0.5630643", "0.5603314", "0.55422056", "0.55358124", "0.55042726", "0.5495403", "0.54829955", "0.5410564", "0.5358622", "0.53530425", "0.53356326", "0.53226084", "0.526414", "0.5255999", "0.5244797", "0.5238911", "0.5232905", "0.5213636", "0.51849914", "0.5150107", "0.5088221", "0.5055265", "0.5018673", "0.500169", "0.50010645", "0.4996675", "0.4983924", "0.4942143", "0.49362773", "0.49337888", "0.49149498", "0.4884484", "0.48430595", "0.48338607", "0.48262632", "0.4820645", "0.48155162", "0.48063895", "0.47976267", "0.47810507", "0.47740456", "0.47726157", "0.47667736", "0.47640362", "0.47609448", "0.47572744", "0.47495204", "0.47468475", "0.47437045", "0.47430888", "0.47424245", "0.47406656", "0.47341734", "0.47336298", "0.47235835", "0.47152847", "0.47116768", "0.47042042", "0.47037685", "0.47027776", "0.47007856", "0.46905598", "0.4689768", "0.46800286", "0.46795583", "0.46718872", "0.46711093", "0.46541044", "0.46405926", "0.46322125", "0.46319464", "0.46311033", "0.46223488", "0.46180877", "0.4617995", "0.46160024", "0.46157092", "0.45678845", "0.45550528", "0.4547182", "0.45086667", "0.4504967", "0.44985864", "0.4497661", "0.4469566", "0.44634157", "0.44634157", "0.44613957", "0.44443667", "0.44361067", "0.4435609", "0.44307914", "0.44198963", "0.44143122" ]
0.83958715
0
////////////////////////////////////////////////////////////////////////////////// // IsAttachment return true if content is attachment
func (c *Content) IsAttachment() bool { return c.Type == CONTENT_TYPE_ATTACHMENT }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Part) IsAttachment() bool {\n\tif p.gmimePart == nil {\n\t\treturn false\n\t}\n\tif !gobool(C.gmime_is_part(p.gmimePart)) || gobool(C.gmime_is_multi_part(p.gmimePart)) {\n\t\treturn false\n\t}\n\tif gobool(C.g_mime_part_is_attachment((*C.GMimePart)(unsafe.Pointer(p.gmimePart)))) {\n\t\treturn true\n\t}\n\tif len(p.Filename()) > 0 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *Store) IsAttachment(clientID, psychologistID string) (bool, error) {\n\n\tif strings.TrimSpace(clientID) == \"\" {\n\t\treturn false, errors.New(\"clientID is empty\")\n\t}\n\n\tif strings.TrimSpace(psychologistID) == \"\" {\n\t\treturn false, errors.New(\"psychologistID is empty\")\n\t}\n\n\tvar count int64\n\n\terr := s.db.SQL.Get(&count, `\n\tselect count(c.id) from clients c\n\t where c.client_public_id = $1 and c.psychologist_public_id = $2`, clientID, psychologistID)\n\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"an error occurred while check attachment client from psychologist\")\n\t}\n\n\tif count <= 0 {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "func isAttachmentDownload(ctx *macaron.Context) bool {\n\treturn strings.HasPrefix(ctx.Req.URL.Path, \"/attachments/\") && ctx.Req.Method == \"GET\"\n}", "func (message *Message) HasAttachments() bool {\n\treturn message.GetInteger(3591) & 0x10 != 0\n}", "func (e *Entry) HasAttachment() bool {\n\treturn e.Attachment.Name != \"\"\n}", "func (attachStatus *AttachmentStatus) ShouldSend() bool {\n\treturn *attachStatus == AttachmentAttached\n}", "func (me TxsdImpactSimpleContentExtensionType) IsFile() bool { return me.String() == \"file\" }", "func (m *SendDocument) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func (m *SendVoice) IsMultipart() bool {\n\treturn m.File != nil\n}", "func (m *EditMessageMedia) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func (m *SendAnimation) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func (m *SendVideoNote) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func (r *AttachmentOriginal) HasAttachmentID() bool {\n\treturn r.hasAttachmentID\n}", "func (o *Post) HasAttachments() bool {\n\tif o != nil && o.Attachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *SendPhoto) IsMultipart() bool {\n\treturn m.File != nil\n}", "func (m *SendAudio) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func (r *AttachmentOriginal) HasDownload() bool {\n\treturn r.hasDownload\n}", "func (r *AttachmentPreview) HasAttachmentID() bool {\n\treturn r.hasAttachmentID\n}", "func (o *TaskRequest) HasAttachments() bool {\n\tif o != nil && o.Attachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CfnElasticLoadBalancerAttachment_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_opsworks.CfnElasticLoadBalancerAttachment\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (o *InlineResponse20049Post) HasAttachments() bool {\n\tif o != nil && o.Attachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdNodeRoleSimpleContentExtensionCategory) IsFile() bool { return me.String() == \"file\" }", "func (m *SendMediaGroup) IsMultipart() bool {\n\treturn false\n}", "func (me TxsdMimeTypeSequenceType) IsImage() bool { return me.String() == \"image\" }", "func (m *SendVideo) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func (o *InlineResponse200115) HasAttachments() bool {\n\tif o != nil && o.Attachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CfnElasticLoadBalancerAttachment_IsCfnElement(x interface{}) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_opsworks.CfnElasticLoadBalancerAttachment\",\n\t\t\"isCfnElement\",\n\t\t[]interface{}{x},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (mgr *WatchController) isReconcileAttachments(\n\twatch *unstructured.Unstructured,\n\tsyncRequest *SyncHookRequest,\n\tsyncResponse *SyncHookResponse,\n) bool {\n\tif watch.GetDeletionTimestamp() == nil || // condition 1\n\t\tmgr.finalizer.ShouldFinalize(watch) || // condition 2\n\t\t(watch.GetDeletionTimestamp() != nil && // condition 3\n\t\t\tsyncRequest.Finalizing &&\n\t\t\t!syncResponse.Finalized) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (c *Content) IsDraft() bool {\n\treturn c.Status == CONTENT_STATUS_DRAFT\n}", "func (me TxsdRecordPatternSimpleContentExtensionType) IsBinary() bool { return me.String() == \"binary\" }", "func (me TxsdCounterSimpleContentExtensionType) IsFlow() bool { return me.String() == \"flow\" }", "func (me TxsdAddressSimpleContentExtensionCategory) IsEMail() bool { return me.String() == \"e-mail\" }", "func (me TxsdImpactSimpleContentExtensionType) IsExtortion() bool { return me.String() == \"extortion\" }", "func (b *Blob) IsForeignLayer() bool {\n\treturn b.ContentType == schema2.MediaTypeForeignLayer\n}", "func (m *AttachmentItem) GetIsInline()(*bool) {\n return m.isInline\n}", "func IsBinaryContentType(contentType string) bool {\n\treturn isContentType(contentType, \"application/octet-stream\")\n}", "func (m *ContentAttachment) ContentAttachment() *table.ContentAttachment {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\treturn &table.ContentAttachment{\n\t\tBizID: m.BizId,\n\t\tAppID: m.AppId,\n\t\tConfigItemID: m.ConfigItemId,\n\t}\n}", "func (n *dnode) IsFile() bool {\n\treturn n.dnType == dnTypeBlob\n}", "func CfnElasticLoadBalancerAttachment_IsConstruct(x interface{}) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_opsworks.CfnElasticLoadBalancerAttachment\",\n\t\t\"isConstruct\",\n\t\t[]interface{}{x},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (r *AttachmentOriginal) GetDownload() bool {\n\treturn r.Download\n}", "func (me TxsdNodeRoleSimpleContentExtensionCategory) IsMail() bool { return me.String() == \"mail\" }", "func (me TxsdCounterSimpleContentExtensionType) IsMessage() bool { return me.String() == \"message\" }", "func (s SourceFilesystems) IsContent(filename string) bool {\n\treturn s.Content.Contains(filename)\n}", "func (contentType ContentType) Is(mimeType string) bool {\n\tmediaType, _, err := mime.ParseMediaType(mimeType)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn string(contentType) == mediaType\n}", "func PrepareAttachment(f io.Reader) (io.Reader, error) {\n\t//read f and redurns the message, m as type Message\n\tm, err := mail.ReadMessage(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\theader := m.Header\n\n\t//find media type\n\tmediaType, params, err := mime.ParseMediaType(header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"PrepareAttachment: error parsing media type\")\n\t}\n\n\t//if file is multipart\n\tif strings.HasPrefix(mediaType, \"multipart/\") {\n\t\tmr := multipart.NewReader(m.Body, params[\"boundary\"])\n\n\t\tfor {\n\t\t\tp, err := mr.NextPart()\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, fmt.Errorf(\"PrepareAttachment: EOF before valid attachment\")\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// need to add checks to ensure base64\n\t\t\tpartType, _, err := mime.ParseMediaType(p.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"PrepareAttachment: error parsing media type of part\")\n\t\t\t}\n\n\t\t\t// if gzip\n\t\t\tif strings.HasPrefix(partType, \"application/gzip\") ||\n\t\t\t\tstrings.HasPrefix(partType, \"application/x-gzip\") ||\n\t\t\t\tstrings.HasPrefix(partType, \"application/gzip-compressed\") ||\n\t\t\t\tstrings.HasPrefix(partType, \"application/gzipped\") ||\n\t\t\t\tstrings.HasPrefix(partType, \"application/x-gunzip\") ||\n\t\t\t\tstrings.HasPrefix(partType, \"application/x-gzip-compressed\") ||\n\t\t\t\tstrings.HasPrefix(partType, \"gzip/document\") {\n\n\t\t\t\tdecodedBase64 := base64.NewDecoder(base64.StdEncoding, p)\n\t\t\t\tdecompressed, err := gzip.NewReader(decodedBase64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\treturn decompressed, nil\n\t\t\t}\n\n\t\t\t// if zip\n\t\t\tif strings.HasPrefix(partType, \"application/zip\") || // google style\n\t\t\t\tstrings.HasPrefix(partType, \"application/x-zip-compressed\") { // yahoo style\n\n\t\t\t\tdecodedBase64 := base64.NewDecoder(base64.StdEncoding, p)\n\t\t\t\tdecompressed, err := ExtractZipFile(decodedBase64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\treturn decompressed, nil\n\t\t\t}\n\n\t\t\t// if xml\n\t\t\tif strings.HasPrefix(partType, \"text/xml\") {\n\t\t\t\treturn p, nil\n\t\t\t}\n\n\t\t\t// if application/octetstream, check filename\n\t\t\tif strings.HasPrefix(partType, \"application/octet-stream\") {\n\t\t\t\tif strings.HasSuffix(p.FileName(), \".zip\") {\n\t\t\t\t\tdecodedBase64 := base64.NewDecoder(base64.StdEncoding, p)\n\t\t\t\t\tdecompressed, err := ExtractZipFile(decodedBase64)\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\treturn decompressed, nil\n\t\t\t\t}\n\n\t\t\t\tif strings.HasSuffix(p.FileName(), \".gz\") {\n\t\t\t\t\tdecodedBase64 := base64.NewDecoder(base64.StdEncoding, p)\n\t\t\t\t\tdecompressed, _ := gzip.NewReader(decodedBase64)\n\n\t\t\t\t\treturn decompressed, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// if gzip\n\tif strings.HasPrefix(mediaType, \"application/gzip\") || // proper :)\n\t\tstrings.HasPrefix(mediaType, \"application/x-gzip\") || // gmail attachment\n\t\tstrings.HasPrefix(mediaType, \"application/gzip-compressed\") ||\n\t\tstrings.HasPrefix(mediaType, \"application/gzipped\") ||\n\t\tstrings.HasPrefix(mediaType, \"application/x-gunzip\") ||\n\t\tstrings.HasPrefix(mediaType, \"application/x-gzip-compressed\") ||\n\t\tstrings.HasPrefix(mediaType, \"gzip/document\") {\n\n\t\tdecodedBase64 := base64.NewDecoder(base64.StdEncoding, m.Body)\n\t\tdecompressed, _ := gzip.NewReader(decodedBase64)\n\n\t\treturn decompressed, nil\n\n\t}\n\n\t// if zip\n\tif strings.HasPrefix(mediaType, \"application/zip\") || // google style\n\t\tstrings.HasPrefix(mediaType, \"application/x-zip-compressed\") { // yahoo style\n\t\tdecodedBase64 := base64.NewDecoder(base64.StdEncoding, m.Body)\n\t\tdecompressed, err := ExtractZipFile(decodedBase64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn decompressed, nil\n\t}\n\n\t// if xml\n\tif strings.HasPrefix(mediaType, \"text/xml\") {\n\t\treturn m.Body, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"prepareAttachment: reached the end, no attachment found\")\n}", "func (o *ObjectInfo) IsEncryptedMultipart() bool {\n\t_, ok := o.UserDefined[ReservedMetadataPrefix+\"Encrypted-Multipart\"]\n\treturn ok\n}", "func (r *Reply) IsContentTypeSet() bool {\n\treturn len(r.ContType) > 0\n}", "func (o *Post) HasHasAttachments() bool {\n\tif o != nil && o.HasAttachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Post) GetAttachmentsOk() ([]MicrosoftGraphAttachment, bool) {\n\tif o == nil || o.Attachments == nil {\n\t\tvar ret []MicrosoftGraphAttachment\n\t\treturn ret, false\n\t}\n\treturn *o.Attachments, true\n}", "func (me TdtypeType) IsFile() bool { return me.String() == \"file\" }", "func (fa FileAttributes) IsArchive() bool {\n\treturn fa&32 > 0\n}", "func (p *Part) IsText() bool {\n\treturn gobool(C.gmime_is_text_part(p.gmimePart))\n}", "func (f *Firework) Attached() bool {\n\treturn f.attached\n}", "func PbContentAttachment(at *table.ContentAttachment) *ContentAttachment {\n\tif at == nil {\n\t\treturn nil\n\t}\n\n\treturn &ContentAttachment{\n\t\tBizId: at.BizID,\n\t\tAppId: at.AppID,\n\t\tConfigItemId: at.ConfigItemID,\n\t}\n}", "func (data EditMessageData) NeedsMultipart() bool {\n\treturn len(data.Files) > 0\n}", "func (me TxsdMimeTypeSequenceType) IsVideo() bool { return me.String() == \"video\" }", "func (me TxsdCounterSimpleContentExtensionType) IsByte() bool { return me.String() == \"byte\" }", "func (e PartialContent) IsPartialContent() {}", "func (o AttachmentAccepterOutput) AttachmentType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AttachmentAccepter) pulumi.StringOutput { return v.AttachmentType }).(pulumi.StringOutput)\n}", "func (o *TaskRequest) HasAttachmentOptions() bool {\n\tif o != nil && o.AttachmentOptions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func TestAttachments(t *testing.T) {\n\te := testutils.TestEmail()\n\n\tattachment := testutils.TestAttachment(t)\n\te.Attachments = append(e.Attachments, attachment)\n\n\tparams, err := b.paramsForEmail(e)\n\tif err != nil {\n\t\tt.FailNow()\n\t}\n\n\t// the sendgrid backend will have read the contents of the reader,\n\t// so we need to seek back to the beginning\n\toffset, err := attachment.Data.(io.ReadSeeker).Seek(0, 0)\n\tif err != nil {\n\t\tt.FailNow()\n\t} else if offset != int64(0) {\n\t\tt.FailNow()\n\t}\n\n\t// check that the file data is there\n\tfileData, err := ioutil.ReadAll(attachment.Data)\n\tif err != nil {\n\t\tt.FailNow()\n\t}\n\tif params.Get(fmt.Sprintf(\"files[%v]\", e.Attachments[0].Name)) != string(fileData) {\n\t\tt.FailNow()\n\t}\n}", "func (*Content_AttachmentContent) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{6, 2}\n}", "func (me TxsdCounterSimpleContentExtensionType) IsAlert() bool { return me.String() == \"alert\" }", "func (m *ChatMessageAttachment) GetContentType()(*string) {\n val, err := m.GetBackingStore().Get(\"contentType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (object Object) Attachment(value interface{}) Object {\n\treturn object.Property(as.PropertyAttachment, value)\n}", "func (input *BeegoInput) IsUpload() bool {\n\treturn strings.Contains(input.Header(\"Content-Type\"), \"multipart/form-data\")\n}", "func IsErrAttachmentNotExist(err error) bool {\n\t_, ok := err.(ErrAttachmentNotExist)\n\treturn ok\n}", "func (t *Link) IsMediaType() (ok bool) {\n\treturn t.mediaType != nil && t.mediaType.mimeMediaTypeValue != nil\n\n}", "func (me TxsdImpactSimpleContentExtensionType) IsPolicy() bool { return me.String() == \"policy\" }", "func (a *Attachment) MarshalJSON() ([]byte, error) {\n\tvar err error\n\tswitch {\n\tcase len(a.Content) != 0:\n\t\ta.setMetadata()\n\tcase a.outputStub || a.Follows:\n\t\terr = a.readMetadata()\n\tdefault:\n\t\terr = a.readContent()\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tatt := struct {\n\t\tAttachment\n\t\tContent *[]byte `json:\"data,omitempty\"` // nolint: govet\n\t\tStub *bool `json:\"stub,omitempty\"` // nolint: govet\n\t\tFollows *bool `json:\"follows,omitempty\"` // nolint: govet\n\t}{\n\t\tAttachment: *a,\n\t}\n\tswitch {\n\tcase a.outputStub:\n\t\tatt.Stub = &a.outputStub\n\tcase a.Follows:\n\t\tatt.Follows = &a.Follows\n\tcase len(a.Content) > 0:\n\t\tatt.Content = &a.Content\n\t}\n\treturn json.Marshal(att)\n}", "func (t *Transport) Able() bool {\n\treturn t.blob.Able() && t.pubsub.Able()\n}", "func IsAttachableVolume(volumeSpec *volume.Spec, volumePluginMgr *volume.VolumePluginMgr) bool {\n\tattachableVolumePlugin, _ := volumePluginMgr.FindAttachablePluginBySpec(volumeSpec)\n\tif attachableVolumePlugin != nil {\n\t\tvolumeAttacher, err := attachableVolumePlugin.NewAttacher()\n\t\tif err == nil && volumeAttacher != nil {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func isMultipartObject(storage StorageAPI, bucket, object string) bool {\n\t_, err := storage.StatFile(bucket, pathJoin(object, multipartMetaFile))\n\tif err != nil {\n\t\tif err == errFileNotFound {\n\t\t\treturn false\n\t\t}\n\t\terrorIf(err, \"Failed to stat file \"+bucket+pathJoin(object, multipartMetaFile))\n\t\treturn false\n\t}\n\treturn true\n}", "func (me TxsdCounterSimpleContentExtensionType) IsHost() bool { return me.String() == \"host\" }", "func (o *CloudVolumeInstanceAttachment) HasAttachTime() bool {\n\tif o != nil && o.AttachTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *Messenger) Attachment(to Recipient, dataType AttachmentType, url string, messagingType MessagingType, tags ...string) error {\n\tresponse := &Response{\n\t\ttoken: m.token,\n\t\tto: to,\n\t}\n\n\treturn response.Attachment(dataType, url, messagingType, tags...)\n}", "func (me TxsdPresentationAttributesTextContentElementsDirection) IsInherit() bool {\n\treturn me.String() == \"inherit\"\n}", "func (na *cnmNetworkAllocator) IsAttachmentAllocated(node *api.Node, networkAttachment *api.NetworkAttachment) bool {\n\tif node == nil {\n\t\treturn false\n\t}\n\n\tif networkAttachment == nil || networkAttachment.Network == nil {\n\t\treturn false\n\t}\n\n\t// If the node is not found in the allocated set, then it is\n\t// not allocated.\n\tif _, ok := na.nodes[node.ID]; !ok {\n\t\treturn false\n\t}\n\n\t// If the network is not found in the allocated set, then it is\n\t// not allocated.\n\tif _, ok := na.nodes[node.ID][networkAttachment.Network.ID]; !ok {\n\t\treturn false\n\t}\n\n\t// If the network is not allocated, the node cannot be allocated.\n\tlocalNet, ok := na.networks[networkAttachment.Network.ID]\n\tif !ok {\n\t\treturn false\n\t}\n\n\t// Addresses empty, not allocated.\n\tif len(networkAttachment.Addresses) == 0 {\n\t\treturn false\n\t}\n\n\t// The allocated IP address not found in local endpoint state. Not allocated.\n\tif _, ok := localNet.endpoints[networkAttachment.Addresses[0]]; !ok {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (lm LinksManager) DownloadContent(url *url.URL, resp *http.Response, typ resource.Type) (bool, resource.Attachment, []resource.Issue) {\n\tif !lm.LinkSettings.DownloadLinkDestinationAttachments {\n\t\treturn false, nil, nil\n\t}\n\treturn resource.DownloadFile(lm, url, resp, typ)\n}", "func (me TxsdMimeTypeSequenceType) IsAudio() bool { return me.String() == \"audio\" }", "func (p Page) Attachment() Attachment {\n\treturn p.DownloadedAttachment\n}", "func (r *AttachmentPreview) HasExt() bool {\n\treturn r.hasExt\n}", "func (o *InlineResponse20051TodoItems) HasAttachmentsCount() bool {\n\tif o != nil && o.AttachmentsCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdImpactSimpleContentExtensionType) IsUser() bool { return me.String() == \"user\" }", "func (ctx *Context) IsUpload() bool {\r\n\treturn strings.Contains(ctx.HeaderParam(HeaderContentType), MIMEMultipartForm)\r\n}", "func (o *TaskRequest) GetAttachmentsOk() (*TaskRequestAttachments, bool) {\n\tif o == nil || o.Attachments == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Attachments, true\n}", "func (m *AttachmentItem) GetAttachmentType()(*AttachmentType) {\n return m.attachmentType\n}", "func (t *MailTestSuite) Attachment(name string) Attachment {\n\tpath := t.base + string(os.PathSeparator) + DataPath + string(os.PathSeparator) + name\n\tfile, err := ioutil.ReadFile(path)\n\n\tif err != nil {\n\t\tt.Fail(\"error getting attachment with the path: \"+path, err)\n\t}\n\n\treturn Attachment{\n\t\tFilename: name,\n\t\tBytes: file,\n\t}\n}", "func (r *AttachmentOriginal) HasSign() bool {\n\treturn r.hasSign\n}", "func (attachment *ReaderAttachment) Attach(mimeWriter *multipart.Writer) error {\n\n\thdr := textproto.MIMEHeader{}\n\thdr.Add(\"Content-Type\", attachment.ContentType)\n\thdr.Add(\"Content-Disposition\", fmt.Sprintf(`attachment; filename=\"%s\"`, attachment.Filename))\n\thdr.Add(\"Content-Transfer-Encoding\", \"base64\")\n\tpart, err := mimeWriter.CreatePart(hdr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tenc := base64.NewEncoder(base64.StdEncoding, part)\n\tio.Copy(enc, attachment.Content)\n\tenc.Close()\n\tif rc, ok := attachment.Content.(io.ReadCloser); ok {\n\t\trc.Close()\n\t}\n\treturn nil\n}", "func (m *AttachmentItem) GetContentType()(*string) {\n return m.contentType\n}", "func (o *Post) GetHasAttachmentsOk() (bool, bool) {\n\tif o == nil || o.HasAttachments == nil {\n\t\tvar ret bool\n\t\treturn ret, false\n\t}\n\treturn *o.HasAttachments, true\n}", "func (obj *content) IsNormal() bool {\n\treturn obj.normal != nil\n}", "func (input *Input) IsUpload() bool {\n\treturn strings.Contains(input.Header(\"Content-Type\"), \"multipart/form-data\")\n}", "func (me TxsdImpactSimpleContentExtensionType) IsDos() bool { return me.String() == \"dos\" }", "func (m *ChatMessage) GetAttachments()([]ChatMessageAttachmentable) {\n return m.attachments\n}", "func (me TAttlistCommentsCorrectionsRefType) IsAssociatedPublication() bool {\n\treturn me.String() == \"AssociatedPublication\"\n}", "func (me TxsdPresentationAttributesTextContentElementsTextAnchor) IsInherit() bool {\n\treturn me.String() == \"inherit\"\n}", "func (m *Metadata) IsFile() bool {\n\treturn (strings.ToLower(m.Tag) == MetadataTypeFile)\n}", "func (c *Controller) IsAttached(isAttachedRequest k8sresources.FlexVolumeIsAttachedRequest) k8sresources.FlexVolumeResponse {\n\tc.logger.Println(\"controller-isAttached-start\")\n\treturn k8sresources.FlexVolumeResponse{\n\t\tStatus: \"Not supported\",\n\t}\n}" ]
[ "0.8364052", "0.712331", "0.6851076", "0.6623727", "0.65944177", "0.63823783", "0.6326309", "0.62711173", "0.61442995", "0.61011577", "0.60864383", "0.60676914", "0.60450274", "0.59972024", "0.5980794", "0.5883554", "0.5855307", "0.583973", "0.58200735", "0.58034015", "0.57583386", "0.5731236", "0.57289475", "0.5728218", "0.5723137", "0.5686201", "0.5665809", "0.56380385", "0.5595032", "0.55459005", "0.55456525", "0.5533175", "0.5521235", "0.55169576", "0.55116314", "0.54625976", "0.5443489", "0.540581", "0.5393773", "0.53909683", "0.53886425", "0.53824013", "0.53822666", "0.53745455", "0.5364253", "0.5358638", "0.53304446", "0.53118575", "0.5294223", "0.5280117", "0.5276216", "0.52729684", "0.5261174", "0.52593416", "0.52540314", "0.5247269", "0.5235302", "0.5232965", "0.5205006", "0.51975894", "0.5195634", "0.51890296", "0.51830447", "0.5178482", "0.5170242", "0.51581186", "0.5149956", "0.51447415", "0.5138088", "0.5130533", "0.5130515", "0.5129325", "0.5123215", "0.5113815", "0.5089166", "0.50694335", "0.506196", "0.5061885", "0.5053847", "0.5052783", "0.5036337", "0.50352275", "0.5033726", "0.5033435", "0.5029186", "0.5026592", "0.5026171", "0.502115", "0.5018039", "0.5009573", "0.50078684", "0.5005492", "0.50054365", "0.49976853", "0.499121", "0.49841577", "0.49765426", "0.49723363", "0.49704477", "0.49648845" ]
0.9088709
0
IsComment return true if content is comment
func (c *Content) IsComment() bool { return c.Type == CONTENT_TYPE_COMMENT }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t Type) IsComment() bool {\n\treturn comm_start < t && t < comm_end\n}", "func isComment(s state) bool {\n\tswitch s {\n\tcase stateHTMLCmt, stateJSBlockCmt, stateJSLineCmt, stateCSSBlockCmt, stateCSSLineCmt:\n\t\treturn true\n\t}\n\treturn false\n}", "func (t Token) IsComment() bool {\n\treturn t.Kind == TBlockComment || t.Kind == TLineComment\n}", "func IsComment(s string) bool {\n\treturn len(s) == 0 || s[0] == '#'\n}", "func (l *line) isComment() bool {\n\treturn len(l.tokens) > 0 && l.tokens[0] == slash\n}", "func (p *Lexer) Comment() bool {\n\tc, _ := p.Byte()\n\n\tif c == '#' {\n\t\tc, _ = p.Byte()\n\t\tif IsSpaceChar(c) {\n\t\t\tfor {\n\t\t\t\tc, _ = p.Byte()\n\t\t\t\tif IsEndChar(c) || IsBreakChar(c) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tp.UnreadByte()\n\t}\n\tp.UnreadByte()\n\treturn false\n}", "func (l *line) isHTMLComment() bool {\n\treturn len(l.tokens) > 0 && l.tokens[0] == slash+slash\n}", "func (me TAttlistCommentsCorrectionsRefType) IsCommentIn() bool { return me.String() == \"CommentIn\" }", "func (me TAttlistCommentsCorrectionsRefType) IsCommentOn() bool { return me.String() == \"CommentOn\" }", "func (tb *TextBuf) InComment(pos TextPos) bool {\n\tcs := tb.CommentStart(pos.Ln)\n\tif cs < 0 {\n\t\treturn false\n\t}\n\treturn pos.Ch > cs\n}", "func hasComment(x Expr, text string) bool {\n\tif x == nil {\n\t\treturn false\n\t}\n\tfor _, com := range x.Comment().Before {\n\t\tif strings.Contains(strings.ToLower(com.Token), text) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *Comment) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Doc) Comment(key, comments string) bool {\n\te, ok := p.props[key]\n\tif !ok {\n\t\treturn false\n\t}\n\n\t// 如果所有注释为空\n\tif comments == \"\" {\n\t\tp.lines.InsertBefore(&line{typo: '#', value: \"#\"}, e)\n\t\treturn true\n\t}\n\n\t// 创建一个新的Scanner\n\tscanner := bufio.NewScanner(strings.NewReader(comments))\n\tfor scanner.Scan() {\n\t\tp.lines.InsertBefore(&line{typo: '#', value: \"#\" + scanner.Text()}, e)\n\t}\n\n\treturn true\n}", "func (this *Space) HasComment() bool {\n\tif this == nil {\n\t\treturn false\n\t}\n\tfor _, s := range this.Space {\n\t\tif isComment(s) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func is_mysql_comment(cs string, len, pos int) bool {\n\t/* so far...\n\t * cs[pos] == '/' && cs[pos+1] == '*'\n\t */\n\n\tif pos+2 >= len {\n\t\t/* not a mysql comment */\n\t\treturn false\n\t}\n\n\tif cs[pos+2] != '!' {\n\t\t/* not a mysql comment */\n\t\treturn false\n\t}\n\n\t/*\n\t * this is a mysql comment\n\t * got \"/x!\"\n\t */\n\treturn true\n}", "func isCommentLine(line string) bool {\n\treturn strings.HasPrefix(line, \"#\")\n}", "func CommentIsInChangedLines(c context.Context, trackComment *track.Comment, changedLines ChangedLinesInfo) bool {\n\tvar data tricium.Data_Comment\n\tif trackComment.Comment == nil {\n\t\tlogging.Errorf(c, \"Got a comment with a nil Comment field: %+v\", trackComment)\n\t\treturn false\n\t}\n\n\tif err := jsonpb.UnmarshalString(string(trackComment.Comment), &data); err != nil {\n\t\tlogging.WithError(err).Errorf(c, \"Failed to unmarshal comment.\")\n\t\treturn false\n\t}\n\n\tif len(data.Path) == 0 {\n\t\treturn true // This is a comment on the commit message, which is always kept.\n\t}\n\n\tif data.StartLine == 0 {\n\t\treturn true // File-level comment, should be kept.\n\t}\n\n\t// If the file has changed lines tracked, pass over comments that aren't in the diff.\n\tif lines, ok := changedLines[data.Path]; ok {\n\t\tstart, end := int(data.StartLine), int(data.EndLine)\n\t\tif end > start && data.EndChar == 0 {\n\t\t\tend-- // None of data.EndLine is included in the comment.\n\t\t}\n\t\tif end == 0 {\n\t\t\tend = start // Line comment.\n\t\t}\n\t\tif isInChangedLines(start, end, lines) {\n\t\t\treturn true\n\t\t}\n\t\tlogging.Debugf(c, \"Filtering out comment on lines [%d, %d].\", start, end)\n\t\treturn false\n\t}\n\tlogging.Debugf(c, \"File %q is not in changed lines.\", data.Path)\n\treturn false\n}", "func checkComment(l *Linter, n ast.Node, name string, comment string, startWithIs bool) {\n\tprefix := name + \" \"\n\tif !strings.HasPrefix(comment, prefix) {\n\t\tif comment == \"\" {\n\t\t\tl.addError(n, \"missing comment for %q\", name)\n\t\t\treturn\n\t\t}\n\t\tl.addError(n, \"comment for %q must start with %q\", name, prefix)\n\t\treturn\n\t}\n\tif !strings.HasSuffix(strings.TrimSpace(comment), \".\") {\n\t\tl.addError(n, \"comment for %q must end with a period\", name)\n\t\treturn\n\t}\n\tif !startWithIs {\n\t\treturn\n\t}\n\tif strings.HasPrefix(comment, prefix+\"is \") || strings.HasPrefix(comment, prefix+\"are \") {\n\t\treturn\n\t}\n\tl.addError(n, \"comment for %q must start with %q\", name, prefix+\"is/are \")\n}", "func (o *MicrosoftGraphWorkbookComment) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isCommentOrEmptyLine(text string) bool {\n\twhiteSpace := strings.Replace(text, \" \", \"\", -1)\n\twhiteSpace = strings.Replace(whiteSpace, \"\\t\", \"\", -1)\n\treturn whiteSpace == \"\" || (strings.Contains(text, \"//\") && whiteSpace[0:2] == \"//\")\n}", "func (c *Comment) Valid() error {\n\treturn utils.ValidText(\"task comment\", c.Content)\n}", "func (o *StorageNetAppCifsShareAllOf) HasComment() bool {\n\tif o != nil && o.Comment != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CommentTypeIsRef(t CommentType) bool {\n\treturn t == CommentTypeCommentRef || t == CommentTypePullRef || t == CommentTypeIssueRef\n}", "func (o *DeployKey) HasComment() bool {\n\tif o != nil && o.Comment != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasComment() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Comment\", \"comment\"))\n}", "func (o *ReservationModel) HasComment() bool {\n\tif o != nil && o.Comment != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func commentFinder() func(string) bool {\n\tcommentSectionInProgress := false\n\treturn func(line string) bool {\n\t\tif comment.FindString(line) != \"\" {\n\t\t\t// \"//\" Comment line found.\n\t\t\treturn true\n\t\t}\n\t\t// If the current line is at the start `/*` of a multi-line comment,\n\t\t// set a flag to remember we're within a multi-line comment.\n\t\tif commentStart.FindString(line) != \"\" {\n\t\t\tcommentSectionInProgress = true\n\t\t\treturn true\n\t\t}\n\t\t// At the end `*/` of a multi-line comment, clear the flag.\n\t\tif commentEnd.FindString(line) != \"\" {\n\t\t\tcommentSectionInProgress = false\n\t\t\treturn true\n\t\t}\n\t\t// The current line is within a `/*...*/` section.\n\t\tif commentSectionInProgress {\n\t\t\treturn true\n\t\t}\n\t\t// Anything else is not a comment region.\n\t\treturn false\n\t}\n}", "func (n *NotCommentToken) Content() []byte {\n\treturn n.c\n}", "func (lx *Lexer) comment() Token {\n\tlx.consume()\n\n\tr, _ := lx.nextChar()\n\tlx.token.writeRune(r)\n\tlx.token.Type = Comment\n\n\tif r == '/' {\n\t\tlx.endOfLineComment()\n\t} else if r == '*' {\n\t\tlx.traditionalComment()\n\t}\n\treturn lx.returnAndReset()\n}", "func (un *Decoder) Comment(c xml.Comment) error { return nil }", "func (v Notes) EditComment(params NotesEditCommentParams) (bool, error) {\n\tr, err := v.API.Request(\"notes.editComment\", params)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn decodeBoolIntResponse(r)\n}", "func (c *CommentBlock) Content() []byte {\n\treturn c.content\n}", "func (this Comment) GetContent() string {\n\tif len(this) == 0 {\n\t\treturn \"\"\n\t}\n\ts := []byte(this)\n\tif isLineComment(string(this)) {\n\t\treturn string(s[2 : len(s)-1])\n\t}\n\treturn string(s[2 : len(s)-2])\n}", "func (o *V0037JobProperties) HasComment() bool {\n\tif o != nil && o.Comment != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CaCertificateCreateReqWeb) GetCommentOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Comment, true\n}", "func (s Settings) Commented() bool {\n\treturn s.comment\n}", "func (v Notes) DeleteComment(params NotesDeleteCommentParams) (bool, error) {\n\tr, err := v.API.Request(\"notes.deleteComment\", params)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn decodeBoolIntResponse(r)\n}", "func (p PRMirror) AddComment(id int, comment string) bool {\n\tissueComment := github.IssueComment{}\n\tissueComment.Body = &comment\n\n\t_, _, err := p.GitHubClient.Issues.CreateComment(*p.Context, p.Configuration.DownstreamOwner, p.Configuration.DownstreamRepo, id, &issueComment)\n\tif err != nil {\n\t\tlog.Errorf(\"Error while adding a comment to issue#:%d - %s\", id, err.Error())\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (p *printer) commentsHaveNewline(list []*ast.Comment) bool {\n\t// len(list) > 0\n\tline := p.lineFor(list[0].Pos())\n\tfor i, c := range list {\n\t\tif i > 0 && p.lineFor(list[i].Pos()) != line {\n\t\t\t// not all comments on the same line\n\t\t\treturn true\n\t\t}\n\t\tif t := c.Text; len(t) >= 2 && (t[1] == '/' || strings.Contains(t, \"\\n\")) {\n\t\t\treturn true\n\t\t}\n\t}\n\t_ = line\n\treturn false\n}", "func (p *Parser) lexComment(l *lex.Lexer) lex.StateFn {\n\t// Find out which kind of comment we have, so we know how to deal with it.\n\tc := p.Commenters.First(l.Input(0))\n\n\tl.Inc(len(c.Begin))\n\tvar end = c.End\n\tif end == \"\" {\n\t\tend = \"\\n\"\n\t}\n\tfor !l.Consume(end) && l.Next() != lex.EOF {\n\t\t// absorb as long as we don't hit EOF or end-of-comment\n\t}\n\tif c.End == \"\" {\n\t\tl.Dec(1)\n\t}\n\n\tif c.Strip {\n\t\tl.Ignore()\n\t} else {\n\t\tl.Emit(typeComment)\n\t}\n\t// If we exited because of EOF, then Peek will also return EOF.\n\tif l.Peek() == lex.EOF {\n\t\tl.Emit(lex.TypeEOF)\n\t\treturn nil\n\t}\n\treturn p.lexText\n}", "func (c *CommentBlock) ContentString() string {\n\treturn string(c.content)\n}", "func (o *Comment) GetContentOk() (*string, bool) {\n\tif o == nil || o.Content == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Content, true\n}", "func (c CommentCommand) IsAutoplan() bool {\n\treturn false\n}", "func (n *NotCommentToken) ContentString() string {\n\treturn string(n.Content())\n}", "func updateComment(username string, comment string) bool {\n\tlog.Printf(\"Updating comment for %s to %s\", username, comment)\n\tcmd := exec.Command(\"/bin/sh\", \"-c\", fmt.Sprintf(changeCommentCommand, comment, username))\n\tif _, err := cmd.CombinedOutput(); err != nil {\n\t\tlog.Printf(\"Error: Can't update comment for %s: %s\", username, err)\n\t\treturn false\n\t}\n\treturn true\n}", "func TestCommentsStandalone(t *testing.T) {\n\ttemplate := \"Begin.\\n{{! Comment Block! }}\\nEnd.\\n\"\n\texpected := \"Begin.\\nEnd.\\n\"\n\tactual := Render(template)\n\n\tif actual != expected {\n\t\tt.Errorf(\"returned %#v, expected %#v\", actual, expected)\n\t}\n}", "func (d UserData) Comment() string {\n\tval := d.ModelData.Get(models.NewFieldName(\"Comment\", \"comment\"))\n\tif !d.Has(models.NewFieldName(\"Comment\", \"comment\")) {\n\t\treturn *new(string)\n\t}\n\treturn val.(string)\n}", "func (o *VersionedConnection) HasComments() bool {\n\tif o != nil && o.Comments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StorageNetAppCifsShareAllOf) GetCommentOk() (*string, bool) {\n\tif o == nil || o.Comment == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Comment, true\n}", "func Comment(s string) string {\n\treturn fmt.Sprintf(\"<!-- %s -->\", s)\n}", "func (o *MicrosoftGraphWorkbookComment) HasContentType() bool {\n\tif o != nil && o.ContentType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func processComment(l *lexer) processResult {\n\trune := l.next()\n\tif rune == '/' {\n\t\trune := l.next()\n\t\tif rune == '/' {\n\t\t\t// eat up until \\n\n\t\t\tfor l.next() != '\\n' {\n\t\t\t}\n\t\t\tl.ignore()\n\t\t\treturn resultMatch\n\t\t} else {\n\t\t\tl.backup()\n\t\t\tl.backup()\n\t\t\treturn resultNoMatch\n\t\t}\n\t} else {\n\t\tl.backup()\n\t\treturn resultNoMatch\n\t}\n}", "func hasComments(list *ListExpr) (line, suffix bool) {\n\tcom := list.Comment()\n\tif len(com.Before) > 0 || len(com.After) > 0 || len(list.End.Before) > 0 {\n\t\tline = true\n\t}\n\tif len(com.Suffix) > 0 {\n\t\tsuffix = true\n\t}\n\tfor _, elem := range list.List {\n\t\tcom := elem.Comment()\n\t\tif len(com.Before) > 0 {\n\t\t\tline = true\n\t\t}\n\t\tif len(com.Suffix) > 0 {\n\t\t\tsuffix = true\n\t\t}\n\t}\n\treturn\n}", "func EqualsComments(a, b Comments) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (o *MicrosoftGraphWorkbookComment) GetContentOk() (string, bool) {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Content, true\n}", "func addComment(gh *octokat.Client, repo octokat.Repo, prNum, comment, commentType string) error {\n\t// get the comments\n\tcomments, err := gh.Comments(repo, prNum, &octokat.Options{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// check if we already made the comment\n\tfor _, c := range comments {\n\t\t// if we already made the comment return nil\n\t\tif strings.ToLower(c.User.Login) == \"gordontheturtle\" && strings.Contains(c.Body, commentType) {\n\t\t\tlogrus.Debugf(\"Already made comment about %q on PR %s\", commentType, prNum)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// add the comment because we must not have already made it\n\tif _, err := gh.AddComment(repo, prNum, comment); err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Infof(\"Would have added comment about %q PR %s\", commentType, prNum)\n\treturn nil\n}", "func (o *NiaapiRevisionInfoAllOf) HasRevisionComment() bool {\n\tif o != nil && o.RevisionComment != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func Comment(ctx context.Context, cfg *v1.Config, pr int, contents []byte) error {\n\tc := newClient(ctx, cfg.Github)\n\treturn c.CommentOnPR(pr, string(contents))\n}", "func (c CommentCommand) IsForSpecificProject() bool {\n\treturn c.RepoRelDir != \"\" || c.Workspace != \"\" || c.ProjectName != \"\"\n}", "func (m *MessageReplies) GetComments() (value bool) {\n\tif m == nil {\n\t\treturn\n\t}\n\treturn m.Flags.Has(0)\n}", "func (p *PKGBUILD) AppendComment(comment string) (ok bool) {\n\tbegin := position.Position{Line: 1}\n\tif last := len(p.atoms) - 1; last >= 0 {\n\t\tbegin = atom.GetEnd(p.atoms[last]).Next('\\n')\n\t}\n\tp.atoms.Push(newComment(comment, begin))\n\treturn true\n}", "func (prrce *PullRequestReviewCommentEvent) Comment() string {\n\tcomment := prrce.raw.Payload[\"comment\"].(map[string]interface{})\n\treturn comment[\"body\"].(string)\n}", "func (h *HSTIMParser) ParseComment(msg []byte) (HSTIMComment, error) {\n\tc := HSTIMComment{}\n\t// Verify the first character is `C`, which indicates it's a comment\n\tif (msg[0]) != 'C' {\n\t\treturn c, &ParseError{fmt.Sprintf(\"Not a comment\")}\n\t}\n\n\t// Slice off everything before <CR><EXT>\n\tmsgStr := removeTrailingValues(msg)\n\n\tsplits := strings.Split(msgStr[2:], \"|\")\n\tif len(splits) != 3 {\n\t\treturn c, &ParseError{fmt.Sprintf(\"Expected 3 fields, got %d\", len(splits))}\n\t}\n\n\tif splits[0] != \"1\" {\n\t\treturn c, &ParseError{\"Sequence number should always be 1\"}\n\t}\n\tc.SequenceNumber = 1\n\tc.TestMode = splits[2]\n\n\treturn c, nil\n}", "func TestCommentsInline(t *testing.T) {\n\ttemplate := \"12345{{! Comment Block! }}67890\"\n\texpected := \"1234567890\"\n\tactual := Render(template)\n\n\tif actual != expected {\n\t\tt.Errorf(\"returned %#v, expected %#v\", actual, expected)\n\t}\n}", "func (o *StorageNetAppCifsShareAllOf) GetComment() string {\n\tif o == nil || o.Comment == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Comment\n}", "func TestFetchComment(t *testing.T) {\n\tinputs := []string{\n\t\t\"/ inline comment\",\n\t\t`*\n\t\t\tmultiline comment\n\t\t*/`,\n\t}\n\n\texpects := []string{\n\t\t\"// inline comment\",\n\t\t`/*\n\t\t\tmultiline comment\n\t\t*/`,\n\t}\n\n\tfor i, input := range inputs {\n\t\tlex := NewLexer(bytes.NewReader([]byte(input)))\n\t\tif err := lex.fetchComment(); err != nil {\n\t\t\tt.Error(err.Error())\n\t\t\treturn\n\t\t}\n\n\t\ttoken := lex.tokens[0]\n\n\t\tif token.Type() != TokenComment {\n\t\t\tt.Errorf(\"unexpected token type '%s', expecting type '%s'\", token.TypeString(), tokenTypeMap[TokenComment])\n\t\t\treturn\n\t\t}\n\n\t\texpected := expects[i]\n\t\tif token.String() != expected {\n\t\t\tt.Errorf(\"unexpected '%s', expecting '%s'\", token.String(), expected)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (t *TypeField) Comment() Expr {\n\treturn t.CommentExpr\n}", "func lexComment(lx *lexer) stateFn {\r\n\tr := lx.peek()\r\n\tif isNL(r) || r == eof {\r\n\t\tlx.emit(itemText)\r\n\t\treturn lx.pop()\r\n\t}\r\n\tlx.next()\r\n\treturn lexComment\r\n}", "func commentText(src []byte) (text string) {\n\ti := bytes.Index(src, tagBegin);\n\tj := bytes.Index(src, tagEnd);\n\tif i >= 0 && j >= i+len(tagBegin) {\n\t\ttext = string(bytes.TrimSpace(src[i+len(tagBegin) : j]))\n\t}\n\treturn;\n}", "func (s *Scanner) scanComment() Token {\n\t// Create a buffer and read the current character into it.\n\tvar buf bytes.Buffer\n\tbuf.WriteRune(s.read())\n\n\t// Read every subsequent character into the buffer until either\n\t// newline or EOF is encountered.\n\tfor {\n\t\tch := s.read()\n\t\tif ch == rune(0) {\n\t\t\tbreak\n\t\t}\n\n\t\tif ch == rune(0) || ch == '\\n' {\n\t\t\ts.unread()\n\t\t\tbreak\n\t\t}\n\n\t\tbuf.WriteRune(ch)\n\t}\n\n\ts.tok = COMMENT\n\ts.lit = buf.String()\n\treturn COMMENT\n}", "func (o *DeployKey) GetCommentOk() (*string, bool) {\n\tif o == nil || o.Comment == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Comment, true\n}", "func (o *VersionedControllerService) HasComments() bool {\n\tif o != nil && o.Comments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *Scanner) scanComment() *Token {\n\tvar buf bytes.Buffer\n\tstartPos := s.pos()\n\n\tfor {\n\t\tch0 := s.read()\n\t\tif ch0 == eof {\n\t\t\tbreak\n\t\t} else if ch0 == '-' {\n\t\t\tch1 := s.read()\n\t\t\tch2 := s.read()\n\t\t\tif ch1 == '-' && ch2 == '>' {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\ts.unread(2)\n\t\t\t}\n\t\t}\n\n\t\tbuf.WriteRune(ch0)\n\t}\n\n\treturn &Token{Type: CommentToken, Data: buf.String(), Pos: startPos}\n}", "func CheckChunk(regex ReviewRegex,\n chunk reviewdata.DiffChunk,\n commentChan chan <- reviewdata.Comment) {\n matchRegex := regexp.MustCompile(strings.Join(regex.Line.Match, \"|\"))\n excludeRegex := regexp.MustCompile(strings.Join(regex.Line.Exclude, \"|\"))\n var comment reviewdata.Comment\n\n for _, line := range chunk.Lines {\n if (matchRegex.MatchString(line.RhText) &&\n (len(regex.Line.Exclude) == 0 ||\n !excludeRegex.MatchString(line.RhText))) {\n if (comment.NumLines == 0) {\n // First match we've found\n comment.NumLines = 1\n comment.Line = line.ReviewLine\n comment.Text = regex.Comment.SingleLine\n comment.RaiseIssue = regex.Comment.RaiseIssue\n fmt.Println(1)\n } else {\n // Previously matched something\n comment.NumLines += 1\n comment.Text = regex.Comment.MultiLine\n fmt.Println(2)\n }\n } else {\n // Didn't natch. If we previously did, send the comment\n if (comment.NumLines > 0) {\n commentChan <- comment\n comment.NumLines = 0\n fmt.Println(3)\n }\n }\n }\n\n // Checked everything. If we've previously set up a comment, send it\n if (comment.NumLines > 0) {\n commentChan <- comment\n fmt.Printf(\"commented: %s\\n\", comment.Text)\n }\n fmt.Println(5)\n}", "func ToComment(content string) *ast.CommentGroup {\n\tcontent = strings.TrimRight(content, \"\\n\")\n\tif content == \"\" {\n\t\treturn nil\n\t}\n\n\tvar comments []*ast.Comment\n\tfor i, commentLine := range strings.Split(content, \"\\n\") {\n\t\tfmtStr := \"// %s\"\n\t\tif i == 0 {\n\t\t\tfmtStr = fmt.Sprintf(\"\\n%s\", fmtStr)\n\t\t}\n\t\tcomments = append(comments, &ast.Comment{\n\t\t\tText: fmt.Sprintf(fmtStr, commentLine),\n\t\t})\n\t}\n\n\treturn &ast.CommentGroup{\n\t\tList: comments,\n\t}\n}", "func (cs *CommentService) Comment(id uint) (*entity.Comment, []error) {\n\tcmnt, errs := cs.commentRepo.Comment(id)\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn cmnt, errs\n}", "func (a *TypeAlias) Comment() Expr {\n\treturn a.CommentExpr\n}", "func (o *RowCommentCreate) GetCommentOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Comment, true\n}", "func (cs *CommentService) Comment(id uint) (*entity.Comment, []error) {\n\tcomment, errs := cs.cmtRepo.Comment(id)\n\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn comment, nil\n}", "func (o *ReservationModel) GetCommentOk() (*string, bool) {\n\tif o == nil || o.Comment == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Comment, true\n}", "func (n *node) Comment() string {\n\treturn n.comment\n}", "func (cr *MockCommentGormRepo) Comment(id uint) (*entity.Comment, []error) {\n\tcomment := entity.MockComment\n\tif id != 1 {\n\t\treturn nil, []error{errors.New(\"Not found\")}\n\t}\n\treturn &comment, nil\n}", "func (c Config) StartComment() string {\n\tswitch c.Markup {\n\tcase stentor.MarkupMD:\n\t\treturn stentor.CommentMD\n\tcase stentor.MarkupRST:\n\t\treturn stentor.CommentRST\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "func (this *Space) HasAttachedComment() bool {\n\treturn len(this.GetAttachedComment()) > 0\n}", "func (c *CommentBlock) CommentMethod() CommentType {\n\treturn c.ct\n}", "func (client *Client) Comment(refType string, refId int64, text string, params map[string]interface{}) (*Comment, error) {\n\tpath := fmt.Sprintf(\"/comment/%s/%d/\", refType, refId)\n\tif params == nil {\n\t\tparams = map[string]interface{}{}\n\t}\n\tparams[\"value\"] = text\n\n\tcomment := &Comment{}\n\terr := client.RequestWithParams(\"POST\", path, nil, params, comment)\n\treturn comment, err\n}", "func (o *Comment) GetContent() string {\n\tif o == nil || o.Content == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Content\n}", "func (m Matcher) MatchComment(pattern string, alternatives ...string) Matcher {\n\treturn m\n}", "func UpdateComment(c *gin.Context, in *updateCommentIn) (*task.Comment, error) {\n\tmetadata.AddActionMetadata(c, metadata.TaskID, in.TaskID)\n\tmetadata.AddActionMetadata(c, metadata.CommentID, in.CommentID)\n\n\tdbp, err := zesty.NewDBProvider(utask.DBName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt, err := task.LoadFromPublicID(dbp, in.TaskID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcomment, err := task.LoadCommentFromPublicID(dbp, in.CommentID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treqUsername := auth.GetIdentity(c)\n\n\tadmin := auth.IsAdmin(c) == nil\n\tisCommentAuthor := reqUsername == comment.Username\n\n\tif !isCommentAuthor && !admin {\n\t\treturn nil, errors.Forbiddenf(\"Not allowed to update comment\")\n\t} else if !isCommentAuthor {\n\t\tmetadata.SetSUDO(c)\n\t}\n\n\tif t.Resolution != nil {\n\t\tres, err := resolution.LoadFromPublicID(dbp, *t.Resolution)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmetadata.AddActionMetadata(c, metadata.ResolutionID, res.PublicID)\n\t}\n\n\tif comment.TaskID != t.ID {\n\t\treturn nil, errors.BadRequestf(\"Comment and task don't match\")\n\t}\n\n\terr = comment.Update(dbp, in.Content)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn comment, nil\n}", "func lexComment(l *lexer) stateFn {\n\t// Ignore leading spaces and #.\n\tl.ignore()\n\tfor {\n\t\tr := l.next()\n\t\tif unicode.IsSpace(r) || r == '#' {\n\t\t\tl.ignore()\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\tl.backup()\n\n\tfor {\n\t\tswitch l.next() {\n\t\tcase '\\r', '\\n':\n\t\t\tl.emit(itemComment, false)\n\t\t\treturn lexRule\n\t\tcase eof:\n\t\t\tl.backup()\n\t\t\tl.emit(itemComment, false)\n\t\t\treturn lexRule\n\t\t}\n\t}\n}", "func (p *printer) commentBefore(next token.Position) bool {\n\treturn p.commentOffset < next.Offset && (!p.impliedSemi || !p.commentNewline)\n}", "func (o *CaCertificateCreateReqWeb) GetComment() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Comment\n}", "func (b *Service) CommentDelete(ctx context.Context, TeamID string, UserID string, EventValue string) ([]byte, error, bool) {\n\tvar c struct {\n\t\tCommentId string `json:\"commentId\"`\n\t}\n\terr := json.Unmarshal([]byte(EventValue), &c)\n\tif err != nil {\n\t\treturn nil, err, false\n\t}\n\n\terr = b.CheckinService.CheckinCommentDelete(ctx, c.CommentId)\n\tif err != nil {\n\t\treturn nil, err, false\n\t}\n\n\tmsg := createSocketEvent(\"comment_deleted\", \"\", \"\")\n\n\treturn msg, nil, false\n}", "func (dw *DrawingWand) Comment(comment string) {\n\tcscomment := C.CString(comment)\n\tdefer C.free(unsafe.Pointer(cscomment))\n\tC.MagickDrawComment(dw.dw, cscomment)\n}", "func (o *ViewProjectActivePages) HasComments() bool {\n\tif o != nil && o.Comments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CommentGroupsContain(comments []*ast.CommentGroup, text string) bool {\n\tif len(text) == 0 {\n\t\treturn false\n\t}\n\tfor _, cg := range comments {\n\t\tif strings.Contains(cg.Text(), text) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *StorageNetAppCifsShareAllOf) SetComment(v string) {\n\to.Comment = &v\n}", "func (o *V0037JobProperties) GetCommentOk() (*string, bool) {\n\tif o == nil || o.Comment == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Comment, true\n}", "func (o SnapshotImportClientDataOutput) Comment() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SnapshotImportClientData) *string { return v.Comment }).(pulumi.StringPtrOutput)\n}", "func (m *WorkbookCommentReply) GetContent()(*string) {\n return m.content\n}" ]
[ "0.8070134", "0.78601515", "0.7623746", "0.7510202", "0.7351018", "0.7310748", "0.69591284", "0.6869606", "0.6863134", "0.6551534", "0.64144266", "0.6250492", "0.6241997", "0.62200755", "0.61377007", "0.6091443", "0.6089278", "0.6064151", "0.6043184", "0.60294676", "0.6027368", "0.60007584", "0.5996023", "0.5842577", "0.5825427", "0.5789278", "0.57775295", "0.576302", "0.57193345", "0.5697661", "0.5691122", "0.5678965", "0.5675053", "0.5658156", "0.562943", "0.5624114", "0.5614079", "0.5590876", "0.5584946", "0.5566082", "0.5555664", "0.55468464", "0.55354655", "0.55066985", "0.5502754", "0.5490264", "0.548683", "0.5486106", "0.54854333", "0.5484161", "0.5475235", "0.5453085", "0.543578", "0.5425426", "0.5402112", "0.53968614", "0.5395518", "0.5393594", "0.53925055", "0.53905", "0.53892183", "0.538353", "0.5382821", "0.53745985", "0.53673476", "0.5365497", "0.53576255", "0.53462464", "0.5338473", "0.5326633", "0.5314753", "0.5310521", "0.53103274", "0.5299515", "0.52981824", "0.52926636", "0.5282296", "0.5282062", "0.52798635", "0.5272139", "0.527047", "0.52694786", "0.5262093", "0.5258468", "0.5250328", "0.52494353", "0.52471167", "0.5244262", "0.5240245", "0.5239332", "0.5238144", "0.5229526", "0.52277756", "0.5224175", "0.52158153", "0.52118313", "0.51999056", "0.5188717", "0.51852244", "0.51838666" ]
0.85867846
0
IsPage return true if content is page
func (c *Content) IsPage() bool { return c.Type == CONTENT_TYPE_PAGE }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Container) IsPage() bool {\n\treturn c.Title != \"\"\n}", "func (si *StructInfo) IsPage() bool {\n\treturn si.Kind == core.PAGE\n}", "func (p Page) inPage(s string) bool {\n\tfor _, v := range p.Links {\n\t\tif s == v.Url.String() || v.Url.String()+\"/\" == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (p Page) IsHTML() bool {\n\treturn p.Type().MediaType() == \"text/html\"\n}", "func (p *Paginator) IsCurrentPage(page int) bool {\n\treturn p.CurrentPage() == page\n}", "func (p *Pagination) IsCurrentPage(page int) bool {\n\treturn p.CurrentPage() == page\n}", "func (o *Bundles) HasCurrentPage() bool {\n\tif o != nil && o.CurrentPage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdCounterSimpleContentExtensionType) IsSite() bool { return me.String() == \"site\" }", "func (o *SpansListRequestAttributes) HasPage() bool {\n\treturn o != nil && o.Page != nil\n}", "func (o *Origin1) GetPageOk() (*PageType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Page, true\n}", "func IsAjaxPage(vals url.Values) bool {\n\tpage := getPageName(vals)\n\tajax := vals.Get(\"ajax\")\n\tasJson := vals.Get(\"asJson\")\n\treturn page == FetchEventboxAjaxPageName ||\n\t\tpage == FetchResourcesAjaxPageName ||\n\t\tpage == GalaxyContentAjaxPageName ||\n\t\tpage == EventListAjaxPageName ||\n\t\tpage == AjaxChatAjaxPageName ||\n\t\tpage == NoticesAjaxPageName ||\n\t\tpage == RepairlayerAjaxPageName ||\n\t\tpage == TechtreeAjaxPageName ||\n\t\tpage == PhalanxAjaxPageName ||\n\t\tpage == ShareReportOverlayAjaxPageName ||\n\t\tpage == JumpgatelayerAjaxPageName ||\n\t\tpage == FederationlayerAjaxPageName ||\n\t\tpage == UnionchangeAjaxPageName ||\n\t\tpage == ChangenickAjaxPageName ||\n\t\tpage == PlanetlayerAjaxPageName ||\n\t\tpage == TraderlayerAjaxPageName ||\n\t\tpage == PlanetRenameAjaxPageName ||\n\t\tpage == RightmenuAjaxPageName ||\n\t\tpage == AllianceOverviewAjaxPageName ||\n\t\tpage == SupportAjaxPageName ||\n\t\tpage == BuffActivationAjaxPageName ||\n\t\tpage == AuctioneerAjaxPageName ||\n\t\tpage == HighscoreContentAjaxPageName ||\n\t\tajax == \"1\" ||\n\t\tasJson == \"1\"\n}", "func (p Pagination) IsCurrent(page int) bool {\n\treturn page == p.CurrentPage\n}", "func (p Page) IsValid() bool {\n\treturn p.valid\n}", "func (o *OriginCollection) GetPageOk() (*PageType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Page, true\n}", "func (o *PaginationProperties) HasPage() bool {\n\tif o != nil && o.Page != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *RoleList) HasPage() bool {\n\treturn r.hasPage\n}", "func hasLandingPage(collection model.Pages, dir *model.Page) bool {\n\thasLanding := false\n\tfor _, page := range collection {\n\t\tif page.Type == \"file\" && page.Slug == dir.Slug {\n\t\t\thasLanding = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn hasLanding\n}", "func (p *Pagination) Show() bool {\n\treturn p.NumberOfPages() > 1\n}", "func (o *AclBindingListPage) HasPage() bool {\n\tif o != nil && o.Page != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Paginator) HasPages() bool {\n\treturn p.PageNums() > 1\n}", "func (e PartialContent) IsPartialContent() {}", "func PageHandler(w http.ResponseWriter, r *http.Request) (handled bool) {\n\tlog.Println(\"PageHandler called in example plugin\")\n\treturn false\n}", "func (o *InlineResponse20014Projects) HasStartPage() bool {\n\tif o != nil && o.StartPage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Paginator) IsActive(page int) bool {\n\treturn p.Page() == page\n}", "func (o *SimpleStringWeb) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (page *Page) AddPage(link *Page) bool {\n\tfor _, l := range page.Pages {\n\t\tif l == link {\n\t\t\treturn false\n\t\t}\n\t}\n\tpage.Pages = append(page.Pages, link)\n\treturn true\n}", "func (p Page) Type() Type {\n\treturn p.PageType\n}", "func (p *Paginator) Show() bool {\n\treturn p.NumberOfPages() > 1\n}", "func (c *ColumnChunkMetaData) HasIndexPage() bool { return c.columnMeta.IsSetIndexPageOffset() }", "func (s SourceFilesystems) IsContent(filename string) bool {\n\treturn s.Content.Contains(filename)\n}", "func (c Page) Page() revel.Result {\n\n\tc.RenderArgs[\"Site\"] = site.Site\n\n\t// Create PageData\n\tpdata := site.LoadPage(c.Params.Route.Get(\"section\"), c.Params.Route.Get(\"page\"))\n\tc.RenderArgs[\"Page\"] = pdata\n\n\tif pdata.Error != nil {\n\t\treturn c.NotFound(\"missing secton\")\n\t}\n\n\tc.RenderArgs[\"Section\"] = site.Site.Sections[pdata.Section]\n\n\treturn c.Render()\n\n}", "func (b *OGame) GetPageContent(vals url.Values) ([]byte, error) {\n\treturn b.WithPriority(taskRunner.Normal).GetPageContent(vals)\n}", "func (resp *PharosResponse) HasNextPage() bool {\n\treturn resp.Next != nil && *resp.Next != \"\"\n}", "func (p *Page) Valid() bool {\n\tif p.Limit > 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func (p *GetContentModerationPaginator) HasMorePages() bool {\n\treturn p.firstPage || p.nextToken != nil\n}", "func (o *DeliveryGetOriginsResponse) HasPageInfo() bool {\n\tif o != nil && o.PageInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Pagination) IsLastPage() bool {\n\treturn p.CurrentPage >= p.TotalPages\n}", "func (o *ViewMetaPage) HasPageSize() bool {\n\tif o != nil && o.PageSize != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Pagination) isFirst() bool {\n\treturn p.PageNumber == 1\n}", "func (p nullPage) IsEmpty() (bool, error) {\n\treturn true, nil\n}", "func (m *PrinterDefaults) GetFitPdfToPage()(*bool) {\n val, err := m.GetBackingStore().Get(\"fitPdfToPage\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func isParagraph(n *html.Node) bool {\n\treturn n.Type == html.ElementNode && n.Data == \"p\"\n}", "func (o *Origin1) GetPage() PageType {\n\tif o == nil {\n\t\tvar ret PageType\n\t\treturn ret\n\t}\n\n\treturn o.Page\n}", "func (o *ViewSampleProject) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsPrintable(header http.Header) bool {\n\tmimeType := header.Get(http.CanonicalHeaderKey(\"content-type\"))\n\tmimeType = strings.SplitN(mimeType, \";\", 2)[0]\n\tmimeType = strings.TrimSpace(mimeType)\n\n\tif mimeType == \"\" {\n\t\treturn true\n\t}\n\n\treturn PrintableTypes[mimeType]\n}", "func (pb *PageBuffer) End() bool {\n return pb.is_end\n}", "func (p *Pagination) hasMoreThanOnePage() bool {\n\treturn p.Limit < p.Total\n}", "func (m Model) OnLastPage() bool {\n\treturn m.Page == m.TotalPages-1\n}", "func (o *Bundles) GetCurrentPageOk() (*int32, bool) {\n\tif o == nil || o.CurrentPage == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CurrentPage, true\n}", "func (p *Pages) Has(pageName string) bool {\n\tvar pageHandle = cleanAllSlashes(handlePath(pageName))\n\tvar prefixPage = cleanAllSlashes(handlePath(p.prefix, pageName))\n\tp.sl.RLock()\n\tif _, exists := p.managers[prefixPage]; exists {\n\t\tp.sl.RUnlock()\n\t\treturn true\n\t}\n\tif _, exists := p.managers[pageHandle]; exists {\n\t\tp.sl.RUnlock()\n\t\treturn true\n\t}\n\tp.sl.RUnlock()\n\treturn false\n}", "func (o *TlsDeliveryProfile) GetPageOk() (*PageType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Page, true\n}", "func (me TAttlistLocationLabelType) IsChapter() bool { return me.String() == \"chapter\" }", "func (w *W3CNode) IsDocument() bool {\n\tparent := w.ParentNode().(*W3CNode)\n\treturn w.ParentNode() != nil && parent.HTMLNode() == w.HTMLNode()\n}", "func (o *CdnGetScopeRulesResponse) HasPageInfo() bool {\n\tif o != nil && o.PageInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *BastionHostsClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.BastionHostListResult.NextLink == nil || len(*p.current.BastionHostListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (me TxsdCounterSimpleContentExtensionType) IsHost() bool { return me.String() == \"host\" }", "func (o *PaginationProperties) GetPageOk() (*string, bool) {\n\tif o == nil || o.Page == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Page, true\n}", "func (p *ManagementClientGetBastionShareableLinkPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.BastionShareableLinkListResult.NextLink == nil || len(*p.current.BastionShareableLinkListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.getBastionShareableLinkHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (c cell) IsHyperLink() bool {\n\t_, ok := c.contentHandler.(*HyperLink)\n\treturn ok\n}", "func (c *Collection) IsPostsCollection() bool { return c.Name == postsName }", "func (o *BookmarkRunNoContent) IsRedirect() bool {\n\treturn false\n}", "func (r ResourcePage) IsEmpty() (bool, error) {\n\tif r.StatusCode == 204 {\n\t\treturn true, nil\n\t}\n\n\tresources, err := ExtractResources(r)\n\treturn len(resources) == 0, err\n}", "func (*HTML) isOutput() {\n}", "func (p *Page) GetContent() string {\n\treturn p.Content\n}", "func (me TxsdNodeRoleSimpleContentExtensionCategory) IsPrint() bool { return me.String() == \"print\" }", "func (q *QuestionnaireT) IsInNavigation(pageIdx int) bool {\n\n\tif pageIdx < 0 || pageIdx > len(q.Pages)-1 {\n\t\treturn false\n\t}\n\n\tif q.Pages[pageIdx].NoNavigation {\n\t\treturn false\n\t}\n\n\tif fc, ok := naviFuncs[q.Pages[pageIdx].NavigationCondition]; ok {\n\t\treturn fc(q, pageIdx)\n\t}\n\n\treturn true\n}", "func (s *Site) URLPage(urlpath string) (p Document, found bool) {\n\tp, found = s.Routes[urlpath]\n\tif !found {\n\t\tp, found = s.Routes[filepath.Join(urlpath, \"index.html\")]\n\t}\n\tif !found {\n\t\tp, found = s.Routes[filepath.Join(urlpath, \"index.htm\")]\n\t}\n\treturn\n}", "func (ctx *Context) IsIframe() bool {\n\treturn ctx.Query(constant.IframeKey) == \"true\" || ctx.Headers(constant.IframeKey) == \"true\"\n}", "func (me TxsdCounterSimpleContentExtensionType) IsSession() bool { return me.String() == \"session\" }", "func (this *domainController) Page(ctx *context.Context) {\n\tdefer hret.HttpPanic()\n\n\tif !hrpc.BasicAuth(ctx.Request) {\n\t\thret.Error(ctx.ResponseWriter, 403, i18n.NoAuth(ctx.Request))\n\t\treturn\n\t}\n\n\trst, err := groupcache.GetStaticFile(\"DomainPage\")\n\tif err != nil {\n\t\thret.Error(ctx.ResponseWriter, 404, i18n.Get(ctx.Request, \"as_of_date_page_not_exist\"))\n\t\treturn\n\t}\n\n\tctx.ResponseWriter.Write(rst)\n}", "func (r ContainerPage) IsEmpty() (bool, error) {\n\tcontainers, err := ExtractContainers(r)\n\treturn len(containers) == 0, err\n}", "func StreamPage(qw *quicktemplate.Writer, p BasePage) {\n\t//line templates/basepage.qtpl:13\n\tqw.N().S(`\n<html>\n\t<head>\n\t\t<title>`)\n\t//line templates/basepage.qtpl:16\n\tp.StreamTitle(qw)\n\t//line templates/basepage.qtpl:16\n\tqw.N().S(`</title>\n\t</head>\n\t<body>\n\t\t<div>\n\t\t\t<a href=\"/\">return to main page</a>\n\t\t</div>\n\t\t`)\n\t//line templates/basepage.qtpl:22\n\tp.StreamBody(qw)\n\t//line templates/basepage.qtpl:22\n\tqw.N().S(`\n\t</body>\n</html>\n`)\n//line templates/basepage.qtpl:25\n}", "func (p *StoragesClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.StorageResourceCollection.NextLink == nil || len(*p.current.StorageResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (*offsetPageInfoImpl) HasNextPage(p graphql.ResolveParams) (bool, error) {\n\tpage := p.Source.(offsetPageInfo)\n\treturn (page.offset + page.limit) < page.totalCount, nil\n}", "func (p *Pagination) HasOtherPages() bool {\n\treturn p.HasPrev() || p.HasNext()\n}", "func (p *ListPagesByContactPaginator) HasMorePages() bool {\n\treturn p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)\n}", "func (p *TestPager) Check() (bool, error) {\n return false, nil\n}", "func (p *ListTestCasesPaginator) HasMorePages() bool {\n\treturn p.firstPage || p.nextToken != nil\n}", "func (me TpubStatusInt) IsPubmed() bool { return me.String() == \"pubmed\" }", "func (p *Paginator) Page() int {\n\tif p.page != 0 {\n\t\treturn p.page\n\t}\n\tif p.Request.Form == nil {\n\t\tp.Request.ParseForm()\n\t}\n\tp.page, _ = strconv.Atoi(p.Request.Form.Get(\"p\"))\n\tif p.page > p.PageNums() {\n\t\tp.page = p.PageNums()\n\t}\n\tif p.page <= 0 {\n\t\tp.page = 1\n\t}\n\treturn p.page\n}", "func (ctx *Context) IsPost() bool {\r\n\treturn ctx.Is(\"POST\")\r\n}", "func (p *ListStepsPaginator) HasMorePages() bool {\n\treturn p.firstPage || p.nextToken != nil\n}", "func (o *GetVersionStagesNoContent) IsRedirect() bool {\n\treturn false\n}", "func (me TxsdCounterSimpleContentExtensionType) IsFlow() bool { return me.String() == \"flow\" }", "func IsHugePageResourceName(name corev1.ResourceName) bool {\n\treturn strings.HasPrefix(string(name), corev1.ResourceHugePagesPrefix)\n}", "func (masterPage *MasterPage) CurrentPage() Page {\n\treturn masterPage.subPages.Top()\n}", "func (p Page) Len() int { return len(p) }", "func (r *Repository) GetHasPages() bool {\n\tif r == nil || r.HasPages == nil {\n\t\treturn false\n\t}\n\treturn *r.HasPages\n}", "func (o *MicrosoftGraphVisualInfo) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *Content) IsDraft() bool {\n\treturn c.Status == CONTENT_STATUS_DRAFT\n}", "func (p *BlobContainersClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.ListContainerItems.NextLink == nil || len(*p.current.ListContainerItems.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (o *Bundles) GetCurrentPage() int32 {\n\tif o == nil || o.CurrentPage == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.CurrentPage\n}", "func (is *MenuPage) WillHide() {\n}", "func (m *Metadata) IsFile() bool {\n\treturn (strings.ToLower(m.Tag) == MetadataTypeFile)\n}", "func (me TxsdRecordPatternSimpleContentExtensionType) IsXpath() bool { return me.String() == \"xpath\" }", "func (o *PaginationProperties) HasNextPage() bool {\n\tif o != nil && o.NextPage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *ManagementClientGetActiveSessionsPager) NextPage(ctx context.Context) bool {\n\tif !p.second {\n\t\tp.second = true\n\t\treturn true\n\t} else if !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.BastionActiveSessionListResult.NextLink == nil || len(*p.current.BastionActiveSessionListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, *p.current.BastionActiveSessionListResult.NextLink)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.getActiveSessionsHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (r *RMFileInfo) PageIterate() (pageNo, pdfPageNo int, inserted, isTemplate bool, reader *io.ReadSeeker) {\n\tpageNo = r.thisPageNo\n\tr.thisPageNo++\n\n\t// if there is only a template, always return the first page\n\tif r.pdfPath == \"\" {\n\t\tpdfPageNo = 0\n\t\tisTemplate = true\n\t\treader = &r.templateReader\n\t\treturn\n\t}\n\n\t// older remarkable bundles don't report inserted pages; ignore\n\thasRedir := func() bool { return len(r.RedirectionPageMap) > 0 }()\n\n\t// return the template if this is an inserted page\n\tif hasRedir && r.RedirectionPageMap[pageNo] == -1 {\n\t\tpdfPageNo = 0\n\t\tinserted = true\n\t\tisTemplate = true\n\t\treader = &r.templateReader\n\t\treturn\n\t}\n\n\t// remaining target is the annotated file\n\treader = &r.pdfReader\n\n\t// if the annotated pdf has inserted pages, calculate the offset of\n\t// the original pdf to use\n\tif hasRedir && r.PageCount != r.OriginalPageCount {\n\t\tpdfPageNo = pageNo\n\t\tfor i := 0; i <= pageNo; i++ {\n\t\t\tif r.RedirectionPageMap[i] == -1 {\n\t\t\t\tpdfPageNo--\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// fall through: the annotated pdf has no inserted pages\n\tpdfPageNo = pageNo\n\treturn\n\n}", "func (o *FileDto) HasContent() bool {\n\tif o != nil && o.Content != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *ColumnChunkMetaData) HasDictionaryPage() bool {\n\treturn c.columnMeta.IsSetDictionaryPageOffset()\n}" ]
[ "0.8182451", "0.72458345", "0.6284937", "0.62021935", "0.6069874", "0.5863453", "0.5849004", "0.5813375", "0.5769847", "0.57443935", "0.5733453", "0.57127947", "0.56711227", "0.5647718", "0.5588009", "0.55775696", "0.55400574", "0.553223", "0.55277514", "0.5482119", "0.5480724", "0.5475604", "0.5438447", "0.5397574", "0.53849566", "0.5368285", "0.535076", "0.52992684", "0.529924", "0.5244348", "0.520858", "0.5174433", "0.51427084", "0.5120175", "0.5096488", "0.50958157", "0.5074591", "0.5064051", "0.50515974", "0.50464004", "0.5041564", "0.5030359", "0.50188375", "0.5003556", "0.49948055", "0.49636385", "0.4936882", "0.49321434", "0.49127424", "0.48978177", "0.48937938", "0.4887442", "0.48770073", "0.48761925", "0.48748463", "0.4871288", "0.48700267", "0.4869964", "0.48631534", "0.48621634", "0.4858934", "0.48565283", "0.48529318", "0.4843857", "0.4837699", "0.48203316", "0.48202932", "0.4815682", "0.48112497", "0.48078084", "0.4803781", "0.4800516", "0.4787012", "0.47759795", "0.47593257", "0.47584662", "0.47579843", "0.47579294", "0.4754432", "0.4750444", "0.47486192", "0.4747975", "0.4741044", "0.4731108", "0.47275096", "0.47207075", "0.47187707", "0.47118792", "0.4702171", "0.47021416", "0.47015458", "0.46936926", "0.46912372", "0.46844232", "0.46820432", "0.46819338", "0.46794716", "0.46737614", "0.46722847", "0.46692005" ]
0.8657112
0
IsTrashed return true if content is trashed
func (c *Content) IsTrashed() bool { return c.Status == CONTENT_STATUS_TRASHED }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *TrashStructureApplication) HasTrashed() bool {\n\tif o != nil && !IsNil(o.Trashed) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TrashStructureApplication) GetTrashed() bool {\n\tif o == nil || IsNil(o.Trashed) {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Trashed\n}", "func (o *TrashStructureApplication) GetTrashedOk() (*bool, bool) {\n\tif o == nil || IsNil(o.Trashed) {\n\t\treturn nil, false\n\t}\n\treturn o.Trashed, true\n}", "func (o *TrashStructureApplication) SetTrashed(v bool) {\n\to.Trashed = &v\n}", "func ItemTrashed(r *provider.DeleteResponse, req *provider.DeleteRequest, spaceOwner, executant *user.UserId) events.ItemTrashed {\n\topaqueID := utils.ReadPlainFromOpaque(r.Opaque, \"opaque_id\")\n\treturn events.ItemTrashed{\n\t\tSpaceOwner: spaceOwner,\n\t\tExecutant: executant,\n\t\tRef: req.Ref,\n\t\tID: &provider.ResourceId{\n\t\t\tStorageId: req.Ref.GetResourceId().GetStorageId(),\n\t\t\tSpaceId: req.Ref.GetResourceId().GetSpaceId(),\n\t\t\tOpaqueId: opaqueID,\n\t\t},\n\t\tTimestamp: utils.TSNow(),\n\t}\n}", "func (e *Entry) IsDeleted() bool {\n\treturn e.Latest().GetTombstone()\n}", "func (me TxsdSpace) IsPreserve() bool { return me.String() == \"preserve\" }", "func (s *Subtitle) IsDeleted() bool {\n\treturn s.Num == -1\n}", "func (d dynamicSystemView) Tainted() bool {\n\treturn d.mountEntry.Tainted\n}", "func (m *UserModel) WithTrashed() *UserModel {\n\treturn m.WithoutGlobalScopes(\"soft_delete\")\n}", "func (obj *InstallPhase) IsDeleted() bool {\n\treturn obj.GetDeletionTimestamp() != nil\n}", "func (*TruncateTable) IsTemporary() bool {\n\treturn false\n}", "func (e *ExternalService) IsDeleted() bool { return !e.DeletedAt.IsZero() }", "func (s *shard) IsFlushing() bool { return s.isFlushing.Load() }", "func (s *shard) IsFlushing() bool { return s.isFlushing.Load() }", "func (m *Model) IsSoftDelete() bool {\n\treturn m.SoftDelete\n}", "func (obj *ECDSCluster) IsDeleted() bool {\n\treturn obj.GetDeletionTimestamp() != nil\n}", "func IsObjectShardingTable(tableName string) bool {\n\tif IsObjectInstShardingTable(tableName) {\n\t\treturn true\n\t}\n\treturn IsObjectInstAsstShardingTable(tableName)\n}", "func (m *TrxMgr) isProcessingTrx(trx *prototype.SignedTransaction) *TrxEntry {\n\tm.waitingLock.RLock()\n\tdefer m.waitingLock.RUnlock()\n\tm.fetchedLock.RLock()\n\tdefer m.fetchedLock.RUnlock()\n\treturn m.isProcessingNoLock(trx)\n}", "func (m *BlockDeletionMark) ThanosDeletionMark() *metadata.DeletionMark {\n\treturn &metadata.DeletionMark{\n\t\tID: m.ID,\n\t\tVersion: metadata.DeletionMarkVersion1,\n\t\tDeletionTime: m.DeletionTime,\n\t}\n}", "func (fs *AzureDataLakeGen2FileSystem) IsBeingDeleted() bool {\n\treturn !fs.ObjectMeta.DeletionTimestamp.IsZero()\n}", "func IsObjectInstAsstShardingTable(tableName string) bool {\n\t// check object instance association table, cc_InstAsst_{Specifier}_{ObjectID}\n\treturn strings.HasPrefix(tableName, BKObjectInstAsstShardingTablePrefix)\n}", "func (r *Repo) IsDeleted() bool { return !r.DeletedAt.IsZero() }", "func (shelf *Shelf) IsTopWasted() bool {\n\tif shelf.Len() == 0 {\n\t\treturn false\n\t}\n\n\treturn shelf.queue[0].IsWasted(shelf.decayModifier)\n}", "func (level DepthOfMarketLevel) IsDeleted() bool {\n\treturn level.GetQty() == 0\n}", "func (me TxsdIncidentPurpose) IsTraceback() bool { return me.String() == \"traceback\" }", "func (r *DarwinReference) GetToc(tx *bolt.Tx, toc string) (*Toc, bool) {\n\tloc, exists := r.GetTocBucket(tx.Bucket([]byte(\"DarwinToc\")), toc)\n\treturn loc, exists\n}", "func (me TxsdInvoiceType) IsTd() bool { return me.String() == \"TD\" }", "func isTombstone(b []byte) bool {\n\treturn len(b) == markedRevBytesLen && b[markBytePosition] == markTombstone\n}", "func isTombstone(b []byte) bool {\n\treturn len(b) == markedRevBytesLen && b[markBytePosition] == markTombstone\n}", "func (node *CreateTable) IsTemporary() bool {\n\treturn node.Temp\n}", "func (w *writer) IsDrained() bool {\n\tw.mutex.Lock()\n\tdefer w.mutex.Unlock()\n\treturn w.isClosed && w.size == 0\n}", "func (app *Application) HasSeenTranc(trancHash string) bool{\n\tif _, ok := app.seenTranc[trancHash]; ok {\n\t\treturn true;\n\t}\n\treturn false;\n}", "func (me TxsdPaymentMechanism) IsTr() bool { return me.String() == \"TR\" }", "func (tail *Tail) isFileDeleted() bool {\n\treturn false\n}", "func (obj *content) IsTor() bool {\n\treturn obj.tor != nil\n}", "func (obj *transaction) IsTable() bool {\n\treturn obj.table != nil\n}", "func (m *TestModel) IsDeleted() bool {\n\treturn m.Deleted\n}", "func (me TisoLanguageCodes) IsTr() bool { return me.String() == \"TR\" }", "func (m *Metadata) IsDeleted() bool {\n\treturn (strings.ToLower(m.Tag) == MetadataTypeDeleted)\n}", "func (me TxsdComponentTransferFunctionAttributesType) IsTable() bool { return me.String() == \"table\" }", "func (me TxsdMovementStatus) IsT() bool { return me.String() == \"T\" }", "func (gWal *GenericWAL) IsLostOwnership() bool {\n // FIXME (bvk) This is not thread-safe.\n return gWal.lostOwnership\n}", "func (o *StoragePhysicalDisk) HasThermal() bool {\n\tif o != nil && o.Thermal != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *Trie) Stash(rollbackCache bool) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.Root = s.prevRoot\n\tif rollbackCache {\n\t\t// Making a temporary liveCache requires it to be copied, so it's quicker\n\t\t// to just load the cache from DB if a block state root was incorrect.\n\t\ts.db.liveCache = make(map[Hash][][]byte)\n\t\tch := make(chan error, 1)\n\t\ts.loadCache(s.Root, nil, 0, s.TrieHeight, ch)\n\t\terr := <-ch\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\ts.db.liveCache = make(map[Hash][][]byte)\n\t}\n\ts.db.updatedNodes = make(map[Hash][][]byte)\n\t// also stash past tries created by Atomic update\n\tfor i := len(s.pastTries) - 1; i >= 0; i-- {\n\t\tif bytes.Equal(s.pastTries[i], s.Root) {\n\t\t\tbreak\n\t\t} else {\n\t\t\t// remove from past tries\n\t\t\ts.pastTries = s.pastTries[:len(s.pastTries)-1]\n\t\t}\n\t}\n\treturn nil\n}", "func (tbl RecordTable) IsTx() bool {\n\treturn tbl.db.IsTx()\n}", "func (t *Testzzz) Deleted() bool {\n\treturn t._deleted\n}", "func (i *MockOtherDataItem) IsDeleted() bool {\n\treturn i.Deleted\n}", "func (dct *DjangoContentType) Deleted() bool {\n\treturn dct._deleted\n}", "func (me TxsdPresentationAttributesTextElementsWritingMode) IsTb() bool { return me.String() == \"tb\" }", "func (s *schedule) IsEnqueueFault() bool {\n\treturn !s.append\n}", "func WasDeleted(o metav1.Object) bool {\n\treturn !o.GetDeletionTimestamp().IsZero()\n}", "func (v *RawWriteCFValue) IsRollback() bool {\n\treturn v.GetWriteType() == WriteTypeRollback\n}", "func (i *Image) SquashedTree() *tree.FileTree {\n\treturn i.Layers[len(i.Layers)-1].SquashedTree\n}", "func TestCheckLeashed(t *testing.T) {\n\terr := initDB()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tm, err := mysql.New(\"localhost\", port, \"root\", password, \"chaosmonkey\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tins, loc, appCfg := testSetup(t)\n\n\ttrm := c.Termination{Instance: ins, Time: time.Now(), Leashed: true}\n\n\t// First check should succeed\n\terr = m.Check(trm, appCfg, endHour, loc)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttrm = c.Termination{Instance: ins, Time: time.Now(), Leashed: false}\n\n\t// Second check should fail\n\terr = m.Check(trm, appCfg, endHour, loc)\n\n\tif err != nil {\n\t\tt.Fatalf(\"Should have allowed an unleashed termination after leashed: %v\", err)\n\t}\n}", "func (me TxsdPresentationAttributesGraphicsDisplay) IsTableRow() bool {\n\treturn me.String() == \"table-row\"\n}", "func (this *KeyspaceTerm) IsUnderHash() bool {\n\treturn (this.property & TERM_UNDER_HASH) != 0\n}", "func (res ExecResult) Crashed() bool {\n\treturn (res.ExitType == Exited && res.ExitCode != 0) || res.ExitType == Signaled\n}", "func (m *FeedMutation) TranscriptCleared() bool {\n\t_, ok := m.clearedFields[feed.FieldTranscript]\n\treturn ok\n}", "func (conn *extHost) isDrained(replySeqNo int64) bool {\n\tconn.lk.RLock()\n\tif conn.state != extHostCloseWrite {\n\t\tconn.lk.RUnlock()\n\t\treturn false\n\t}\n\n\tret := false\n\tif atomic.LoadInt64(&conn.seqNo) == replySeqNo {\n\t\tconn.logger.WithFields(bark.Fields{\n\t\t\t`drainedSeqNo`: replySeqNo,\n\t\t}).Info(\"extent drained completely\")\n\t\tret = true\n\t}\n\n\tconn.lk.RUnlock()\n\treturn ret\n}", "func (me TxsdFeTurbulenceTypeStitchTiles) IsNoStitch() bool { return me.String() == \"noStitch\" }", "func (c *ClusterInstallation) IsDeleted() bool {\n\treturn c.DeleteAt != 0\n}", "func (me TxsdPresentationAttributesGraphicsDisplay) IsTable() bool { return me.String() == \"table\" }", "func (w *worker) isTTDReached(header *model.Header) bool {\n\ttd, ttd := w.chain.GetTd(header.ParentHash, header.Number.Uint64()-1), w.chain.Config().TerminalTotalDifficulty\n\treturn td != nil && ttd != nil && td.Cmp(ttd) >= 0\n}", "func (ss *SuffixSnapshot) isTombstone(value string) bool {\n\treturn IsTombstone(value)\n}", "func (a *_Atom) isHydroxyl() bool {\n\treturn a.atNum == 8 && a.hCount == 1\n}", "func (tttp *TriageTimeTableProvider) Deleted() bool {\n\treturn tttp._deleted\n}", "func (o *TenantWithOfferWeb) HasDeletionTs() bool {\n\tif o != nil && o.DeletionTs != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TComparator) IsDoesNotExist() bool { return me.String() == \"DoesNotExist\" }", "func (me TxsdFeTurbulenceTypeStitchTiles) IsStitch() bool { return me.String() == \"stitch\" }", "func (me TxsdShow) IsEmbed() bool { return me.String() == \"embed\" }", "func (tbl AssociationTable) IsTx() bool {\n\treturn tbl.db.IsTx()\n}", "func IsObjectInstShardingTable(tableName string) bool {\n\t// check object instance table, cc_ObjectBase_{Specifier}_{ObjectID}\n\treturn strings.HasPrefix(tableName, BKObjectInstShardingTablePrefix)\n}", "func DeleteStash(data interface{}) error {\n\tapi, m, err := findDcFromInterface(data)\n\n\tp, ok := m[\"payload\"].(map[string]interface{})\n\tif !ok {\n\t\tlogger.Warningf(\"Could not assert data interface %+v\", data)\n\t\treturn errors.New(\"Could not assert data interface\")\n\t}\n\n\terr = api.DeleteStash(p[\"path\"].(string))\n\tif err != nil {\n\t\tlogger.Warning(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (me TxsdMovementType) IsGc() bool { return me.String() == \"GC\" }", "func (c *Config) IsStash() bool {\n\treturn c.Stash.Server != \"\"\n}", "func (i *MockDataItem) IsDeleted() bool {\n\treturn i.Deleted\n}", "func (e *FileEvent) IsDelete() bool { return (e.flags & EventFlagItemRemoved) == EventFlagItemRemoved}", "func (me TxsdShow) IsEmbed() bool { return me == \"embed\" }", "func (obj *DeletePhase) IsDeleted() bool {\n\treturn obj.GetDeletionTimestamp() != nil\n}", "func (l *Ledger) IsTxInTrunk(txid []byte) bool {\n\tvar blk *pb.InternalBlock\n\tvar err error\n\ttable := l.ConfirmedTable\n\tpbTxBuf, kvErr := table.Get(txid)\n\tif kvErr != nil {\n\t\treturn false\n\t}\n\trealTx := &pb.Transaction{}\n\tpbErr := proto.Unmarshal(pbTxBuf, realTx)\n\tif pbErr != nil {\n\t\tl.xlog.Warn(\"IsTxInTrunk error\", \"txid\", utils.F(txid), \"pbErr\", pbErr)\n\t\treturn false\n\t}\n\tblkInCache, exist := l.blockCache.Get(string(realTx.Blockid))\n\tif exist {\n\t\tblk = blkInCache.(*pb.InternalBlock)\n\t} else {\n\t\tblk, err = l.queryBlock(realTx.Blockid, false)\n\t\tif err != nil {\n\t\t\tl.xlog.Warn(\"IsTxInTrunk error\", \"blkid\", utils.F(realTx.Blockid), \"kvErr\", err)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn blk.InTrunk\n}", "func isMarkableForTermination(nodeInfo *CacheEntry) bool {\n\t// If the last mark was an hour ago, mark again\n\t// Zero value for time.Time is 0001-01-01, so first mark is also executed\n\tlastMarked := nodeInfo.LastMarkedForTermination\n\treturn lastMarked.UTC().Add(time.Hour).Before(time.Now().UTC())\n}", "func (me TxsdPresentationAttributesTextContentElementsDirection) IsLtr() bool {\n\treturn me.String() == \"ltr\"\n}", "func (me TxsdTaxAccountingBasis) IsT() bool { return me.String() == \"T\" }", "func (t *TextBlock) Undo() {\n\tif t.cache.Len() > 0 {\n\t\tt.currentText = t.cache.Pop()\n\t\treturn\n\t}\n\tfmt.Println(\"Cache is empty\")\n}", "func (me TxsdPaymentMechanism) IsTb() bool { return me.String() == \"TB\" }", "func (m *kubePackage) Truth() starlark.Bool { return starlark.True }", "func (r TransactionResult) Reverted() bool {\n\treturn !r.Succeeded()\n}", "func (obj *content) IsNormal() bool {\n\treturn obj.normal != nil\n}", "func (inst *Installer) Aborted() bool {\n\treturn inst.aborted\n}", "func (node *DropTable) IsTemporary() bool {\n\treturn node.Temp\n}", "func (b *base) Deleted() bool { return b.Deletedx }", "func (tbl DbCompoundTable) IsTx() bool {\n\t_, ok := tbl.db.(*sql.Tx)\n\treturn ok\n}", "func (d *Deletable) IsDeleted() bool {\n\treturn d.Deleted\n}", "func StockKeepingUnitContentExists(exec boil.Executor, iD string) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"stock_keeping_unit_content\\\" where \\\"id\\\"=$1 limit 1)\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, iD)\n\t}\n\trow := exec.QueryRow(sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"db: unable to check if stock_keeping_unit_content exists\")\n\t}\n\n\treturn exists, nil\n}", "func (eth *Backend) Synced() (bool, error) {\n\t// node.SyncProgress will return nil both before syncing has begun and\n\t// after it has finished. In order to discern when syncing has begun,\n\t// check that the best header came in under MaxBlockInterval.\n\tsp, err := eth.node.syncProgress(eth.rpcCtx)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif sp != nil {\n\t\treturn false, nil\n\t}\n\tbh, err := eth.node.bestHeader(eth.rpcCtx)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\t// Time in the header is in seconds.\n\tnowInSecs := time.Now().Unix() / 1000\n\ttimeDiff := nowInSecs - int64(bh.Time)\n\treturn timeDiff < dexeth.MaxBlockInterval, nil\n}", "func (t *Table) TrickNew() bool {\n\tfor _, c := range t.trick {\n\t\tif c != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (entry *LogEntry) IsActive() bool {\n\treturn !entry.IsRemoved() && !entry.IsDeleted()\n}", "func IsWordOnTimer(m *discordgo.Message, db *sql.DB) bool {\n\ttokens := strings.Split(m.Content, \" \")\n\tfor i, v := range removeableWordsMap {\n\t\tfor j := 0; j < len(tokens); j++ {\n\t\t\tif _, ok := removeableWordsMap[i]; !ok {\n\t\t\t\tfmt.Println(\"[ERROR] Attempt to access index out of bounds during removable search\")\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tif strings.EqualFold(v, tokens[j]) {\n\t\t\t\tfmt.Printf(\"\\n[LOG] Message queued to be erased: %s\", m.Content)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func (d *cephobject) Unmount() (bool, error) {\n\treturn false, nil\n}" ]
[ "0.67762494", "0.67077285", "0.6215999", "0.5996488", "0.5649976", "0.533048", "0.53276575", "0.5198325", "0.5166646", "0.51392007", "0.50936794", "0.5033882", "0.49881992", "0.49692014", "0.49692014", "0.48998713", "0.48027912", "0.4781283", "0.47776878", "0.47514683", "0.47429937", "0.47319824", "0.47279334", "0.47137713", "0.4677803", "0.46655387", "0.4649003", "0.46465757", "0.46401623", "0.46401623", "0.46373236", "0.4635405", "0.46341896", "0.46334904", "0.46330032", "0.46299037", "0.4611835", "0.45998433", "0.45819205", "0.4575252", "0.4571637", "0.45656866", "0.4563601", "0.45481983", "0.45433235", "0.45377016", "0.4531389", "0.45218444", "0.45205927", "0.45170334", "0.45122534", "0.45049843", "0.44835368", "0.44722706", "0.4469306", "0.44605055", "0.44549173", "0.44531202", "0.44494212", "0.44492775", "0.44424692", "0.44337776", "0.44326153", "0.4432037", "0.44303653", "0.44301748", "0.44287777", "0.44280794", "0.44235265", "0.44167376", "0.44094655", "0.44062486", "0.4401107", "0.43971556", "0.43896347", "0.43895197", "0.43848646", "0.4384284", "0.43731534", "0.43716547", "0.43649918", "0.4359489", "0.4350639", "0.4341427", "0.43349752", "0.43297118", "0.43195736", "0.43173316", "0.43151826", "0.43134448", "0.43088254", "0.43029377", "0.4291288", "0.4284965", "0.42823786", "0.42798534", "0.42785868", "0.42736137", "0.42653334", "0.42596042" ]
0.8638603
0
IsDraft return true if content is draft
func (c *Content) IsDraft() bool { return c.Status == CONTENT_STATUS_DRAFT }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *ModelStatus) IsDraft() bool {\n\treturn m.Status == Draft\n}", "func IsDraft(source string) bool {\n\treturn strings.Contains(filepath.Base(filepath.Dir(source)), \"drafts\")\n}", "func (r *RepositoryRelease) GetDraft() bool {\n\tif r == nil || r.Draft == nil {\n\t\treturn false\n\t}\n\treturn *r.Draft\n}", "func Draft(v bool) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldEQ(FieldDraft, v))\n}", "func (c *Client) ShowDraft(ctx context.Context, path string, contest *int, contestSlug *string, page *int, pageSize *int, sort *string, task *int, taskSlug *string, user *int) (*http.Response, error) {\n\treq, err := c.NewShowDraftRequest(ctx, path, contest, contestSlug, page, pageSize, sort, task, taskSlug, user)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Client.Do(ctx, req)\n}", "func (u *User) IsEditor() bool {\n\treturn u.UserGroupID == EDITOR\n}", "func (c *Client) GetDraft(ctx context.Context, path string) (*http.Response, error) {\n\treq, err := c.NewGetDraftRequest(ctx, path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Client.Do(ctx, req)\n}", "func (obj *content) IsNormal() bool {\n\treturn obj.normal != nil\n}", "func (s *Service) ChangeDraft(ctx context.Context, draftID, companyID string, post *job.Posting) (string, error) {\n\tspan := s.tracer.MakeSpan(ctx, \"ChangeDraft\")\n\tdefer span.Finish()\n\n\t// get userID\n\tuserID, err := s.authRPC.GetUserID(ctx)\n\tif err != nil {\n\t\ts.tracer.LogError(span, err)\n\t\treturn \"\", err\n\t}\n\n\terr = post.SetCompanyID(companyID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = post.SetID(draftID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// check admin level\n\tallowed := s.checkAdminLevel(\n\t\tctx,\n\t\tpost.GetCompanyID(),\n\t\tcompanyadmin.AdminLevelAdmin,\n\t\tcompanyadmin.AdminLevelJob,\n\t)\n\tif !allowed {\n\t\treturn \"\", errors.New(\"not_allowed\")\n\t}\n\n\tpost.SetUserID(userID)\n\t// id := post.GenerateID()\n\n\tif !post.JobMetadata.Anonymous {\n\t\tpost.CompanyDetails = &company.Details{\n\t\t\t// TODO: company avatar, URL, Industry, subindustry\n\t\t}\n\t\tpost.CompanyDetails.SetCompanyID(post.GetCompanyID())\n\t}\n\n\tpost.CreatedAt = time.Now()\n\n\tpost.Status = job.StatusDraft\n\t// post.JobPriority = post.JobMetadata.JobPlan.GetPriority()\n\n\t// if post.JobDetails.SalaryMin > 0 && post.JobDetails.SalaryInterval != \"\" {\n\t// \tpost.NormalizedSalaryMin = float32(post.JobDetails.SalaryMin) / float32(post.JobDetails.SalaryInterval.GetHours()) // TODO also convert currency\n\t// }\n\n\t// if post.JobDetails.SalaryMax > 0 && post.JobDetails.SalaryInterval != \"\" {\n\t// \tpost.NormalizedSalaryMax = float32(post.JobDetails.SalaryMax) / float32(post.JobDetails.SalaryInterval.GetHours()) // TODO also convert currency\n\t// }\n\n\terr = s.jobs.UpdateJobPosting(ctx, post)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn post.GetID(), nil\n}", "func (s *MessagesSendMessageRequest) GetClearDraft() (value bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Flags.Has(7)\n}", "func (m *Member) IsPublished() bool { return m.Published }", "func (msgr *Messenger) IsEditable(id string) bool {\n\ti, err := message.ParseID(id)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tmsgr.messageMutex.Lock()\n\tdefer msgr.messageMutex.Unlock()\n\n\tm, ok := msgr.messages[i]\n\tif ok {\n\t\t// Editable if same author.\n\t\treturn m.Author().Name().String() == msgr.channel.user.String()\n\t}\n\n\treturn false\n}", "func (e PartialContent) IsPartialContent() {}", "func (me TPubStatusUnion4) IsRevised() bool { return me.String() == \"revised\" }", "func (me THITReviewStatus) IsMarkedForReview() bool { return me.String() == \"MarkedForReview\" }", "func ShowDraftPath() string {\n\n\treturn fmt.Sprintf(\"/sao/v1/drafts/\")\n}", "func (m *MailTips) GetIsModerated()(*bool) {\n val, err := m.GetBackingStore().Get(\"isModerated\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (rc *BypassRevisionCache) Peek(docID, revID string, copyType BodyCopyType) (docRev DocumentRevision, found bool) {\n\treturn DocumentRevision{}, false\n}", "func (c *Content) IsAttachment() bool {\n\treturn c.Type == CONTENT_TYPE_ATTACHMENT\n}", "func WhereDraft(q *query.Query) *query.Query {\n\treturn q.Where(\"status = ?\", Draft)\n}", "func (s *Sender) saveDraft(ctx context.Context, req *tg.MessagesSaveDraftRequest) error {\n\t_, err := s.raw.MessagesSaveDraft(ctx, req)\n\treturn err\n}", "func (m *ServiceUpdateMessageViewpoint) GetIsArchived()(*bool) {\n val, err := m.GetBackingStore().Get(\"isArchived\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (m *ModelStatus) IsPublished() bool {\n\treturn m.Status >= Published // NB >=\n}", "func (a *DraftsApiService) EditDraftExecute(r ApiEditDraftRequest) (JsonSuccess, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue JsonSuccess\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DraftsApiService.EditDraft\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/drafts/{draft_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"draft_id\"+\"}\", _neturl.PathEscape(parameterToString(r.draftId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.draft == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"draft is required and must be specified\")\n\t}\n\n\tlocalVarQueryParams.Add(\"draft\", parameterToString(*r.draft, \"\"))\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\treq, err := a.client.prepareRequest(r.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(req)\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\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\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 == 404 {\n\t\t\tvar v JsonError\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 (s *Service) SaveDraft(ctx context.Context, companyID string, post *job.Posting) (string, error) {\n\tspan := s.tracer.MakeSpan(ctx, \"SaveDraft\")\n\tdefer span.Finish()\n\n\t// get userID\n\tuserID, err := s.authRPC.GetUserID(ctx)\n\tif err != nil {\n\t\ts.tracer.LogError(span, err)\n\t\treturn \"\", err\n\t}\n\n\t// check admin level\n\tallowed := s.checkAdminLevel(\n\t\tctx,\n\t\tcompanyID,\n\t\tcompanyadmin.AdminLevelAdmin,\n\t\tcompanyadmin.AdminLevelJob,\n\t)\n\tif !allowed {\n\t\treturn \"\", errors.New(\"not_allowed\")\n\t}\n\n\tpost.SetCompanyID(companyID)\n\tpost.SetUserID(userID)\n\tid := post.GenerateID()\n\n\tif !post.JobMetadata.Anonymous {\n\t\tpost.CompanyDetails = &company.Details{\n\t\t\t// TODO: company avatar, URL, Industry, subindustry\n\t\t}\n\t\tpost.CompanyDetails.SetCompanyID(companyID)\n\t}\n\n\tpost.CreatedAt = time.Now()\n\n\tpost.Status = job.StatusDraft\n\t// post.JobPriority = post.JobMetadata.JobPlan.GetPriority()\n\n\t// if post.JobDetails.SalaryMin > 0 && post.JobDetails.SalaryInterval != \"\" {\n\t// \tpost.NormalizedSalaryMin = float32(post.JobDetails.SalaryMin) / float32(post.JobDetails.SalaryInterval.GetHours()) // TODO also convert currency\n\t// }\n\n\t// if post.JobDetails.SalaryMax > 0 && post.JobDetails.SalaryInterval != \"\" {\n\t// \tpost.NormalizedSalaryMax = float32(post.JobDetails.SalaryMax) / float32(post.JobDetails.SalaryInterval.GetHours()) // TODO also convert currency\n\t// }\n\n\terr = s.jobs.PostJob(ctx, post)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn id, nil\n}", "func (u *Update) IsEdited() bool {\n\treturn u.EditedMessage != nil\n}", "func (t *Link) IsPreviewObject(index int) (ok bool) {\n\treturn t.preview[index].Object != nil\n\n}", "func (o RunBookOutput) Draft() RunBookDraftPtrOutput {\n\treturn o.ApplyT(func(v *RunBook) RunBookDraftPtrOutput { return v.Draft }).(RunBookDraftPtrOutput)\n}", "func isValidPatchDocument(document Document) bool {\n var existingContent = false\n\n if document.Content != nil {\n existingContent = document.Content.Header != nil || document.Content.Data != nil\n }\n\n return existingContent || document.Title != nil || document.Signee != nil\n}", "func (_BaseContent *BaseContentCaller) CanEdit(opts *bind.CallOpts) (bool, error) {\n\tvar out []interface{}\n\terr := _BaseContent.contract.Call(opts, &out, \"canEdit\")\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "func (body *Body) IsOpen() bool {\n\treturn body.isOpen\n}", "func (s *Subtitle) IsDeleted() bool {\n\treturn s.Num == -1\n}", "func Draft(individuals <-chan individual) <-chan individual {\r\n\tout := make(chan individual)\r\n\tgo func() {\r\n\t\tdefer close(out)\r\n\t\tfor draft := range individuals {\r\n\t\t\tif draft.Age >= 18 && draft.Age <= 35 {\r\n\t\t\t\tout <- draft\r\n\t\t\t}\r\n\t\t}\r\n\t}()\r\n\treturn out\r\n}", "func (me THITStatus) IsReviewable() bool { return me.String() == \"Reviewable\" }", "func isCompleteDocument(document Document) bool {\n if document.Content != nil {\n return document.Title != nil && document.Content.Header != nil &&\n document.Content.Data != nil && document.Signee != nil\n } else {\n return false\n }\n}", "func (r *Repo) IsDeleted() bool { return !r.DeletedAt.IsZero() }", "func DraftEQ(v bool) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldEQ(FieldDraft, v))\n}", "func (_BaseContentType *BaseContentTypeCaller) CanEdit(opts *bind.CallOpts) (bool, error) {\n\tvar out []interface{}\n\terr := _BaseContentType.contract.Call(opts, &out, \"canEdit\")\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "func GetBlogPostDraftCount(ctx context.Context) (int, error) {\n\tquery := datastore.NewQuery(blogPostVersionKind).\n\t\tProject(\"PostID\").\n\t\tDistinct().\n\t\tOrder(\"PostID\").\n\t\tOrder(\"-Published\").\n\t\tOrder(\"-DateCreated\").\n\t\tFilter(\"Published=\", false)\n\n\tvar x []BlogPostVersion\n\tkeys, err := query.GetAll(ctx, &x)\n\n\treturn len(keys), err\n}", "func (m *BookingBusiness) GetIsPublished()(*bool) {\n val, err := m.GetBackingStore().Get(\"isPublished\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (m *RetentionLabelSettings) GetIsContentUpdateAllowed()(*bool) {\n val, err := m.GetBackingStore().Get(\"isContentUpdateAllowed\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (me TPubStatusUnion6) IsRetracted() bool { return me.String() == \"retracted\" }", "func (pr LocalPackageReference) IsPreview() bool {\n\treturn ContainsPreviewVersionLabel(strings.ToLower(pr.apiVersion))\n}", "func (me TpubStatusInt) IsPubmed() bool { return me.String() == \"pubmed\" }", "func (me TAttlistAuthorListType) IsEditors() bool { return me.String() == \"editors\" }", "func (obj *content) IsTor() bool {\n\treturn obj.tor != nil\n}", "func (r *BackupItem) IsArchived() bool {\n\treturn r.Status&StatusArchived == StatusArchived\n}", "func (r *BackupItem) IsArchived() bool {\n\treturn r.Status&StatusArchived == StatusArchived\n}", "func (o *ViewMilestone) HasIsDeleted() bool {\n\tif o != nil && o.IsDeleted != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (e *Entry) IsDeleted() bool {\n\treturn e.Latest().GetTombstone()\n}", "func (_BaseContentSpace *BaseContentSpaceCaller) CanEdit(opts *bind.CallOpts) (bool, error) {\n\tvar out []interface{}\n\terr := _BaseContentSpace.contract.Call(opts, &out, \"canEdit\")\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "func (c *Content) IsTrashed() bool {\n\treturn c.Status == CONTENT_STATUS_TRASHED\n}", "func (_options *DeleteConfigOptions) SetDraftOnly(draftOnly bool) *DeleteConfigOptions {\n\t_options.DraftOnly = core.BoolPtr(draftOnly)\n\treturn _options\n}", "func (t *Link) IsPreviewLink(index int) (ok bool) {\n\treturn t.preview[index].Link != nil\n\n}", "func (v *Version) IsRevision() bool {\n\treturn v.isRevision\n}", "func (o *ViewMilestone) GetIsDeleted() bool {\n\tif o == nil || o.IsDeleted == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsDeleted\n}", "func (me TAttlistCommentsCorrectionsRefType) IsRepublishedIn() bool {\n\treturn me.String() == \"RepublishedIn\"\n}", "func (me TAttlistCommentsCorrectionsRefType) IsRepublishedFrom() bool {\n\treturn me.String() == \"RepublishedFrom\"\n}", "func (_BaseContentFactoryExt *BaseContentFactoryExtTransactor) IsContract(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) {\n\treturn _BaseContentFactoryExt.contract.Transact(opts, \"isContract\", addr)\n}", "func (rev PlannerRevision) IsInitial() bool { return rev.value == \"\" }", "func (mt *ComJossemargtSaoDraft) Validate() (err error) {\n\n\tif mt.Href == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"href\"))\n\t}\n\tif ok := goa.ValidatePattern(`[_a-zA-Z0-9\\-]+`, mt.ContestSlug); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.contestSlug`, mt.ContestSlug, `[_a-zA-Z0-9\\-]+`))\n\t}\n\tif ok := goa.ValidatePattern(`[_a-zA-Z0-9\\-]+`, mt.TaskSlug); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.taskSlug`, mt.TaskSlug, `[_a-zA-Z0-9\\-]+`))\n\t}\n\treturn\n}", "func (mt *ComJossemargtSaoDraft) Validate() (err error) {\n\n\tif mt.Href == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"href\"))\n\t}\n\tif ok := goa.ValidatePattern(`[_a-zA-Z0-9\\-]+`, mt.ContestSlug); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.contestSlug`, mt.ContestSlug, `[_a-zA-Z0-9\\-]+`))\n\t}\n\tif ok := goa.ValidatePattern(`[_a-zA-Z0-9\\-]+`, mt.TaskSlug); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.taskSlug`, mt.TaskSlug, `[_a-zA-Z0-9\\-]+`))\n\t}\n\treturn\n}", "func (m *sdt) IsEffective() *bool {\n\treturn m.isEffectiveField\n}", "func (s *Space) IsArchived() bool {\n\treturn s.Type == SPACE_STATUS_ARCHIVED\n}", "func (ref *UIElement) IsEdited() bool {\n\tret, _ := ref.BoolAttr(EditedAttribute)\n\treturn ret\n}", "func (c *Content) IsPage() bool {\n\treturn c.Type == CONTENT_TYPE_PAGE\n}", "func (s *TradeStage) IsDeletedOrClosed() bool {\n\tdelReq, errs := s.GetLastDeletionRequest()\n\tif errs == nil && delReq.Status == ApprovalApproved {\n\t\treturn true\n\t}\n\tcloseReq, errs := s.GetLastClosingRequest()\n\treturn errs == nil && closeReq.Status == ApprovalApproved\n}", "func ReadPostsDraft() []models.PostsModel {\n\tdb, err := driver.Connect()\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tdefer db.Close()\n\n\tvar result []models.PostsModel\n\n\titems, err := db.Query(\"select id, title, content, category, status from posts where status='Draft'\")\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"%T\\n\", items)\n\n\tfor items.Next() {\n\t\tvar each = models.PostsModel{}\n\t\tvar err = items.Scan(&each.Id, &each.Title, &each.Content, &each.Category, &each.Status)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn nil\n\t\t}\n\n\t\tresult = append(result, each)\n\n\t}\n\n\tif err = items.Err(); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\treturn result\n}", "func (me THITReviewStatus) IsNotReviewed() bool { return me.String() == \"NotReviewed\" }", "func (c *Client) NewShowDraftRequest(ctx context.Context, path string, contest *int, contestSlug *string, page *int, pageSize *int, sort *string, task *int, taskSlug *string, user *int) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\tvalues := u.Query()\n\tif contest != nil {\n\t\ttmp32 := strconv.Itoa(*contest)\n\t\tvalues.Set(\"contest\", tmp32)\n\t}\n\tif contestSlug != nil {\n\t\tvalues.Set(\"contest_slug\", *contestSlug)\n\t}\n\tif page != nil {\n\t\ttmp33 := strconv.Itoa(*page)\n\t\tvalues.Set(\"page\", tmp33)\n\t}\n\tif pageSize != nil {\n\t\ttmp34 := strconv.Itoa(*pageSize)\n\t\tvalues.Set(\"page_size\", tmp34)\n\t}\n\tif sort != nil {\n\t\tvalues.Set(\"sort\", *sort)\n\t}\n\tif task != nil {\n\t\ttmp35 := strconv.Itoa(*task)\n\t\tvalues.Set(\"task\", tmp35)\n\t}\n\tif taskSlug != nil {\n\t\tvalues.Set(\"task_slug\", *taskSlug)\n\t}\n\tif user != nil {\n\t\ttmp36 := strconv.Itoa(*user)\n\t\tvalues.Set(\"user\", tmp36)\n\t}\n\tu.RawQuery = values.Encode()\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "func (me TAttlistMedlineCitationStatus) IsInDataReview() bool { return me.String() == \"In-Data-Review\" }", "func (r *RPC) ArtDraft(c context.Context, arg *model.ArgAidMid, res *model.Draft) (err error) {\n\tvar v *model.Draft\n\tif v, err = r.s.ArtDraft(c, arg.Aid, arg.Mid); err == nil && v != nil {\n\t\t*res = *v\n\t}\n\treturn\n}", "func (me TReviewActionStatus) IsIntended() bool { return me.String() == \"Intended\" }", "func (o *WebModifyAccepted) IsSuccess() bool {\n\treturn true\n}", "func (me TPubStatusUnion2) IsEpublish() bool { return me.String() == \"epublish\" }", "func (entry *UtxoEntry) isModified() bool {\n\treturn entry.state&utxoStateModified == utxoStateModified\n}", "func (me TxsdImpactSimpleContentExtensionType) IsAdmin() bool { return me.String() == \"admin\" }", "func (a *DraftsApiService) DeleteDraftExecute(r ApiDeleteDraftRequest) (JsonSuccess, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue JsonSuccess\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DraftsApiService.DeleteDraft\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/drafts/{draft_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"draft_id\"+\"}\", _neturl.PathEscape(parameterToString(r.draftId, \"\")), -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/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.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(req)\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\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\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 == 404 {\n\t\t\tvar v JsonError\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 (m *Model) IsSoftDelete() bool {\n\treturn m.SoftDelete\n}", "func (me TpubStatusInt) IsPremedline() bool { return me.String() == \"premedline\" }", "func Show(w http.ResponseWriter, r *http.Request) {\n\n\tuser := utils.GetAuthenticatedUser(r)\n\n\tif !user.Permissions.Glsa.View {\n\t\tauthentication.AccessDenied(w, r)\n\t\treturn\n\t}\n\n\tvar drafts []*models.Glsa\n\terr := user.CanAccess(connection.DB.Model(&drafts).\n\t\tWhere(\"type = ?\", \"draft\").\n\t\tRelation(\"Bugs\").\n\t\tRelation(\"Creator\").\n\t\tRelation(\"Comments\")).\n\t\tSelect()\n\n\tif err != nil {\n\t\tlogger.Info.Println(\"Error during draft selection\")\n\t\tlogger.Info.Println(err)\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tfor _, draft := range drafts {\n\t\tdraft.ComputeStatus(user)\n\t}\n\n\trenderDraftsTemplate(w, user, drafts)\n}", "func (r *Repository) IsMarkdowned() bool {\n\tif r.isMd != nil {\n\t\treturn *r.isMd\n\t}\n\tres := stringIsMarkdown(r.FullDescription)\n\tr.isMd = &res\n\treturn res\n}", "func (me TAttlistMedlineCitationStatus) IsPublisher() bool { return me.String() == \"Publisher\" }", "func (w *W3CNode) IsDocument() bool {\n\tparent := w.ParentNode().(*W3CNode)\n\treturn w.ParentNode() != nil && parent.HTMLNode() == w.HTMLNode()\n}", "func (m *TestModel) IsDeleted() bool {\n\treturn m.Deleted\n}", "func (me TpubStatusInt) IsPubmedr() bool { return me.String() == \"pubmedr\" }", "func DraftNEQ(v bool) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldNEQ(FieldDraft, v))\n}", "func (me TAttlistJournalIssueCitedMedium) IsPrint() bool { return me.String() == \"Print\" }", "func (sdk Sdk) IsArchived() bool {\n\treturn sdk.archiveFile() != \"\"\n}", "func (m *Member) IsPrivate() bool { return !m.Published }", "func (ctx *Context) IsPost() bool {\r\n\treturn ctx.Is(\"POST\")\r\n}", "func (a *DraftsApiService) GetDraftsExecute(r ApiGetDraftsRequest) (JsonSuccess, *_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 JsonSuccess\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DraftsApiService.GetDrafts\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/drafts\"\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\treq, err := a.client.prepareRequest(r.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(req)\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\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\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\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 draftTx(utxos []*Utxo, payToAddresses []*PayToAddress, opReturns []OpReturnData,\n\tprivateKey *bsvec.PrivateKey, standardRate, dataRate *bt.Fee) (uint64, error) {\n\n\t// Create the \"Draft tx\"\n\ttx, err := CreateTx(utxos, payToAddresses, opReturns, privateKey)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Calculate the fees for the \"Draft tx\"\n\t// todo: hack to add 1 extra sat - ensuring that fee is over the minimum with rounding issues in WOC and other systems\n\tfee := CalculateFeeForTx(tx, standardRate, dataRate) + 1\n\treturn fee, nil\n}", "func (me TPubStatusUnion3) IsPpublish() bool { return me.String() == \"ppublish\" }", "func (r *Summary) IsAbandoned() bool {\n\treturn r.Request.TargetRef == \"\"\n}", "func (r *Summary) IsOpen() bool {\n\treturn !r.Submitted && !r.IsAbandoned()\n}", "func (me TAttlistMedlineCitationStatus) IsCompleted() bool { return me.String() == \"Completed\" }", "func (me THITStatus) IsReviewing() bool { return me.String() == \"Reviewing\" }", "func (me TReviewActionStatus) IsFailed() bool { return me.String() == \"Failed\" }", "func (resp *ActionExportCreateResponse) IsBlocking() bool {\n\treturn resp.Response.Meta != nil && resp.Response.Meta.ActionStateId > 0\n}" ]
[ "0.76661915", "0.72118825", "0.62594146", "0.60783345", "0.57742465", "0.5612218", "0.5590993", "0.5470714", "0.53782576", "0.5354119", "0.5348146", "0.5320405", "0.5315136", "0.52890354", "0.5246484", "0.52413845", "0.52356356", "0.5234108", "0.52093893", "0.52065074", "0.5161753", "0.51418304", "0.5128882", "0.5114721", "0.5107894", "0.5078718", "0.5057712", "0.50510424", "0.50496167", "0.5043748", "0.50139475", "0.49958795", "0.49907595", "0.4965508", "0.49383593", "0.49336424", "0.4914338", "0.4912065", "0.49115703", "0.4910062", "0.49097976", "0.4906811", "0.4900717", "0.48857707", "0.4882155", "0.48783454", "0.48680982", "0.48680982", "0.48652562", "0.48512384", "0.48376867", "0.48307", "0.4826266", "0.48229787", "0.48197457", "0.47974092", "0.47838768", "0.47806984", "0.4777947", "0.4774078", "0.47677866", "0.47677866", "0.47642863", "0.47544014", "0.475215", "0.47409853", "0.47405693", "0.47355437", "0.47354683", "0.47267443", "0.47153732", "0.470505", "0.47036615", "0.4678246", "0.4677655", "0.46551028", "0.46540335", "0.4653721", "0.46507987", "0.46480048", "0.46427518", "0.46366692", "0.46345145", "0.46338516", "0.46308988", "0.4622108", "0.46202976", "0.46148282", "0.46119213", "0.46077845", "0.4607412", "0.46053672", "0.45966354", "0.45930216", "0.4585301", "0.45849982", "0.45830736", "0.45781296", "0.45733798", "0.45685565" ]
0.86880225
0
IsGlobal return true if space is global
func (s *Space) IsGlobal() bool { return s.Type == SPACE_TYPE_GLOBAL }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (TypesObject) IsGlobal() bool { return boolResult }", "func (o *RiskRulesListAllOfData) HasIsGlobal() bool {\n\tif o != nil && !IsNil(o.IsGlobal) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsObjectGlobal(obj *metav1.ObjectMeta) bool {\n\tif obj.Annotations == nil {\n\t\treturn false\n\t}\n\n\tif obj.Annotations[util.GlobalLabel] == \"true\" {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RiskRulesListAllOfData) GetIsGlobal() bool {\n\tif o == nil || IsNil(o.IsGlobal) {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsGlobal\n}", "func Global() Scope {\n\treturn globalScope\n}", "func FieldNameIsGlobal(name string) bool {\n\tfor _, n := range GlobalFieldNames() {\n\t\tif n == name {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (o *RiskRulesListAllOfData) SetIsGlobal(v bool) {\n\to.IsGlobal = &v\n}", "func (t *Table) HasGlobalTs() bool {\n\treturn t.globalTs != 0\n}", "func (o *RiskRulesListAllOfData) GetIsGlobalOk() (*bool, bool) {\n\tif o == nil || IsNil(o.IsGlobal) {\n\t\treturn nil, false\n\t}\n\treturn o.IsGlobal, true\n}", "func getGlobalInfo() (globalInfo map[string]interface{}) {\n\tglobalInfo = map[string]interface{}{/*\n\t\t\"isDistXL\": globalIsDistXL,\n\t\t\"isXL\": globalIsXL,\n\t\t\"isBrowserEnabled\": globalIsBrowserEnabled,\n\t\t\"isWorm\": globalWORMEnabled,\n\t\t\"isEnvBrowser\": globalIsEnvBrowser,\n\t\t\"isEnvCreds\": globalIsEnvCreds,\n\t\t\"isEnvRegion\": globalIsEnvRegion,\n\t\t\"isSSL\": globalIsSSL,\n\t\t\"serverRegion\": globalServerRegion,\n\t\t// Add more relevant global settings here.*/\n\t}\n\n\treturn globalInfo\n}", "func (o *WafDdosSettings) HasGlobalThreshold() bool {\n\tif o != nil && o.GlobalThreshold != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func checkGlobalSet(t *testing.T, expError bool, fabMode, vlans, vxlans string) {\n\tgl := client.Global{\n\t\tName: \"global\",\n\t\tNetworkInfraType: fabMode,\n\t\tVlans: vlans,\n\t\tVxlans: vxlans,\n\t}\n\terr := contivClient.GlobalPost(&gl)\n\tif err != nil && !expError {\n\t\tt.Fatalf(\"Error setting global {%+v}. Err: %v\", gl, err)\n\t} else if err == nil && expError {\n\t\tt.Fatalf(\"Set global {%+v} succeded while expecing error\", gl)\n\t} else if err == nil {\n\t\t// verify global state\n\t\tgotGl, err := contivClient.GlobalGet(\"global\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error getting global object. Err: %v\", err)\n\t\t}\n\n\t\t// verify expected values\n\t\tif gotGl.NetworkInfraType != fabMode || gotGl.Vlans != vlans || gotGl.Vxlans != vxlans {\n\t\t\tt.Fatalf(\"Error Got global state {%+v} does not match expected %s, %s, %s\", gotGl, fabMode, vlans, vxlans)\n\t\t}\n\n\t\t// verify the state created\n\t\tgCfg := &gstate.Cfg{}\n\t\tgCfg.StateDriver = stateStore\n\t\terr = gCfg.Read(\"\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error reading global cfg state. Err: %v\", err)\n\t\t}\n\n\t\tif gCfg.Auto.VLANs != vlans || gCfg.Auto.VXLANs != vxlans {\n\t\t\tt.Fatalf(\"global config Vlan/Vxlan ranges %s/%s are not same as %s/%s\",\n\t\t\t\tgCfg.Auto.VLANs, gCfg.Auto.VXLANs, vlans, vxlans)\n\t\t}\n\n\t\t// verify global oper state\n\t\tgOper := &gstate.Oper{}\n\t\tgOper.StateDriver = stateStore\n\t\terr = gOper.Read(\"\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error reading global oper state. Err: %v\", err)\n\t\t}\n\n\t\t// verify vxlan resources\n\t\tvxlanRsrc := &resources.AutoVXLANCfgResource{}\n\t\tvxlanRsrc.StateDriver = stateStore\n\t\tif err := vxlanRsrc.Read(\"global\"); err != nil {\n\t\t\tt.Fatalf(\"Error reading vxlan resource. Err: %v\", err)\n\t\t}\n\n\t\t// verify vlan resource\n\t\tvlanRsrc := &resources.AutoVLANCfgResource{}\n\t\tvlanRsrc.StateDriver = stateStore\n\t\tif err := vlanRsrc.Read(\"global\"); err != nil {\n\t\t\tt.Fatalf(\"Error reading vlan resource. Err: %v\", err)\n\t\t}\n\t}\n}", "func (g *Group) IsOfSystem() bool {\n\t//loadConfig()\n\n\tif g.GID > config.login.SYS_GID_MIN && g.GID < config.login.SYS_GID_MAX {\n\t\treturn true\n\t}\n\treturn false\n}", "func Is(name string, value any) bool {\n\tif global == nil {\n\t\treturn false\n\t}\n\n\treturn global.Is(name, value)\n}", "func (v Global) Equal(other Global) bool {\n\treturn v.addressLocal.Equal(other.addressLocal) && v.addressBase.Equal(other.addressBase)\n}", "func (L *State) GetGlobal(name string) {\n\tCk := C.CString(name)\n\tdefer C.free(unsafe.Pointer(Ck))\n\tC.lua_getglobal(L.s, Ck)\n}", "func GlobalUser() Name {\n\treturn \"global\"\n}", "func (m HMSketch) global() hist.Histogram {\n\thMux.Lock()\n\tlocation := hash(\"__global__\", \"__global__\")\n\tval := m.Registers[m.Index[location]]\n\thMux.Unlock()\n\treturn val\n}", "func (p *Project) Global() []Project {\n\treturn global\n}", "func GlobalScope() *Scope {\n\treturn globalScope\n}", "func (p *Status) Global() []Status {\n\treturn globalstatus\n}", "func (c GlobalConfig) IsNode() bool {\n\treturn RunMode(c.OBSMode).IsNode()\n}", "func (ppc *PermissionsPolicyCreate) SetIsGlobal(b bool) *PermissionsPolicyCreate {\n\tppc.mutation.SetIsGlobal(b)\n\treturn ppc\n}", "func IsSpaceRoot(r *Node) bool {\n\tpath := r.InternalPath()\n\tif spaceNameBytes, err := xattr.Get(path, xattrs.SpaceNameAttr); err == nil {\n\t\tif string(spaceNameBytes) != \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (v Global) IsEmpty() bool {\n\treturn v.addressLocal.IsEmpty() && v.addressBase.IsEmpty()\n}", "func (id *authIdentity) IsGlobalRORole() bool {\n\treturn format.ContainsString(id.roles, GlobalReadOnlyRole)\n}", "func (metadata *metadataImpl) IsGlobalDomainEnabled() bool {\n\treturn metadata.enableGlobalDomain()\n}", "func (m *Module) NewGlobal(name string, contentType types.Type) *Global {\n\tg := NewGlobal(name, contentType)\n\tm.Globals = append(m.Globals, g)\n\treturn g\n}", "func WithGlobal(isGlobal bool) Option {\n\treturn func(o *options) {\n\t\to.isGlobal = isGlobal\n\t}\n}", "func NewGlobal() *Global {\n\tthis := Global{}\n\tvar logLev string = \"INF\"\n\tthis.LogLev = &logLev\n\tvar cfgPath string = \"/opt/netconfd/version/etc/netconf.json\"\n\tthis.CfgPath = &cfgPath\n\treturn &this\n}", "func (n *Node) IsSpaceRoot(ctx context.Context) bool {\n\t_, err := n.Xattr(ctx, prefixes.SpaceNameAttr)\n\treturn err == nil\n}", "func (s *System) IsPublic() bool { return s.Name == PublicSystem.Name || s.Name == PublicCDSystem.Name }", "func (ev *Evaler) Global() map[string]Variable {\n\treturn map[string]Variable(ev.global)\n}", "func (ev *Evaler) Global() map[string]Variable {\n\treturn map[string]Variable(ev.global)\n}", "func (p *Person) Global() []Person {\n\treturn globalperson\n}", "func (c GlobalConfig) IsOBSMaster() bool {\n\treturn RunMode(c.OBSMode).IsOBSMaster()\n}", "func (me TxsdRegistryHandleSimpleContentExtensionRegistry) IsLocal() bool {\n\treturn me.String() == \"local\"\n}", "func SetGlobalVariables() {\n\tglobalVars = true\n}", "func (m *ApiMeta) GlobalFlagSet(cmd string) *flag.FlagSet {\n\tf := flag.NewFlagSet(cmd, flag.ContinueOnError)\n\n\tf.StringVar(&m.gateEndpoint, \"gate-endpoint\", \"http://localhost:8084\",\n\t\t\"Gate (API server) endpoint\")\n\n\tf.Usage = func() {}\n\n\treturn f\n}", "func (o *Global) HasMgmt() bool {\n\tif o != nil && o.Mgmt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (obj *Global) IsPersonalMode(ctx context.Context) (bool, error) {\n\tresult := &struct {\n\t\tReturn bool `json:\"qReturn\"`\n\t}{}\n\terr := obj.RPC(ctx, \"IsPersonalMode\", result)\n\treturn result.Return, err\n}", "func suToGlobal(su schema.Unit) bool {\n\tu := job.Unit{\n\t\tUnit: *schema.MapSchemaUnitOptionsToUnitFile(su.Options),\n\t}\n\treturn u.IsGlobal()\n}", "func (eb *Bus) GlobalBind(fn Bindable, name string) {\n\teb.Bind(fn, name, 0)\n}", "func (sv *globalSystemVariables) GetGlobal(name string) (sql.SystemVariable, interface{}, bool) {\n\tsv.mutex.RLock()\n\tdefer sv.mutex.RUnlock()\n\tname = strings.ToLower(name)\n\tv, ok := systemVars[name]\n\tif !ok {\n\t\treturn sql.SystemVariable{}, nil, false\n\t}\n\n\tif v.ValueFunction != nil {\n\t\tresult, err := v.ValueFunction()\n\t\tif err != nil {\n\t\t\tlogrus.StandardLogger().Warnf(\"unable to get value for system variable %s: %s\", name, err.Error())\n\t\t\treturn v, nil, true\n\t\t}\n\t\treturn v, result, true\n\t}\n\n\t// convert any set types to strings\n\tsysVal := sv.sysVarVals[name]\n\tif sysType, ok := v.Type.(sql.SetType); ok {\n\t\tif sv, ok := sysVal.Val.(uint64); ok {\n\t\t\tvar err error\n\t\t\tsysVal.Val, err = sysType.BitsToString(sv)\n\t\t\tif err != nil {\n\t\t\t\treturn sql.SystemVariable{}, nil, false\n\t\t\t}\n\t\t}\n\t}\n\treturn v, sysVal.Val, true\n}", "func GlobalMemoryStatusEx(lpBuffer *MEMORYSTATUSEX) bool {\n\tret1 := syscall3(globalMemoryStatusEx, 1,\n\t\tuintptr(unsafe.Pointer(lpBuffer)),\n\t\t0,\n\t\t0)\n\treturn ret1 != 0\n}", "func RegisterGlobal() {\n\tvalidate.AddGlobalMessages(Data)\n}", "func RegisterGlobal() {\n\tvalidate.AddGlobalMessages(Data)\n}", "func TestGlobalSetting(t *testing.T) {\n\t// try basic modification\n\tcheckGlobalSet(t, false, \"default\", \"1-4094\", \"1-10000\")\n\t// set aci mode\n\tcheckGlobalSet(t, false, \"aci\", \"1-4094\", \"1-10000\")\n\n\t// modify vlan/vxlan range\n\tcheckGlobalSet(t, false, \"default\", \"1-1000\", \"1001-2000\")\n\n\t// try invalid fabric mode\n\tcheckGlobalSet(t, true, \"xyz\", \"1-4094\", \"1-10000\")\n\n\t// try invalid vlan/vxlan range\n\tcheckGlobalSet(t, true, \"default\", \"1-5000\", \"1-10000\")\n\tcheckGlobalSet(t, true, \"default\", \"0-4094\", \"1-10000\")\n\tcheckGlobalSet(t, true, \"default\", \"1\", \"1-10000\")\n\tcheckGlobalSet(t, true, \"default\", \"1?2\", \"1-10000\")\n\tcheckGlobalSet(t, true, \"default\", \"abcd\", \"1-10000\")\n\tcheckGlobalSet(t, true, \"default\", \"1-4094\", \"1-100000\")\n\tcheckGlobalSet(t, true, \"default\", \"1-4094\", \"1-20000\")\n\n\t// reset back to default values\n\tcheckGlobalSet(t, false, \"default\", \"1-4094\", \"1-10000\")\n}", "func (c GlobalConfig) IsOBS() bool {\n\treturn RunMode(c.OBSMode).IsOBS()\n}", "func ExposeGlobal(id string, x interface{}) {\n\tglobal.define(sym(id), wrapGo(x))\n}", "func isNamespaced(r corev3.Resource) bool {\n\tgr, ok := r.(corev3.GlobalResource)\n\tif !ok {\n\t\treturn true\n\t}\n\treturn !gr.IsGlobalResource()\n}", "func globalIntern(s string) string {\n\tglobalInternMu.Lock()\n\tdefer globalInternMu.Unlock()\n\treturn globalInternMap.Intern(s)\n}", "func Global() Value {\n\tpanic(message)\n}", "func (c Config) GetGlobal(option string) (string, error) {\n\tif globals, ok := c[Globals]; ok {\n\t\tif settings, ok := globals.(map[string]string); ok {\n\t\t\tif value, ok := settings[option]; ok {\n\t\t\t\treturn value, nil\n\t\t\t}\n\t\t\treturn \"\", fmt.Errorf(\"global setting for %s not found\", option)\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"no global config options found\")\n\n}", "func (b *BaseDevice) GlobalBounds() Rect {\n\tvar origin = b.Origin()\n\tvar bounds Rect\n\tbounds.SetXYWH(origin.X, origin.Y, b.Width(), b.Height())\n\treturn bounds\n}", "func CreateGlobal(stateDriver core.StateDriver, gc *intent.ConfigGlobal) error {\n\tlog.Infof(\"Received global create with intent {%v}\", gc)\n\tvar err error\n\tgcfgUpdateList := []string{}\n\n\tmasterGc := &mastercfg.GlobConfig{}\n\tmasterGc.StateDriver = stateDriver\n\tmasterGc.Read(\"global\")\n\n\tgstate.GlobalMutex.Lock()\n\tdefer gstate.GlobalMutex.Unlock()\n\tgCfg := &gstate.Cfg{}\n\tgCfg.StateDriver = stateDriver\n\tgCfg.Read(\"global\")\n\n\t// check for valid values\n\tif gc.NwInfraType != \"\" {\n\t\tswitch gc.NwInfraType {\n\t\tcase \"default\", \"aci\", \"aci-opflex\":\n\t\t\t// These values are acceptable.\n\t\tdefault:\n\t\t\treturn errors.New(\"Invalid fabric mode\")\n\t\t}\n\t\tmasterGc.NwInfraType = gc.NwInfraType\n\t}\n\tif gc.VLANs != \"\" {\n\t\t_, err := netutils.ParseTagRanges(gc.VLANs, \"vlan\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgCfg.Auto.VLANs = gc.VLANs\n\t\tgcfgUpdateList = append(gcfgUpdateList, \"vlan\")\n\t}\n\n\tif gc.VXLANs != \"\" {\n\t\t_, err = netutils.ParseTagRanges(gc.VXLANs, \"vxlan\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgCfg.Auto.VXLANs = gc.VXLANs\n\t\tgcfgUpdateList = append(gcfgUpdateList, \"vxlan\")\n\t}\n\n\tif gc.FwdMode != \"\" {\n\t\tmasterGc.FwdMode = gc.FwdMode\n\t}\n\n\tif gc.ArpMode != \"\" {\n\t\tmasterGc.ArpMode = gc.ArpMode\n\t}\n\n\tif gc.PvtSubnet != \"\" {\n\t\tmasterGc.PvtSubnet = gc.PvtSubnet\n\t}\n\n\tif len(gcfgUpdateList) > 0 {\n\t\t// Delete old state\n\n\t\tgOper := &gstate.Oper{}\n\t\tgOper.StateDriver = stateDriver\n\t\terr = gOper.Read(\"\")\n\t\tif err == nil {\n\t\t\tfor _, res := range gcfgUpdateList {\n\t\t\t\terr = gCfg.UpdateResources(res)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\tfor _, res := range gcfgUpdateList {\n\t\t\t\t// setup resources\n\t\t\t\terr = gCfg.Process(res)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Error updating the config %+v. Error: %s\", gCfg, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\terr = gCfg.Write()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error updating global config.Error: %s\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn masterGc.Write()\n}", "func (c *client) Global() Interface {\n\treturn &internalClient{\n\t\tsvc: c.services,\n\t}\n}", "func (l Location) IsSystem() bool {\n\treturn l.Station == nil && l.Structure == nil\n}", "func (c *Config) isGlobalReceiver(label map[string]string) bool {\n\n\tif c.globalReceiverSelector != nil {\n\t\tfor k, expected := range c.globalReceiverSelector.MatchLabels {\n\t\t\tif v, exists := label[k]; exists && v == expected {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "func Global(file string) error {\n\tconfig, err := Read(file)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglobal = config\n\n\treturn nil\n}", "func DeleteGlobal(stateDriver core.StateDriver) error {\n\tmasterGc := &mastercfg.GlobConfig{}\n\tmasterGc.StateDriver = stateDriver\n\terr := masterGc.Read(\"\")\n\tif err == nil {\n\t\terr = masterGc.Clear()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Setup global state\n\tgCfg := &gstate.Cfg{}\n\tgCfg.StateDriver = stateDriver\n\terr = gCfg.Read(\"\")\n\tif err == nil {\n\t\terr = gCfg.DeleteResources(\"vlan\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = gCfg.DeleteResources(\"vxlan\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = gCfg.Clear()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Delete old state\n\tgOper := &gstate.Oper{}\n\tgOper.StateDriver = stateDriver\n\terr = gOper.Read(\"\")\n\tif err == nil {\n\t\terr = gOper.Clear()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func getGlobalObject() Uint32_t {\n\tif Jerry_value_is_null(globalObj) {\n\t\tglobalObj = Jerry_get_global_object()\n\t}\n\treturn globalObj\n}", "func NewGlobal() *Environment {\n\treturn New(nil)\n}", "func GetGlobalStatus() models.ControllerStatuses {\n\treturn globalStatus.GetStatusModel()\n}", "func GetGlobalStatus() models.ControllerStatuses {\n\treturn globalStatus.GetStatusModel()\n}", "func Global() *rand.Rand {\n\tgMu.Lock()\n\trng := gRand\n\tgMu.Unlock()\n\treturn rng\n}", "func (s *Swarm32) GlobalPosition() []float32 {\n\treturn s.globalposition\n}", "func NewGlobalCfg(allowRepoCfg bool, mergeableReq bool, approvedReq bool) GlobalCfg {\n\treturn NewGlobalCfgFromArgs(GlobalCfgArgs{\n\t\tAllowRepoCfg: allowRepoCfg,\n\t\tMergeableReq: mergeableReq,\n\t\tApprovedReq: approvedReq,\n\t})\n}", "func (c *Compiler) getGlobalInfo(g *ssa.Global) globalInfo {\n\tinfo := globalInfo{}\n\tif strings.HasPrefix(g.Name(), \"C.\") {\n\t\t// Created by CGo: such a name cannot be created by regular C code.\n\t\tinfo.linkName = g.Name()[2:]\n\t\tinfo.extern = true\n\t} else {\n\t\t// Pick the default linkName.\n\t\tinfo.linkName = g.RelString(nil)\n\t\t// Check for //go: pragmas, which may change the link name (among\n\t\t// others).\n\t\tdoc := c.astComments[info.linkName]\n\t\tif doc != nil {\n\t\t\tinfo.parsePragmas(doc)\n\t\t}\n\t}\n\treturn info\n}", "func (o PriorityClassOutput) GlobalDefault() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v *PriorityClass) pulumi.BoolOutput { return v.GlobalDefault }).(pulumi.BoolOutput)\n}", "func (this *ExDomain) IsGround() bool {\n\treturn this.Min == this.Max\n}", "func HaveIPv6GlobalAddress() (bool, error) {\n\tifs, err := net.Interfaces()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor i := range ifs {\n\t\tiface := &ifs[i]\n\t\tif !isUp(iface) || isLoopback(iface) {\n\t\t\tcontinue\n\t\t}\n\t\taddrs, err := iface.Addrs()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, a := range addrs {\n\t\t\tipnet, ok := a.(*net.IPNet)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ipnet.IP.To4() != nil || !ipnet.IP.IsGlobalUnicast() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func (c *Compiler) getGlobal(g *ssa.Global) llvm.Value {\n\tinfo := c.getGlobalInfo(g)\n\tllvmGlobal := c.mod.NamedGlobal(info.linkName)\n\tif llvmGlobal.IsNil() {\n\t\tllvmType := c.getLLVMType(g.Type().(*types.Pointer).Elem())\n\t\tllvmGlobal = llvm.AddGlobal(c.mod, llvmType, info.linkName)\n\t\tif !info.extern {\n\t\t\tllvmGlobal.SetInitializer(llvm.ConstNull(llvmType))\n\t\t\tllvmGlobal.SetLinkage(llvm.InternalLinkage)\n\t\t}\n\t}\n\treturn llvmGlobal\n}", "func (rg *CFGoReadGlobals) Read(stateNode *snreader.StateNode, input snreader.InputItf) (isEnd bool, err error) {\n\tlex := read(input)\n\n\tif ignoreWithoutBreakline(lex) {\n\t\treturn false, nil\n\t}\n\n\tif rg.first {\n\t\trg.first, rg.varType = false, lex.Value\n\t\treturn false, nil\n\t}\n\n\tif rg.mutiStatus == mutiStatusUnknown {\n\t\tif lex.Equal(ConstLeftParentheses) {\n\t\t\trg.mutiStatus = mutiStatusMuti\n\t\t\treturn false, nil\n\t\t}\n\n\t\trg.mutiStatus = mutiStatusSingle\n\t}\n\n\trg.countLonlyBrackets(lex)\n\n\tif rg.mutiStatus == mutiStatusMuti && rg.lleftPNum == -1 {\n\t\tif rg.gName == \"\" {\n\t\t\treturn true, nil\n\t\t}\n\n\t\treturn true, rg.addGlobal(lex)\n\t}\n\n\tif lex.Equal(ConstBreakLine) {\n\t\tif rg.lleftCNum != 0 {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif rg.gName == \"\" && rg.mutiStatus == mutiStatusMuti {\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn rg.mutiStatus == mutiStatusSingle, rg.addGlobal(lex)\n\t}\n\n\tif rg.gName == \"\" {\n\t\tif !lex_pgl.IsIdent(lex) {\n\t\t\treturn true, onErr(rg, lex, \"var name want a ident\")\n\t\t}\n\n\t\trg.gName = lex.Value\n\t\treturn false, nil\n\t}\n\n\trg.gCode = append(rg.gCode, lex)\n\treturn false, nil\n}", "func (this *KeyspaceTerm) IsSystem() bool {\n\treturn this.path != nil && this.path.IsSystem()\n}", "func (o *SyntheticsGlobalVariableParseTestOptions) HasLocalVariableName() bool {\n\treturn o != nil && o.LocalVariableName != nil\n}", "func UpdateGlobal(stateDriver core.StateDriver, gc *intent.ConfigGlobal) error {\n\tlog.Infof(\"Received global update with intent {%v}\", gc)\n\tvar err error\n\tgcfgUpdateList := []string{}\n\n\tmasterGc := &mastercfg.GlobConfig{}\n\tmasterGc.StateDriver = stateDriver\n\tmasterGc.Read(\"global\")\n\n\tgstate.GlobalMutex.Lock()\n\tdefer gstate.GlobalMutex.Unlock()\n\n\tgCfg := &gstate.Cfg{}\n\tgCfg.StateDriver = stateDriver\n\tgCfg.Read(\"global\")\n\n\t_, vlansInUse := gCfg.GetVlansInUse()\n\t_, vxlansInUse := gCfg.GetVxlansInUse()\n\n\t// check for valid values\n\tif gc.NwInfraType != \"\" {\n\t\tswitch gc.NwInfraType {\n\t\tcase \"default\", \"aci\", \"aci-opflex\":\n\t\t\t// These values are acceptable.\n\t\tdefault:\n\t\t\treturn errors.New(\"Invalid fabric mode\")\n\t\t}\n\t\tmasterGc.NwInfraType = gc.NwInfraType\n\t}\n\tif gc.VLANs != \"\" {\n\n\t\tif !gCfg.CheckInBitRange(gc.VLANs, vlansInUse, \"vlan\") {\n\t\t\treturn fmt.Errorf(\"cannot update the vlan range due to existing vlans %s\", vlansInUse)\n\t\t}\n\t\t_, err := netutils.ParseTagRanges(gc.VLANs, \"vlan\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgCfg.Auto.VLANs = gc.VLANs\n\t\tgcfgUpdateList = append(gcfgUpdateList, \"vlan\")\n\t}\n\n\tif gc.VXLANs != \"\" {\n\t\tif !gCfg.CheckInBitRange(gc.VXLANs, vxlansInUse, \"vxlan\") {\n\t\t\treturn fmt.Errorf(\"cannot update the vxlan range due to existing vxlans %s\", vxlansInUse)\n\t\t}\n\n\t\t_, err = netutils.ParseTagRanges(gc.VXLANs, \"vxlan\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgCfg.Auto.VXLANs = gc.VXLANs\n\t\tgcfgUpdateList = append(gcfgUpdateList, \"vxlan\")\n\t}\n\n\tif gc.FwdMode != \"\" {\n\t\tmasterGc.FwdMode = gc.FwdMode\n\t}\n\n\tif gc.ArpMode != \"\" {\n\t\tmasterGc.ArpMode = gc.ArpMode\n\t}\n\n\tif gc.PvtSubnet != \"\" {\n\t\tmasterGc.PvtSubnet = gc.PvtSubnet\n\t}\n\n\tif len(gcfgUpdateList) > 0 {\n\t\t// Delete old state\n\n\t\tgOper := &gstate.Oper{}\n\t\tgOper.StateDriver = stateDriver\n\t\terr = gOper.Read(\"\")\n\t\tif err == nil {\n\t\t\tfor _, res := range gcfgUpdateList {\n\t\t\t\terr = gCfg.UpdateResources(res)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\terr = gCfg.Write()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error updating global config.Error: %s\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn masterGc.Write()\n}", "func Bool() bool {\n\treturn global.Bool()\n}", "func (o *StorageHitachiPortAllOf) HasIpv6GlobalAddress() bool {\n\tif o != nil && o.Ipv6GlobalAddress != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *PoolModule) globals() []*modulestypes.VMMember {\n\treturn []*modulestypes.VMMember{}\n}", "func HasProp(name string) bool {\n\tif global == nil {\n\t\treturn false\n\t}\n\n\treturn global.HasProp(name)\n}", "func (m *Manager) Exists(globalID string) bool {\n\tcount, _ := m.collection.Find(bson.M{\"globalid\": globalID}).Count()\n\n\treturn count == 1\n}", "func (m *mqService) SetQOSGlobal(global bool) ConfigFunc {\n\treturn func(qos *ConfigQOS) {\n\t\tqos.Global = global\n\t}\n}", "func GetGlobalFilter() *GlobalFilter {\n\tgfOnce.Do(func() {\n\t\tGfi = GetNewGlobalFilter()\n\t})\n\treturn Gfi\n}", "func Contains(key string) bool {\n\t_, contains := getFromMode(key)\n\tif !contains {\n\t\t_, contains = getFromGlobal(key)\n\t}\n\treturn contains\n}", "func GlobalAffinity(key string, weight int32) *Affinity {\n\treturn &Affinity{\n\t\tScope: &resmgr.Expression{\n\t\t\tOp: resmgr.AlwaysTrue, // evaluate against all containers\n\t\t},\n\t\tMatch: &resmgr.Expression{\n\t\t\tKey: key,\n\t\t\tOp: resmgr.Exists,\n\t\t},\n\t\tWeight: weight,\n\t}\n}", "func CheckGlobalVarFlags() []error {\n\tfmt.Fprint(os.Stdout, \" ↳ checking flags from global vars\\n\")\n\terrors := []error{}\n\tpflag.CommandLine.VisitAll(func(f *pflag.Flag) {\n\t\terrors = append(errors, fmt.Errorf(\"flag %q is invalid, please don't register any flag under the global variable \\\"CommandLine\\\"\", f.Name))\n\t})\n\treturn errors\n}", "func (c *Config) IsGogs() bool {\n\treturn c.Gogs.Server != \"\"\n}", "func RegisterGlobalStatSlot(slot base.StatSlot) {\n\tfor _, s := range globalStatSlot {\n\t\tif s.Name() == slot.Name() {\n\t\t\treturn\n\t\t}\n\t}\n\tglobalStatSlot = append(globalStatSlot, slot)\n}", "func GetGlobalConfig(key string) interface{} {\n\tglobalConfig.RLock()\n\tvalue := globalConfig.gMap[key]\n\tglobalConfig.RUnlock()\n\treturn value\n}", "func (m *RPCModule) globals() []*types.VMMember {\n\treturn []*types.VMMember{}\n}", "func (m *DHTModule) globals() []*modulestypes.VMMember {\n\treturn []*modulestypes.VMMember{}\n}", "func (obj *object) IsGround() bool {\n\treturn obj.ground == 2*len(obj.keys)\n}", "func HasSection(section string) bool {\n\tif global == nil {\n\t\treturn false\n\t}\n\n\treturn global.HasSection(section)\n}", "func IsHot() bool {\n\treturn js.Global.Get(\"hmrTrue\") != nil\n}", "func (gfn *globalGFN) active() bool {\n\treturn gfn.lookup.Load() || gfn.timedLookup.Load()\n}", "func (Var) IsGround() bool {\n\treturn false\n}", "func (c Config) SetGlobal(option, value string) {\n\tif globals, ok := c[Globals]; ok {\n\t\tif settings, ok := globals.(map[string]string); ok {\n\t\t\tsettings[option] = value\n\t\t}\n\t}\n}", "func (g *Group) IsRoot() bool {\n\treturn g == g.db.root\n}", "func (o *Global) HasCfgPath() bool {\n\tif o != nil && o.CfgPath != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.8007148", "0.6786136", "0.66457736", "0.6634526", "0.6249949", "0.6210618", "0.60924387", "0.6089236", "0.6016408", "0.58948666", "0.5890985", "0.5815646", "0.57908267", "0.57907593", "0.5763864", "0.5744893", "0.573173", "0.56694597", "0.563088", "0.5604707", "0.5591501", "0.5560916", "0.55558574", "0.5534069", "0.55292934", "0.55116874", "0.5465284", "0.5461675", "0.5443514", "0.5441363", "0.5414738", "0.539372", "0.53819513", "0.53819513", "0.53705585", "0.53497887", "0.5338675", "0.53330666", "0.53312945", "0.5315481", "0.5313717", "0.53061914", "0.52847546", "0.5276259", "0.5267005", "0.5265382", "0.5265382", "0.5262785", "0.5256729", "0.524963", "0.524641", "0.5237319", "0.5230826", "0.5215597", "0.5213414", "0.52010673", "0.51977277", "0.5187198", "0.5184759", "0.5158595", "0.51535285", "0.51454145", "0.5131184", "0.5121408", "0.5121408", "0.51183295", "0.50792426", "0.50785524", "0.5076095", "0.5072171", "0.50693434", "0.50573117", "0.50500524", "0.5031997", "0.50266427", "0.50154203", "0.50147176", "0.5012861", "0.50085944", "0.49983406", "0.4995693", "0.4991699", "0.49823466", "0.49808386", "0.49786085", "0.49750242", "0.49743977", "0.49507248", "0.49481508", "0.49481326", "0.49436828", "0.4933824", "0.49330315", "0.49328044", "0.49268943", "0.49259827", "0.49240467", "0.4914362", "0.4908129", "0.49047327" ]
0.8851892
0
IsPersonal return true if space is personal
func (s *Space) IsPersonal() bool { return s.Type == SPACE_TYPE_PERSONAL }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (obj *Global) IsPersonalMode(ctx context.Context) (bool, error) {\n\tresult := &struct {\n\t\tReturn bool `json:\"qReturn\"`\n\t}{}\n\terr := obj.RPC(ctx, \"IsPersonalMode\", result)\n\treturn result.Return, err\n}", "func (s *System) IsPublic() bool { return s.Name == PublicSystem.Name || s.Name == PublicCDSystem.Name }", "func (me TxsdContactType) IsPerson() bool { return me.String() == \"person\" }", "func (me TxsdMarkerTypeMarkerUnits) IsUserSpace() bool { return me.String() == \"userSpace\" }", "func (me TxsdContactRole) IsTech() bool { return me.String() == \"tech\" }", "func (me TrestrictionType) IsPublic() bool { return me.String() == \"public\" }", "func (me TartIdTypeInt) IsBookaccession() bool { return me.String() == \"bookaccession\" }", "func (n UsernsMode) IsPrivate() bool {\n\treturn !n.IsHost()\n}", "func (me TrestrictionType) IsPrivate() bool { return me.String() == \"private\" }", "func (me TAttlistGeneralNoteOwner) IsPip() bool { return me.String() == \"PIP\" }", "func (me TxsdClipPathTypeClipPathUnits) IsUserSpace() bool { return me.String() == \"userSpace\" }", "func (me TxsdPaymentMechanism) IsPr() bool { return me.String() == \"PR\" }", "func (me TxsdContactType) IsOrganization() bool { return me.String() == \"organization\" }", "func (me TxsdSpace) IsDefault() bool { return me.String() == \"default\" }", "func (me TpubStatusInt) IsPubmedr() bool { return me.String() == \"pubmedr\" }", "func (me TxsdSystemCategory) IsInfrastructure() bool { return me.String() == \"infrastructure\" }", "func (n UTSMode) IsPrivate() bool {\n\treturn !n.IsHost()\n}", "func isPrivate(ns specs.LinuxNamespaceType, mode string) bool {\n\tswitch ns {\n\tcase specs.IPCNamespace:\n\t\treturn mode == \"private\"\n\tcase specs.NetworkNamespace, specs.PIDNamespace:\n\t\treturn !(isHost(mode) || isContainer(mode))\n\tcase specs.UserNamespace, specs.UTSNamespace:\n\t\treturn !(isHost(mode))\n\t}\n\treturn false\n}", "func WiFiSecurityTypePWpaPersonal() *WiFiSecurityType {\n\tv := WiFiSecurityTypeVWpaPersonal\n\treturn &v\n}", "func (me TxsdMarkerTypeMarkerUnits) IsUserSpaceOnUse() bool { return me.String() == \"userSpaceOnUse\" }", "func (me TAttlistMedlineCitationOwner) IsPip() bool { return me.String() == \"PIP\" }", "func (me TSAFTPTSourceBilling) IsP() bool { return me.String() == \"P\" }", "func (me TAttlistDescriptorNameType) IsGeographic() bool { return me.String() == \"Geographic\" }", "func isPublic(name string) bool {\n\tup := bytes.ToUpper([]byte(name))\n\treturn []byte(name)[0] == up[0]\n}", "func (me TSAFTPTSourcePayment) IsP() bool { return me.String() == \"P\" }", "func (s *Drive) Local() bool { return s.config.OAuth.ClientID == \"\" }", "func (domain Domain) IsPrivate() bool {\n\treturn domain.Type == constant.PrivateDomain\n}", "func (me TxsdImpactSimpleContentExtensionType) IsUser() bool { return me.String() == \"user\" }", "func (me TpubStatusInt) IsPmcr() bool { return me.String() == \"pmcr\" }", "func (me TxsdWorkType) IsOu() bool { return me.String() == \"OU\" }", "func (me TAttlistKeywordListOwner) IsPip() bool { return me.String() == \"PIP\" }", "func (me TAttlistELocationIDEIdType) IsPii() bool { return me.String() == \"pii\" }", "func (h *Headers) IsPublic() bool {\n\treturn h.public\n}", "func (n PidMode) IsPrivate() bool {\n\treturn !(n.IsHost() || n.IsContainer())\n}", "func (m *Member) IsPrivate() bool { return !m.Published }", "func (stringEntry *String) IsPersistant() bool {\n\treturn stringEntry.isPersistant\n}", "func (c CgroupnsMode) IsPrivate() bool {\n\treturn c == CgroupnsModePrivate\n}", "func (m *Member) IsGuest() bool { return m.Role == MemberRoleGuest }", "func (me TxsdContactRole) IsCreator() bool { return me.String() == \"creator\" }", "func (me TxsdTaxAccountingBasis) IsP() bool { return me.String() == \"P\" }", "func (me TxsdCounterSimpleContentExtensionType) IsOrganization() bool {\n\treturn me.String() == \"organization\"\n}", "func (me TxsdPaymentMechanism) IsOu() bool { return me.String() == \"OU\" }", "func (n IpcMode) IsPrivate() bool {\n\treturn n == IPCModePrivate\n}", "func (domain Domain) IsShared() bool {\n\treturn domain.Type == constant.SharedDomain\n}", "func isProvisioned(ctx context.Context) (bool, error) {\n\treturn len(service.DefaultPermissions.FindRulesByRoleID(permissions.EveryoneRoleID)) > 0 &&\n\t\tlen(service.DefaultPermissions.FindRulesByRoleID(permissions.AdminsRoleID)) > 0, nil\n}", "func (me TAttlistMedlineCitationStatus) IsPublisher() bool { return me.String() == \"Publisher\" }", "func (me TAttlistArticlePubModel) IsPrintElectronic() bool { return me.String() == \"Print-Electronic\" }", "func (h *Headers) IsPrivate() bool {\n\treturn h.private\n}", "func (me TxsdWorkType) IsPf() bool { return me.String() == \"PF\" }", "func (s *Space) IsGlobal() bool {\n\treturn s.Type == SPACE_TYPE_GLOBAL\n}", "func (s *Service) IsManaged(ctx context.Context) (bool, error) {\n\tzoneSpec, _, _ := s.Scope.PrivateDNSSpec()\n\tif zoneSpec == nil {\n\t\treturn false, errors.Errorf(\"no private dns zone spec available\")\n\t}\n\n\tresult, err := s.zoneGetter.Get(ctx, zoneSpec)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tzone, ok := result.(privatedns.PrivateZone)\n\tif !ok {\n\t\treturn false, errors.Errorf(\"%T is not a privatedns.PrivateZone\", zone)\n\t}\n\n\ttags := converters.MapToTags(zone.Tags)\n\treturn tags.HasOwned(s.Scope.ClusterName()), nil\n}", "func (n UsernsMode) IsHost() bool {\n\treturn n == \"host\"\n}", "func (me TpubStatusInt) IsPubmed() bool { return me.String() == \"pubmed\" }", "func (me TxsdContactRole) IsAdmin() bool { return me.String() == \"admin\" }", "func (m *MMSObjectPolicyManager) serveOrg(polOrg string) bool {\n\tm.spMapLock.Lock()\n\tdefer m.spMapLock.Unlock()\n\n\tfor _, sp := range m.ServedOrgs {\n\t\tif sp.BusinessPolOrg == polOrg {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (me TAttlistArticlePubModel) IsElectronicPrint() bool { return me.String() == \"Electronic-Print\" }", "func (me TpubStatusInt) IsPmc() bool { return me.String() == \"pmc\" }", "func (me TxsdImpactSimpleContentExtensionType) IsAdmin() bool { return me.String() == \"admin\" }", "func (user *User) IsLocal() bool {\n\treturn user.Role == UserRoleLocal\n}", "func (s *Drive) Persistent() bool { return s.config.OAuth.ClientID != \"\" }", "func (m *Member) IsOwner() bool { return m.Role == MemberRoleOwner }", "func (me TSAFTPTSourcePayment) IsM() bool { return me.String() == \"M\" }", "func (p *provision) isCloud() bool {\n\treturn p.IsGCPManaged && p.runtimeType == \"CLOUD\"\n}", "func hasProdaccess(hostname string) bool {\n\treturn (hostname == \"avellanos\" || hostname == \"montero\")\n}", "func (me TAttlistArticlePubModel) IsElectronic() bool { return me.String() == \"Electronic\" }", "func (p *Provider) IsPrivate() bool {\n\treturn p.key != nil\n}", "func (me TAttlistArticlePubModel) IsPrint() bool { return me.String() == \"Print\" }", "func (m *AndroidManagedStoreApp) GetIsPrivate()(*bool) {\n val, err := m.GetBackingStore().Get(\"isPrivate\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (u User) IsSystem() bool {\n\treturn u.HasRole(SystemRole)\n}", "func (gt GtwyMgr) IsPermitted(ctx context.Context, appcontext, remoteAddress string) (bool, error) {\n\tif EnvDebugOn {\n\t\tlblog.LogEvent(\"GtwyMgr\", \"IsPermitted\", \"info\", \"start\")\n\t}\n\n\t//check the approval list\n\tq := datastore.NewQuery(gt.bc.GetConfigValue(ctx, \"EnvGtwayDsKind\")).\n\t\tNamespace(gt.bc.GetConfigValue(ctx, \"EnvGtwayDsNamespace\")).\n\t\tFilter(\"appcontext =\", appcontext).\n\t\tFilter(\"remoteaddress =\", remoteAddress).\n\t\tKeysOnly()\n\n\t//get the count\n\tn, err := gt.ds.Count(ctx, q)\n\t//if there was an error return it and false\n\tif err != nil {\n\t\tif err != datastore.ErrNoSuchEntity {\n\t\t\treturn false, err\n\t\t}\n\t\treturn false, nil\n\t}\n\n\t//return false if the count was zero\n\tif n == 0 {\n\t\treturn false, nil\n\t}\n\n\tif EnvDebugOn {\n\t\tlblog.LogEvent(\"GtwyMgr\", \"IsPermitted\", \"info\", strconv.Itoa(n))\n\t\tlblog.LogEvent(\"GtwyMgr\", \"IsPermitted\", \"info\", \"end\")\n\t}\n\n\t//otherwise the address is valid\n\treturn true, nil\n}", "func IsCorp(hostname string) bool {\n\treturn (hostname == \"avellanos\" || hostname == \"montero\" || hostname == \"monygham\")\n}", "func (m *MMSObjectPolicyManager) hasOrg(org string) bool {\n\tif _, ok := m.orgMap[org]; ok {\n\t\treturn true\n\t}\n\treturn false\n}", "func (me TxsdSpace) IsPreserve() bool { return me.String() == \"preserve\" }", "func IsPublic(request *http.Request) bool {\n\tif request == nil {\n\t\treturn true\n\t}\n\t//when condition is true then it is public\n\treturn request.Header.Get(headerXPublic) == \"true\"\n}", "func isPublic(c echo.Context) bool {\n\tpublic, ok := c.Get(publicContextKey).(bool)\n\tif ok && public {\n\t\treturn true\n\t}\n\n\t// TODO Allow select methods on public urls. For now only support GET to these URLs\n\tif c.Request().Method != http.MethodGet {\n\t\treturn false\n\t}\n\n\trequestPath := c.Request().URL.Path\n\tglog.V(2).Infof(\"Checking if prefix '%s' is public\", requestPath)\n\n\tif PublicPathsWatcher == nil {\n\t\tglog.Errorf(\"Failed to initialize public-path manager\")\n\t\treturn false\n\t}\n\n\tpublicPathPrefixes := PublicPathsWatcher.GetPublicPaths()\n\tfor _, prefix := range publicPathPrefixes {\n\t\tif strings.HasPrefix(requestPath, prefix) {\n\t\t\tc.Set(publicContextKey, true)\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (o *StoragePhysicalDiskAllOf) HasSecured() bool {\n\tif o != nil && o.Secured != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdNodeRoleSimpleContentExtensionCategory) IsP2P() bool { return me.String() == \"p2p\" }", "func (me TpubStatusInt) IsMedliner() bool { return me.String() == \"medliner\" }", "func (t Token) Prod() bool {\n\treturn !strings.HasPrefix(string(t), \"test_\") &&\n\t\t!strings.HasPrefix(string(t), \"api_sandbox.\")\n}", "func (me TSAFTPTSourceBilling) IsM() bool { return me.String() == \"M\" }", "func (o *Transaction) HasPersonalFinanceCategory() bool {\n\tif o != nil && o.PersonalFinanceCategory.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *Service) IsManaged(ctx context.Context) (bool, error) {\n\treturn true, nil\n}", "func (t *Task) IsPrivate() bool {\n\t// I like the idea of not needing to put an astrick next to a task\n\t// ... Descriptions automagically qualify for \"important tasks\"\n\t// No descriptions means it's filler, or private\n\t// Summaries WITH private: true are private\n\tif t.Summary == \"\" || t.Private {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func amAdmin() bool {\n\t_, err := os.Open(\"\\\\\\\\.\\\\PHYSICALDRIVE0\")\n\tif err != nil {\n\t\treturn false\t//not admin\n\t}\n\treturn true\t\t//admin\n}", "func (fe *FileEncryptionProperties) IsUtilized() bool { return fe.utilized }", "func (u *User) IsLocal() bool {\n\treturn u.LoginSource <= 0\n}", "func (_ERC20Pausable *ERC20PausableCaller) IsPauser(opts *bind.CallOpts, account common.Address) (bool, error) {\n\tvar out []interface{}\n\terr := _ERC20Pausable.contract.Call(opts, &out, \"isPauser\", account)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "func (typ *Type) IsPublic() bool {\n\treturn isPublicName(typ.Name)\n}", "func (h BareTlfHandle) IsPublic() bool {\n\treturn len(h.Readers) == 1 && h.Readers[0].Equal(keybase1.PublicUID)\n}", "func (me TxsdContactRole) IsIrt() bool { return me.String() == \"irt\" }", "func (n NetworkMode) IsPrivate() bool {\n\treturn !(n.IsHost() || n.IsContainer())\n}", "func isPublic(myString string) bool {\n\ta := []rune(myString)\n\ta[0] = unicode.ToUpper(a[0])\n\treturn myString == string(a)\n}", "func (void *VoidResponse) SetIsPersonal(personal bool) *VoidResponse {\n\tbody := JSON{\n\t\t\"is_personal\": personal,\n\t}\n\tvoid.Request = void.Request.Send(body)\n\n\treturn void\n}", "func (s UserSet) IsPublic() bool {\n\tres := s.Collection().Call(\"IsPublic\")\n\tresTyped, _ := res.(bool)\n\treturn resTyped\n}", "func IsConfidential() (bool){\n\tviper.SetConfigName(\"core\")\n\tviper.SetConfigType(\"yaml\")\n\tviper.AddConfigPath(\"/opt/gopath/src/github.com/hyperledger/fabric/peer\")\n\terr := viper.ReadInConfig() // Find and read the config file\n\tif err != nil { // Handle errors reading the config file\n\t\tpanic(fmt.Errorf(\"Fatal error config file [%s] \\n\", err))\n\t}\n\n\n\treturn viper.GetBool(\"security.privacy\")\n}", "func (me TAttlistIssnIssnType) IsPrint() bool { return me.String() == \"Print\" }", "func (me TxsdAddressSimpleContentExtensionCategory) IsMac() bool { return me.String() == \"mac\" }", "func (me TxsdNodeRoleSimpleContentExtensionCategory) IsMail() bool { return me.String() == \"mail\" }", "func (me TReviewPolicyLevel) IsAssignment() bool { return me.String() == \"Assignment\" }", "func (c *Container) IsSpace() bool {\n\treturn c.Key != \"\"\n}" ]
[ "0.70180583", "0.6078018", "0.58026356", "0.5692048", "0.56086373", "0.55681205", "0.55415803", "0.5512311", "0.54638976", "0.5388905", "0.5357469", "0.52480066", "0.5236056", "0.52012086", "0.5195337", "0.51941645", "0.5180246", "0.51634693", "0.51496786", "0.510989", "0.5101718", "0.5078444", "0.506352", "0.5047095", "0.50364375", "0.50275946", "0.5015909", "0.50047237", "0.49950314", "0.4994225", "0.49928153", "0.4979531", "0.497502", "0.49598962", "0.49536142", "0.49467856", "0.49427083", "0.49350557", "0.4913251", "0.49035236", "0.49035078", "0.4903402", "0.48969546", "0.48957703", "0.488685", "0.48849034", "0.48814416", "0.48790127", "0.48717684", "0.48713845", "0.48701695", "0.4854097", "0.48248547", "0.48215464", "0.48138806", "0.48130912", "0.48129612", "0.4810557", "0.47807503", "0.47760966", "0.47692603", "0.47680128", "0.47659948", "0.4764458", "0.4763444", "0.47625482", "0.47624573", "0.47526306", "0.47525427", "0.4746882", "0.47443432", "0.47404268", "0.47358152", "0.47330272", "0.47270295", "0.4707939", "0.47066265", "0.47056285", "0.46988833", "0.46855876", "0.46838167", "0.4683797", "0.46827364", "0.46671107", "0.46653", "0.46642926", "0.46598196", "0.46586242", "0.4657797", "0.46570107", "0.4654399", "0.4648663", "0.46442586", "0.4641929", "0.4640386", "0.46341017", "0.46302345", "0.46290642", "0.46286738", "0.46280304" ]
0.8510974
0
IsArchived return true if space is archived
func (s *Space) IsArchived() bool { return s.Type == SPACE_STATUS_ARCHIVED }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (sdk Sdk) IsArchived() bool {\n\treturn sdk.archiveFile() != \"\"\n}", "func (r *BackupItem) IsArchived() bool {\n\treturn r.Status&StatusArchived == StatusArchived\n}", "func (r *BackupItem) IsArchived() bool {\n\treturn r.Status&StatusArchived == StatusArchived\n}", "func (r *RoleList) HasArchived() bool {\n\treturn r.hasArchived\n}", "func (o *ShortenBitlinkBodyAllOf) HasArchived() bool {\n\tif o != nil && o.Archived != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DataExportQuery) HasArchived() bool {\n\tif o != nil && o.Archived != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *CreateWaveOutput) SetIsArchived(v bool) *CreateWaveOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *StopReplicationOutput) SetIsArchived(v bool) *StopReplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *StartReplicationOutput) SetIsArchived(v bool) *StartReplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *StickerSet) GetIsArchived() (value bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.IsArchived\n}", "func (s *RetryDataReplicationOutput) SetIsArchived(v bool) *RetryDataReplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *UpdateWaveOutput) SetIsArchived(v bool) *UpdateWaveOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *StickerSet) GetArchived() (value bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Flags.Has(1)\n}", "func (r *Repository) GetArchived() bool {\n\tif r == nil || r.Archived == nil {\n\t\treturn false\n\t}\n\treturn *r.Archived\n}", "func (s *CreateApplicationOutput) SetIsArchived(v bool) *CreateApplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *FinalizeCutoverOutput) SetIsArchived(v bool) *FinalizeCutoverOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (o *ShortenBitlinkBodyAllOf) GetArchived() bool {\n\tif o == nil || o.Archived == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Archived\n}", "func (s *ListWavesRequestFilters) SetIsArchived(v bool) *ListWavesRequestFilters {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *Wave) SetIsArchived(v bool) *Wave {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *PauseReplicationOutput) SetIsArchived(v bool) *PauseReplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *UpdateSourceServerReplicationTypeOutput) SetIsArchived(v bool) *UpdateSourceServerReplicationTypeOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *DisconnectFromServiceOutput) SetIsArchived(v bool) *DisconnectFromServiceOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *SourceServer) SetIsArchived(v bool) *SourceServer {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *DescribeSourceServersRequestFilters) SetIsArchived(v bool) *DescribeSourceServersRequestFilters {\n\ts.IsArchived = &v\n\treturn s\n}", "func (p *ProjectCard) GetArchived() bool {\n\tif p == nil || p.Archived == nil {\n\t\treturn false\n\t}\n\treturn *p.Archived\n}", "func (s *ResumeReplicationOutput) SetIsArchived(v bool) *ResumeReplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *UpdateApplicationOutput) SetIsArchived(v bool) *UpdateApplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *Application) SetIsArchived(v bool) *Application {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *ChangeServerLifeCycleStateOutput) SetIsArchived(v bool) *ChangeServerLifeCycleStateOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (s *ListApplicationsRequestFilters) SetIsArchived(v bool) *ListApplicationsRequestFilters {\n\ts.IsArchived = &v\n\treturn s\n}", "func (fa FileAttributes) IsArchive() bool {\n\treturn fa&32 > 0\n}", "func (p *ProjectCardOptions) GetArchived() bool {\n\tif p == nil || p.Archived == nil {\n\t\treturn false\n\t}\n\treturn *p.Archived\n}", "func (s *ArchiveWaveOutput) SetIsArchived(v bool) *ArchiveWaveOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (o *DataExportQuery) SetArchived(v string) {\n\to.Archived = &v\n}", "func (b *FollowUpBuilder) Archived(value bool) *FollowUpBuilder {\n\tb.archived = value\n\tb.bitmap_ |= 8\n\treturn b\n}", "func (o *ShortenBitlinkBodyAllOf) SetArchived(v bool) {\n\to.Archived = &v\n}", "func (s *UnarchiveWaveOutput) SetIsArchived(v bool) *UnarchiveWaveOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (o *ShortenBitlinkBodyAllOf) GetArchivedOk() (*bool, bool) {\n\tif o == nil || o.Archived == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Archived, true\n}", "func (s *UnarchiveApplicationOutput) SetIsArchived(v bool) *UnarchiveApplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (o *DataExportQuery) GetArchivedOk() (*string, bool) {\n\tif o == nil || o.Archived == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Archived, true\n}", "func (m *ServiceUpdateMessageViewpoint) GetIsArchived()(*bool) {\n val, err := m.GetBackingStore().Get(\"isArchived\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (s *ArchiveApplicationOutput) SetIsArchived(v bool) *ArchiveApplicationOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (c *AdsListCall) Archived(archived bool) *AdsListCall {\n\tc.urlParams_.Set(\"archived\", fmt.Sprint(archived))\n\treturn c\n}", "func (s *StickerSet) SetArchived(value bool) {\n\tif value {\n\t\ts.Flags.Set(1)\n\t\ts.Archived = true\n\t} else {\n\t\ts.Flags.Unset(1)\n\t\ts.Archived = false\n\t}\n}", "func (c *CreativesListCall) Archived(archived bool) *CreativesListCall {\n\tc.urlParams_.Set(\"archived\", fmt.Sprint(archived))\n\treturn c\n}", "func (c *PlacementGroupsListCall) Archived(archived bool) *PlacementGroupsListCall {\n\tc.urlParams_.Set(\"archived\", fmt.Sprint(archived))\n\treturn c\n}", "func (c *PlacementsListCall) Archived(archived bool) *PlacementsListCall {\n\tc.urlParams_.Set(\"archived\", fmt.Sprint(archived))\n\treturn c\n}", "func (o *DataExportQuery) GetArchived() string {\n\tif o == nil || o.Archived == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Archived\n}", "func (c *AdvertiserLandingPagesListCall) Archived(archived bool) *AdvertiserLandingPagesListCall {\n\tc.urlParams_.Set(\"archived\", fmt.Sprint(archived))\n\treturn c\n}", "func (g *Game) Archive(user *apigateway.AuthenticatedUser) bool {\n\tif g.db.State != models.StateFinished {\n\t\treturn false\n\t}\n\n\tif !g.userIsInGame(user) {\n\t\treturn false\n\t}\n\n\tg.db.State = models.StateArchived\n\n\treturn g.save(context.TODO())\n}", "func (r *RoleList) GetArchived() uint {\n\treturn r.Archived\n}", "func (m *Manifest) Archive(id uuid.UUID, txes ...*sqlx.Tx) (*db.Manifest, error) {\n\tconn := prepConn(m.Conn, txes...)\n\n\tu, err := db.FindManifest(conn, id.String())\n\tif err != nil {\n\t\treturn nil, terror.New(err, \"\")\n\t}\n\n\tif u.Archived {\n\t\treturn u, nil\n\t}\n\n\tu.Archived = true\n\tu.ArchivedAt = null.TimeFrom(time.Now())\n\t_, err = u.Update(conn, boil.Whitelist(db.ManifestColumns.Archived, db.ManifestColumns.ArchivedAt))\n\tif err != nil {\n\t\treturn nil, terror.New(err, \"\")\n\t}\n\treturn u, nil\n}", "func (o *GetV1MembershipsParams) SetArchived(archived *bool) {\n\to.Archived = archived\n}", "func (c *CampaignsListCall) Archived(archived bool) *CampaignsListCall {\n\tc.urlParams_.Set(\"archived\", fmt.Sprint(archived))\n\treturn c\n}", "func (s *MarkAsArchivedOutput) SetIsArchived(v bool) *MarkAsArchivedOutput {\n\ts.IsArchived = &v\n\treturn s\n}", "func (r ApiGetBitlinksByGroupRequest) Archived(archived string) ApiGetBitlinksByGroupRequest {\n\tr.archived = &archived\n\treturn r\n}", "func (mr *MockRepoClientMockRecorder) IsArchived() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IsArchived\", reflect.TypeOf((*MockRepoClient)(nil).IsArchived))\n}", "func (m *ItemVariant) Archive() (err error) {\n\tm.IsArchived = 1\n\tif err = m.Save(\"is_archived\"); err == nil {\n\t\t// kalau semua item_variant dari item ini di archive maka item nya juga harus di archive\n\t\tvar t int64\n\t\to := orm.NewOrm()\n\t\tif e := o.Raw(\"select count(*) from item_variant where item_id = ? and is_archived = 0\", m.Item.ID).QueryRow(&t); e == nil && t == 0 {\n\t\t\to.Raw(\"update item set is_archived = 1 where id = ?\", m.Item.ID).Exec()\n\t\t}\n\t}\n\n\treturn\n}", "func (o *GetSearchEmployeesParams) SetArchived(archived *bool) {\n\to.Archived = archived\n}", "func (o *GetSearchClinicsParams) SetArchived(archived *bool) {\n\to.Archived = archived\n}", "func (m *MockRepoClient) IsArchived() (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IsArchived\")\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (a *BooleanArchive) ArchiveLen() int {\n\treturn len(a.archiveArray)\n}", "func (m *ServiceUpdateMessageViewpoint) SetIsArchived(value *bool)() {\n err := m.GetBackingStore().Set(\"isArchived\", value)\n if err != nil {\n panic(err)\n }\n}", "func (p *ProjectCardListOptions) GetArchivedState() string {\n\tif p == nil || p.ArchivedState == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.ArchivedState\n}", "func (account *Account) Archived(params ...interface{}) *FeedMedia {\r\n\tinsta := account.inst\r\n\r\n\tmedia := &FeedMedia{}\r\n\tmedia.inst = insta\r\n\tmedia.endpoint = urlUserArchived\r\n\r\n\tfor _, param := range params {\r\n\t\tswitch s := param.(type) {\r\n\t\tcase string:\r\n\t\t\tmedia.timestamp = s\r\n\t\t}\r\n\t}\r\n\r\n\treturn media\r\n}", "func (r *Repo) IsDeleted() bool { return !r.DeletedAt.IsZero() }", "func (s *Transaction) Archive(id uuid.UUID, txes ...*sql.Tx) (*db.Transaction, error) {\n\tu, err := db.FindTransaction(s.Conn, id.String())\n\tif err != nil {\n\t\treturn nil, terror.New(err, \"\")\n\t}\n\n\tif u.Archived {\n\t\treturn u, nil\n\t}\n\n\tu.Archived = true\n\tu.ArchivedAt = null.TimeFrom(time.Now())\n\t_, err = u.Update(s.Conn, boil.Whitelist(db.TransactionColumns.Archived, db.TransactionColumns.ArchivedAt))\n\tif err != nil {\n\t\treturn nil, terror.New(err, \"\")\n\t}\n\treturn u, nil\n}", "func (s *Service) arcExist(aid int64) bool {\n\tvar (\n\t\tres *ugcmdl.Archive\n\t\terr error\n\t)\n\tif res, err = s.dao.ParseArc(ctx, aid); err != nil || res == nil {\n\t\treturn false\n\t}\n\tif res.Deleted == _deleted {\n\t\treturn false\n\t}\n\treturn true\n}", "func ArchInBackup(arch Archive, backup *Backup) bool {\n\tbackupStart := backup.MongoMeta.Before.LastMajTS\n\tbackupEnd := backup.MongoMeta.After.LastMajTS\n\treturn TimestampInInterval(arch.Start, backupStart, backupEnd) ||\n\t\tTimestampInInterval(arch.End, backupStart, backupEnd) ||\n\t\tTimestampInInterval(backupStart, arch.Start, arch.End) ||\n\t\tTimestampInInterval(backupEnd, arch.Start, arch.End)\n}", "func (p PostgresStapleStorer) Archive(email string, stapleID int) error {\n\tconn, err := p.connect()\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx := context.Background()\n\tdefer conn.Close(ctx)\n\t_, err = conn.Exec(ctx, \"update staples set archived = true where user_email = $1 and id = $2\", email, stapleID)\n\treturn err\n}", "func isArchiveFormatRar(archivePath string, password string) error {\n\treadCloser, err := rardecode.OpenReader(archivePath, password)\n\tif err == nil {\n\t\t_ = readCloser.Close()\n\t}\n\treturn err\n}", "func (o *ArchivedAnalysis) HasArchiveSizeBytes() bool {\n\tif o != nil && o.ArchiveSizeBytes != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func ArchivedKey(qname string) string {\n\treturn fmt.Sprintf(\"asynq:{%s}:archived\", qname)\n}", "func (svc *LouisService) Archive(imageKey string) error {\n\n\tfiles, err := svc.ctx.Storage.ListFiles(imageKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar objectsToDelete = make([]storage.ObjectID, 0)\n\tvar originalKey storage.ObjectID\n\tvar realExists = false\n\tfor _, file := range files {\n\t\tif strings.HasSuffix(*file.Key, RealTransformName+\".\"+ImageExtension) {\n\t\t\trealExists = true\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(*file.Key, OriginalTransformName+\".\"+ImageExtension) {\n\t\t\toriginalKey = file\n\t\t\tcontinue\n\t\t}\n\t\tobjectsToDelete = append(objectsToDelete, file)\n\t}\n\tif realExists && originalKey != nil {\n\t\tobjectsToDelete = append(objectsToDelete, originalKey)\n\t}\n\n\tif len(objectsToDelete) > 0 {\n\t\terr = svc.ctx.Storage.DeleteFiles(objectsToDelete)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn svc.ctx.DB.DeleteImage(imageKey)\n}", "func (a *Archive) Empty() bool {\n\treturn len(a.Files) == 0\n}", "func (c *Client) archiveWorkspaceTemplateDB(namespace, uid string) (archived bool, err error) {\n\tresult, err := sb.Update(\"workspace_templates\").\n\t\tSet(\"is_archived\", true).\n\t\tWhere(sq.Eq{\n\t\t\t\"uid\": uid,\n\t\t\t\"namespace\": namespace,\n\t\t\t\"is_archived\": false,\n\t\t}).\n\t\tRunWith(c.DB).\n\t\tExec()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\trowsAffected, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif rowsAffected == 0 {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "func (d *Dao) Archives(c context.Context, aids []int64, ip string) (a map[int64]*api.Arc, err error) {\n\tvar arg = &archive.ArgAids2{Aids: aids, RealIP: ip}\n\tif a, err = d.arc.Archives3(c, arg); err != nil {\n\t\tlog.Error(\"rpc archive (%v) error(%v)\", aids, err)\n\t\terr = ecode.CreativeArcServiceErr\n\t}\n\treturn\n}", "func (me TxsdSpace) IsPreserve() bool { return me.String() == \"preserve\" }", "func Archive() {\n\tcount.Archive()\n}", "func IsPurgeable(candidate time.Time, before time.Duration, since time.Duration) bool {\n\tnow := time.Now().In(time.UTC)\n\tstart := time.Time{}\n\tend := now\n\tif before == 0 && since == 0 {\n\t\treturn true\n\t} else if before != 0 && since != 0 {\n\t\treturn false\n\t}\n\tif before != 0 {\n\t\tend = now.Add(-before)\n\t}\n\tif since != 0 {\n\t\tstart = now.Add(-since)\n\t}\n\tif candidate.After(start) && candidate.Before(end) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (s *Service) diffArc(old *ugcmdl.ArchDatabus, new *ugcmdl.ArchDatabus) (diff bool) {\n\tdiff = (old.Title != new.Title)\n\tdiff = diff || (old.Content != new.Content)\n\tdiff = diff || (old.PubTime != new.PubTime)\n\tdiff = diff || (old.TypeID != new.TypeID)\n\tdiff = diff || (old.Cover != new.Cover)\n\tdiff = diff || (s.getPTypeName(old.TypeID) != s.getPTypeName(new.TypeID))\n\treturn\n}", "func (me TGetReviewableHITsSortProperty) IsExpiration() bool { return me.String() == \"Expiration\" }", "func isArchiveItemHeader(line string, prefix string, suffix string, format string) bool {\n\tif !strings.HasPrefix(line, prefix) {\n\t\treturn false\n\t}\n\tif !strings.HasSuffix(line, suffix) {\n\t\treturn false\n\t}\n\t_, err := time.Parse(format, stripPrefixSuffix(line, prefix, suffix))\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (c *Client) MarkAsArchived(ctx context.Context, params *MarkAsArchivedInput, optFns ...func(*Options)) (*MarkAsArchivedOutput, error) {\n\tif params == nil {\n\t\tparams = &MarkAsArchivedInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"MarkAsArchived\", params, optFns, addOperationMarkAsArchivedMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*MarkAsArchivedOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (p *Policy) handleArchiving(ctx context.Context, storage logical.Storage) error {\n\t// We need to move keys that are no longer accessible to archivedKeys, and keys\n\t// that now need to be accessible back here.\n\t//\n\t// For safety, because there isn't really a good reason to, we never delete\n\t// keys from the archive even when we move them back.\n\n\t// Check if we have the latest minimum version in the current set of keys\n\t_, keysContainsMinimum := p.Keys[strconv.Itoa(p.MinDecryptionVersion)]\n\n\t// Sanity checks\n\tswitch {\n\tcase p.MinDecryptionVersion < 1:\n\t\treturn fmt.Errorf(\"minimum decryption version of %d is less than 1\", p.MinDecryptionVersion)\n\tcase p.LatestVersion < 1:\n\t\treturn fmt.Errorf(\"latest version of %d is less than 1\", p.LatestVersion)\n\tcase !keysContainsMinimum && p.ArchiveVersion != p.LatestVersion:\n\t\treturn fmt.Errorf(\"need to move keys from archive but archive version not up-to-date\")\n\tcase p.ArchiveVersion > p.LatestVersion:\n\t\treturn fmt.Errorf(\"archive version of %d is greater than the latest version %d\",\n\t\t\tp.ArchiveVersion, p.LatestVersion)\n\tcase p.MinEncryptionVersion > 0 && p.MinEncryptionVersion < p.MinDecryptionVersion:\n\t\treturn fmt.Errorf(\"minimum decryption version of %d is greater than minimum encryption version %d\",\n\t\t\tp.MinDecryptionVersion, p.MinEncryptionVersion)\n\tcase p.MinDecryptionVersion > p.LatestVersion:\n\t\treturn fmt.Errorf(\"minimum decryption version of %d is greater than the latest version %d\",\n\t\t\tp.MinDecryptionVersion, p.LatestVersion)\n\t}\n\n\tarchive, err := p.LoadArchive(ctx, storage)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !keysContainsMinimum {\n\t\t// Need to move keys *from* archive\n\t\tfor i := p.MinDecryptionVersion; i <= p.LatestVersion; i++ {\n\t\t\tp.Keys[strconv.Itoa(i)] = archive.Keys[i-p.MinAvailableVersion]\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// Need to move keys *to* archive\n\n\t// We need a size that is equivalent to the latest version (number of keys)\n\t// but adding one since slice numbering starts at 0 and we're indexing by\n\t// key version\n\tif len(archive.Keys)+p.MinAvailableVersion < p.LatestVersion+1 {\n\t\t// Increase the size of the archive slice\n\t\tnewKeys := make([]KeyEntry, p.LatestVersion-p.MinAvailableVersion+1)\n\t\tcopy(newKeys, archive.Keys)\n\t\tarchive.Keys = newKeys\n\t}\n\n\t// We are storing all keys in the archive, so we ensure that it is up to\n\t// date up to p.LatestVersion\n\tfor i := p.ArchiveVersion + 1; i <= p.LatestVersion; i++ {\n\t\tarchive.Keys[i-p.MinAvailableVersion] = p.Keys[strconv.Itoa(i)]\n\t\tp.ArchiveVersion = i\n\t}\n\n\t// Trim the keys if required\n\tif p.ArchiveMinVersion < p.MinAvailableVersion {\n\t\tarchive.Keys = archive.Keys[p.MinAvailableVersion-p.ArchiveMinVersion:]\n\t\tp.ArchiveMinVersion = p.MinAvailableVersion\n\t}\n\n\terr = p.storeArchive(ctx, storage, archive)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Perform deletion afterwards so that if there is an error saving we\n\t// haven't messed with the current policy\n\tfor i := p.LatestVersion - len(p.Keys) + 1; i < p.MinDecryptionVersion; i++ {\n\t\tdelete(p.Keys, strconv.Itoa(i))\n\t}\n\n\treturn nil\n}", "func NewArchiver(logger log.Logger) archiversvc.Service {\n\treturn &archiversvcsvc{\n\t\tlogger: logger,\n\t\tdb: &Archive{RWMutex: &sync.RWMutex{}},\n\t}\n}", "func (me TGetReviewableHITsSortProperty) IsCreationTime() bool { return me.String() == \"CreationTime\" }", "func isUnarchivingChannelEnabled() bool {\n\tif os.Getenv(\"ENABLE_UNARCHIVING_CHANNEL\") == \"true\" {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "func (repo *Repository) Archive(ctx context.Context, claims auth.Claims, req ChecklistArchiveRequest, now time.Time) error {\n\tspan, ctx := tracer.StartSpanFromContext(ctx, \"internal.checklist.Archive\")\n\tdefer span.Finish()\n\n\t// Validate the request.\n\tv := webcontext.Validator()\n\terr := v.Struct(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Ensure the claims can modify the checklist specified in the request.\n\terr = repo.CanModifyChecklist(ctx, claims, req.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If now empty set it to the current time.\n\tif now.IsZero() {\n\t\tnow = time.Now()\n\t}\n\n\t// Always store the time as UTC.\n\tnow = now.UTC()\n\t// Postgres truncates times to milliseconds when storing. We and do the same\n\t// here so the value we return is consistent with what we store.\n\tnow = now.Truncate(time.Millisecond)\n\t// Build the update SQL statement.\n\tquery := sqlbuilder.NewUpdateBuilder()\n\tquery.Update(checklistTableName)\n\tquery.Set(\n\t\tquery.Assign(\"archived_at\", now),\n\t)\n\n\tquery.Where(query.Equal(\"id\", req.ID))\n\t// Execute the query with the provided context.\n\tsql, args := query.Build()\n\tsql = repo.DbConn.Rebind(sql)\n\t_, err = repo.DbConn.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"query - %s\", query.String())\n\t\terr = errors.WithMessagef(err, \"archive checklist %s failed\", req.ID)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (ks *VRF) Archive(key secp256k1.PublicKey) (err error) {\n\tks.lock.Lock()\n\tdefer ks.lock.Unlock()\n\tif key == zeroPublicKey {\n\t\treturn fmt.Errorf(\"cannot delete the empty public key\")\n\t}\n\tif _, found := ks.keys[key]; found {\n\t\terr = ks.forget(key) // Destroy in-memory representation of key\n\t\tdelete(ks.keys, key)\n\t}\n\tmatches, err := ks.get(key)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"while checking for existence of key %s in DB\", key.String())\n\t} else if len(matches) == 0 {\n\t\treturn ErrAttemptToDeleteNonExistentKeyFromDB\n\t}\n\terr2 := ks.orm.ArchiveEncryptedSecretVRFKey(&vrfkey.EncryptedVRFKey{PublicKey: key})\n\treturn multierr.Append(err, err2)\n}", "func (bgpr BlobsGetPropertiesResponse) ArchiveStatus() string {\n\treturn bgpr.rawResponse.Header.Get(\"x-ms-archive-status\")\n}", "func (c CachedObject) IsExpired() bool {\r\n\r\n\telapsed := time.Now().Sub(c.CreatedAt.Add(time.Hour * getExpiryTimeInHrs()))\r\n\r\n\tif elapsed > 0.0 {\r\n\t\treturn true\r\n\t}\r\n\r\n\treturn false\r\n}", "func ArchiveArchiverPath() string {\n\treturn \"/archive\"\n}", "func (me TSearchHITsSortProperty) IsExpiration() bool { return me.String() == \"Expiration\" }", "func isArchiveFormatZip(archivePath string) error {\n\treadCloser, err := zip.OpenReader(archivePath)\n\tif err == nil {\n\t\t_ = readCloser.Close()\n\t}\n\treturn err\n}", "func (a *BooleanArchive) Len() int {\n\treturn a.size\n}", "func (r *RoleList) RawArchived() string {\n\treturn r.rawArchived\n}", "func (me TSearchHITsSortProperty) IsCreationTime() bool { return me.String() == \"CreationTime\" }", "func (upload *Upload) IsExpired() bool {\n\tif upload.ExpireAt != nil {\n\t\tif time.Now().After(*upload.ExpireAt) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func IsCreated(name string) bool {\n\treturn exec.Command(execName, \"inspect\", \"vm\", name).Run() == nil\n}" ]
[ "0.7998938", "0.7904601", "0.7904601", "0.68943787", "0.6770506", "0.67099184", "0.6696357", "0.66641325", "0.6639419", "0.66274315", "0.6606585", "0.65943253", "0.6559072", "0.6552962", "0.6517748", "0.6511882", "0.64961284", "0.6490567", "0.6486505", "0.6484248", "0.64326704", "0.6421908", "0.64202094", "0.6409425", "0.6397907", "0.6388498", "0.6384348", "0.6376828", "0.63089687", "0.6270892", "0.62568367", "0.62180126", "0.6118926", "0.61046416", "0.6091664", "0.6090562", "0.6082604", "0.6074421", "0.6040612", "0.6031975", "0.5997631", "0.5990044", "0.59836966", "0.59586686", "0.5948055", "0.59215873", "0.58920836", "0.58829427", "0.5844561", "0.5836523", "0.58020025", "0.575106", "0.5703843", "0.5672779", "0.5632328", "0.5594819", "0.55461246", "0.55305034", "0.5447593", "0.5439517", "0.525149", "0.5218389", "0.5192503", "0.51921856", "0.5172773", "0.51475525", "0.5140687", "0.5099644", "0.5068607", "0.49979028", "0.4983336", "0.49645463", "0.49638626", "0.49617326", "0.49529782", "0.49317315", "0.4894447", "0.48888665", "0.48789167", "0.48683837", "0.48680657", "0.48448524", "0.48349768", "0.482418", "0.4821425", "0.47935596", "0.47918546", "0.47830155", "0.47676235", "0.4757821", "0.47228503", "0.47014505", "0.4695662", "0.46798056", "0.46511257", "0.46341503", "0.46050787", "0.45909014", "0.45895723", "0.4580624" ]
0.8670008
0
IsPage return true if container is page
func (c *Container) IsPage() bool { return c.Title != "" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Content) IsPage() bool {\n\treturn c.Type == CONTENT_TYPE_PAGE\n}", "func (si *StructInfo) IsPage() bool {\n\treturn si.Kind == core.PAGE\n}", "func (p *Paginator) IsCurrentPage(page int) bool {\n\treturn p.CurrentPage() == page\n}", "func (p *Pagination) IsCurrentPage(page int) bool {\n\treturn p.CurrentPage() == page\n}", "func (t *Type) IsContainer() bool {\n\t_, ok := frugalContainerTypes[t.Name]\n\treturn ok\n}", "func (p Pagination) IsCurrent(page int) bool {\n\treturn page == p.CurrentPage\n}", "func (eReference *eReferenceImpl) IsContainer() bool {\n\tpanic(\"IsContainer not implemented\")\n}", "func (n PidMode) IsContainer() bool {\n\t_, ok := containerID(string(n))\n\treturn ok\n}", "func (p Page) inPage(s string) bool {\n\tfor _, v := range p.Links {\n\t\tif s == v.Url.String() || v.Url.String()+\"/\" == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (b *BaseElement) IsContainer() bool {\n\treturn false\n}", "func (n NetworkMode) IsContainer() bool {\n\t_, ok := containerID(string(n))\n\treturn ok\n}", "func (p *Pagination) Show() bool {\n\treturn p.NumberOfPages() > 1\n}", "func (p *Paginator) IsActive(page int) bool {\n\treturn p.Page() == page\n}", "func (o *PaginationProperties) HasPage() bool {\n\tif o != nil && o.Page != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Bundles) HasCurrentPage() bool {\n\tif o != nil && o.CurrentPage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Paginator) HasPages() bool {\n\treturn p.PageNums() > 1\n}", "func (r ContainerPage) IsEmpty() (bool, error) {\n\tcontainers, err := ExtractContainers(r)\n\treturn len(containers) == 0, err\n}", "func (n IpcMode) IsContainer() bool {\n\t_, ok := containerID(string(n))\n\treturn ok\n}", "func (o *SpansListRequestAttributes) HasPage() bool {\n\treturn o != nil && o.Page != nil\n}", "func (o *AclBindingListPage) HasPage() bool {\n\tif o != nil && o.Page != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Paginator) Show() bool {\n\treturn p.NumberOfPages() > 1\n}", "func InContainer() (bool, error) {\n\tns, err := GetContainerID()\n\treturn ns != \"\", err\n}", "func (p Page) IsValid() bool {\n\treturn p.valid\n}", "func (p *BlobContainersClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.ListContainerItems.NextLink == nil || len(*p.current.ListContainerItems.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (r *RoleList) HasPage() bool {\n\treturn r.hasPage\n}", "func (p Page) IsHTML() bool {\n\treturn p.Type().MediaType() == \"text/html\"\n}", "func (p *ServiceListContainersSegmentPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.ListContainersSegmentResponse.NextMarker == nil || len(*p.current.ListContainersSegmentResponse.NextMarker) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.con.Pipeline().Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listContainersSegmentHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (o *InlineResponse20014Projects) HasStartPage() bool {\n\tif o != nil && o.StartPage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (v *Variant) IsContainer() bool {\n\treturn gobool(C.g_variant_is_container(v.native()))\n}", "func (p *Pagination) IsLastPage() bool {\n\treturn p.CurrentPage >= p.TotalPages\n}", "func (c CgroupSpec) IsContainer() bool {\n\t_, ok := containerID(string(c))\n\treturn ok\n}", "func (p *Pagination) isFirst() bool {\n\treturn p.PageNumber == 1\n}", "func (o *ViewMetaPage) HasPageSize() bool {\n\tif o != nil && o.PageSize != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func hasLandingPage(collection model.Pages, dir *model.Page) bool {\n\thasLanding := false\n\tfor _, page := range collection {\n\t\tif page.Type == \"file\" && page.Slug == dir.Slug {\n\t\t\thasLanding = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn hasLanding\n}", "func isContainer(mode string) bool {\n\tparts := strings.SplitN(mode, \":\", 2)\n\treturn len(parts) > 1 && parts[0] == \"container\"\n}", "func IsContainerized() (bool, error) {\n\t// TODO: Implement jail detection for freeBSD\n\treturn false, errors.New(\"cannot detect if we are in container\")\n}", "func (c *Container) isRun() bool {\n\tif c == nil {\n\t\tpanic(\"calling isRun on nil container\")\n\t}\n\treturn c.typeID == ContainerRun\n}", "func (o *StorageNetAppCloudTargetAllOf) HasContainer() bool {\n\tif o != nil && o.Container != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *Collection) IsPostsCollection() bool { return c.Name == postsName }", "func (page *Page) AddPage(link *Page) bool {\n\tfor _, l := range page.Pages {\n\t\tif l == link {\n\t\t\treturn false\n\t\t}\n\t}\n\tpage.Pages = append(page.Pages, link)\n\treturn true\n}", "func IsContainerized() (bool, error) {\n\tb, err := os.ReadFile(proc1Cgroup)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor _, line := range bytes.Split(b, []byte{'\\n'}) {\n\t\tif len(line) > 0 && !bytes.HasSuffix(line, []byte(\":/\")) && !bytes.HasSuffix(line, []byte(\":/init.scope\")) {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func (p *ContainerListBlobHierarchySegmentPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.ListBlobsHierarchySegmentResponse.NextMarker == nil || len(*p.current.ListBlobsHierarchySegmentResponse.NextMarker) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.con.Pipeline().Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listBlobHierarchySegmentHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (o *OriginCollection) GetPageOk() (*PageType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Page, true\n}", "func (q *QuestionnaireT) IsInNavigation(pageIdx int) bool {\n\n\tif pageIdx < 0 || pageIdx > len(q.Pages)-1 {\n\t\treturn false\n\t}\n\n\tif q.Pages[pageIdx].NoNavigation {\n\t\treturn false\n\t}\n\n\tif fc, ok := naviFuncs[q.Pages[pageIdx].NavigationCondition]; ok {\n\t\treturn fc(q, pageIdx)\n\t}\n\n\treturn true\n}", "func (p *ManagementClientGetActiveSessionsPager) NextPage(ctx context.Context) bool {\n\tif !p.second {\n\t\tp.second = true\n\t\treturn true\n\t} else if !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.BastionActiveSessionListResult.NextLink == nil || len(*p.current.BastionActiveSessionListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, *p.current.BastionActiveSessionListResult.NextLink)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.getActiveSessionsHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p *StoragesClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.StorageResourceCollection.NextLink == nil || len(*p.current.StorageResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p nullPage) IsEmpty() (bool, error) {\n\treturn true, nil\n}", "func (p *TestPager) Check() (bool, error) {\n return false, nil\n}", "func IsAjaxPage(vals url.Values) bool {\n\tpage := getPageName(vals)\n\tajax := vals.Get(\"ajax\")\n\tasJson := vals.Get(\"asJson\")\n\treturn page == FetchEventboxAjaxPageName ||\n\t\tpage == FetchResourcesAjaxPageName ||\n\t\tpage == GalaxyContentAjaxPageName ||\n\t\tpage == EventListAjaxPageName ||\n\t\tpage == AjaxChatAjaxPageName ||\n\t\tpage == NoticesAjaxPageName ||\n\t\tpage == RepairlayerAjaxPageName ||\n\t\tpage == TechtreeAjaxPageName ||\n\t\tpage == PhalanxAjaxPageName ||\n\t\tpage == ShareReportOverlayAjaxPageName ||\n\t\tpage == JumpgatelayerAjaxPageName ||\n\t\tpage == FederationlayerAjaxPageName ||\n\t\tpage == UnionchangeAjaxPageName ||\n\t\tpage == ChangenickAjaxPageName ||\n\t\tpage == PlanetlayerAjaxPageName ||\n\t\tpage == TraderlayerAjaxPageName ||\n\t\tpage == PlanetRenameAjaxPageName ||\n\t\tpage == RightmenuAjaxPageName ||\n\t\tpage == AllianceOverviewAjaxPageName ||\n\t\tpage == SupportAjaxPageName ||\n\t\tpage == BuffActivationAjaxPageName ||\n\t\tpage == AuctioneerAjaxPageName ||\n\t\tpage == HighscoreContentAjaxPageName ||\n\t\tajax == \"1\" ||\n\t\tasJson == \"1\"\n}", "func (p *Paginator) Page() int {\n\tif p.page != 0 {\n\t\treturn p.page\n\t}\n\tif p.Request.Form == nil {\n\t\tp.Request.ParseForm()\n\t}\n\tp.page, _ = strconv.Atoi(p.Request.Form.Get(\"p\"))\n\tif p.page > p.PageNums() {\n\t\tp.page = p.PageNums()\n\t}\n\tif p.page <= 0 {\n\t\tp.page = 1\n\t}\n\treturn p.page\n}", "func (t *Tailer) isContainerEntry(entry *sdjournal.JournalEntry) bool {\n\t_, exists := entry.Fields[containerIDKey]\n\treturn exists\n}", "func (p *Page) Valid() bool {\n\tif p.Limit > 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func (c Page) Page() revel.Result {\n\n\tc.RenderArgs[\"Site\"] = site.Site\n\n\t// Create PageData\n\tpdata := site.LoadPage(c.Params.Route.Get(\"section\"), c.Params.Route.Get(\"page\"))\n\tc.RenderArgs[\"Page\"] = pdata\n\n\tif pdata.Error != nil {\n\t\treturn c.NotFound(\"missing secton\")\n\t}\n\n\tc.RenderArgs[\"Section\"] = site.Site.Sections[pdata.Section]\n\n\treturn c.Render()\n\n}", "func (o *Partition) GetIsContainer(ctx context.Context) (isContainer bool, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfacePartition, \"IsContainer\").Store(&isContainer)\n\treturn\n}", "func (p Page) Type() Type {\n\treturn p.PageType\n}", "func (c *ColumnChunkMetaData) HasIndexPage() bool { return c.columnMeta.IsSetIndexPageOffset() }", "func (p *ManagementClientGetBastionShareableLinkPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.BastionShareableLinkListResult.NextLink == nil || len(*p.current.BastionShareableLinkListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.getBastionShareableLinkHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p *Pagination) hasMoreThanOnePage() bool {\n\treturn p.Limit < p.Total\n}", "func (m Model) OnLastPage() bool {\n\treturn m.Page == m.TotalPages-1\n}", "func (*offsetPageInfoImpl) HasNextPage(p graphql.ResolveParams) (bool, error) {\n\tpage := p.Source.(offsetPageInfo)\n\treturn (page.offset + page.limit) < page.totalCount, nil\n}", "func (o *DeliveryGetOriginsResponse) HasPageInfo() bool {\n\tif o != nil && o.PageInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func inContainer() opt.Bool {\n\tif runtime.GOOS != \"linux\" {\n\t\treturn \"\"\n\t}\n\tvar ret opt.Bool\n\tret.Set(false)\n\tif _, err := os.Stat(\"/.dockerenv\"); err == nil {\n\t\tret.Set(true)\n\t\treturn ret\n\t}\n\tif _, err := os.Stat(\"/run/.containerenv\"); err == nil {\n\t\t// See https://github.com/cri-o/cri-o/issues/5461\n\t\tret.Set(true)\n\t\treturn ret\n\t}\n\tlineread.File(\"/proc/1/cgroup\", func(line []byte) error {\n\t\tif mem.Contains(mem.B(line), mem.S(\"/docker/\")) ||\n\t\t\tmem.Contains(mem.B(line), mem.S(\"/lxc/\")) {\n\t\t\tret.Set(true)\n\t\t\treturn io.EOF // arbitrary non-nil error to stop loop\n\t\t}\n\t\treturn nil\n\t})\n\tlineread.File(\"/proc/mounts\", func(line []byte) error {\n\t\tif mem.Contains(mem.B(line), mem.S(\"lxcfs /proc/cpuinfo fuse.lxcfs\")) {\n\t\t\tret.Set(true)\n\t\t\treturn io.EOF\n\t\t}\n\t\treturn nil\n\t})\n\treturn ret\n}", "func (p *Pages) Has(pageName string) bool {\n\tvar pageHandle = cleanAllSlashes(handlePath(pageName))\n\tvar prefixPage = cleanAllSlashes(handlePath(p.prefix, pageName))\n\tp.sl.RLock()\n\tif _, exists := p.managers[prefixPage]; exists {\n\t\tp.sl.RUnlock()\n\t\treturn true\n\t}\n\tif _, exists := p.managers[pageHandle]; exists {\n\t\tp.sl.RUnlock()\n\t\treturn true\n\t}\n\tp.sl.RUnlock()\n\treturn false\n}", "func (p *DeploymentsClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.DeploymentResourceCollection.NextLink == nil || len(*p.current.DeploymentResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (o *ViewMetaPage) HasPageOffset() bool {\n\tif o != nil && o.PageOffset != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CdnGetScopeRulesResponse) HasPageInfo() bool {\n\tif o != nil && o.PageInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Bitlinks) HasPagination() bool {\n\tif o != nil && o.Pagination != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *PrinterDefaults) GetFitPdfToPage()(*bool) {\n val, err := m.GetBackingStore().Get(\"fitPdfToPage\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (o *Origin1) GetPageOk() (*PageType, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Page, true\n}", "func (p *BuildServiceClientListBuildServicesPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.BuildServiceCollection.NextLink == nil || len(*p.current.BuildServiceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listBuildServicesHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p *CustomDomainsClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.CustomDomainResourceCollection.NextLink == nil || len(*p.current.CustomDomainResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (me TxsdCounterSimpleContentExtensionType) IsSession() bool { return me.String() == \"session\" }", "func (p *DeploymentsClientListForClusterPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.DeploymentResourceCollection.NextLink == nil || len(*p.current.DeploymentResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listForClusterHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p *StorageTargetsClientListByCachePager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.StorageTargetsResult.NextLink == nil || len(*p.current.StorageTargetsResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listByCacheHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (is *MenuPage) WillHide() {\n}", "func (p *Pagination) isLast() bool {\n\tif p.Total == 0 {\n\t\treturn true\n\t}\n\treturn p.Total > (p.PageNumber-1)*p.PageSize && !p.HasNext()\n}", "func (p *ContainerListBlobFlatSegmentPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.ListBlobsFlatSegmentResponse.NextMarker == nil || len(*p.current.ListBlobsFlatSegmentResponse.NextMarker) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.con.Pipeline().Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listBlobFlatSegmentHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func detectContainer() bool {\n\tif runtime.GOOS != \"linux\" {\n\t\treturn false\n\t}\n\n\tfile, err := os.Open(\"/proc/1/cgroup\")\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer file.Close()\n\n\ti := 0\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\ti++\n\t\tif i > 1000 {\n\t\t\treturn false\n\t\t}\n\n\t\tline := scanner.Text()\n\t\tparts := strings.SplitN(line, \":\", 3)\n\t\tif len(parts) < 3 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.Contains(parts[2], \"docker\") ||\n\t\t\tstrings.Contains(parts[2], \"lxc\") ||\n\t\t\tstrings.Contains(parts[2], \"moby\") {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (p *SmartGroupsClientGetAllPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.SmartGroupsList.NextLink == nil || len(*p.current.SmartGroupsList.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.getAllHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (*offsetPageInfoImpl) HasPreviousPage(p graphql.ResolveParams) (bool, error) {\n\tpage := p.Source.(offsetPageInfo)\n\treturn page.offset > 0, nil\n}", "func (p *BastionHostsClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.BastionHostListResult.NextLink == nil || len(*p.current.BastionHostListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p *APIPortalCustomDomainsClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.APIPortalCustomDomainResourceCollection.NextLink == nil || len(*p.current.APIPortalCustomDomainResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func imageIsParent(store storage.Store, topLayer string) (bool, error) {\n\tchildren, err := getChildren(store, topLayer)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn len(children) > 0, nil\n}", "func (o *PaginationProperties) HasNextPage() bool {\n\tif o != nil && o.NextPage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *RecordSetsClientListByTypePager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.RecordSetListResult.NextLink == nil || len(*p.current.RecordSetListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listByTypeHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p ServicePage) IsEmpty() (bool, error) {\n\tservices, err := ExtractServices(p)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\treturn len(services) == 0, nil\n}", "func (pager *ProjectsPager) HasNext() bool {\n\treturn pager.hasNext\n}", "func (p *OperationClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.OperationList.NextLink == nil || len(*p.current.OperationList.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (spec *SourceSpec) IsContainerBuild() bool {\n\treturn spec.ContainerImage.Image != \"\"\n}", "func (p *Pagination) hasNext() bool {\n\tif p.CurrentPage*p.Limit >= p.Total {\n\t\treturn false\n\t}\n\treturn true\n}", "func (view *DetailsView) IsVisible() bool {\n\tif view == nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func PageHandler(w http.ResponseWriter, r *http.Request) (handled bool) {\n\tlog.Println(\"PageHandler called in example plugin\")\n\treturn false\n}", "func (p *ServicesClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.ServiceResourceList.NextLink == nil || len(*p.current.ServiceResourceList.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (b BaseAppOption) IsManyPerContainerType() {}", "func (p *ServiceTagInformationClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.ServiceTagInformationListResult.NextLink == nil || len(*p.current.ServiceTagInformationListResult.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p *ConfigurationServicesClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.ConfigurationServiceResourceCollection.NextLink == nil || len(*p.current.ConfigurationServiceResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p *BuildServiceBuilderClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.BuilderResourceCollection.NextLink == nil || len(*p.current.BuilderResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (c *Container) isArray() bool {\n\tif c == nil {\n\t\tpanic(\"calling isArray on nil container\")\n\t}\n\treturn c.typeID == ContainerArray\n}", "func (p *GatewayCustomDomainsClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.GatewayCustomDomainResourceCollection.NextLink == nil || len(*p.current.GatewayCustomDomainResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}", "func (p *AppsClientListPager) NextPage(ctx context.Context) bool {\n\tvar req *policy.Request\n\tvar err error\n\tif !reflect.ValueOf(p.current).IsZero() {\n\t\tif p.current.AppResourceCollection.NextLink == nil || len(*p.current.AppResourceCollection.NextLink) == 0 {\n\t\t\treturn false\n\t\t}\n\t\treq, err = p.advancer(ctx, p.current)\n\t} else {\n\t\treq, err = p.requester(ctx)\n\t}\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tresp, err := p.client.pl.Do(req)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\tp.err = runtime.NewResponseError(resp)\n\t\treturn false\n\t}\n\tresult, err := p.client.listHandleResponse(resp)\n\tif err != nil {\n\t\tp.err = err\n\t\treturn false\n\t}\n\tp.current = result\n\treturn true\n}" ]
[ "0.7772381", "0.72924674", "0.632932", "0.61344856", "0.610035", "0.60268337", "0.6011801", "0.58766586", "0.5786298", "0.57827115", "0.57642055", "0.5759891", "0.566043", "0.56425154", "0.56420946", "0.5632037", "0.5631244", "0.5612727", "0.5582618", "0.5552817", "0.55508125", "0.55412984", "0.5514536", "0.54886127", "0.54673713", "0.54460883", "0.54145193", "0.5385984", "0.5329364", "0.532783", "0.5288585", "0.526911", "0.52689385", "0.52688444", "0.5268536", "0.5249099", "0.52339494", "0.5223381", "0.5206846", "0.51774204", "0.51340187", "0.50956583", "0.5091584", "0.5089482", "0.5038107", "0.502906", "0.5023562", "0.50196236", "0.5015", "0.5014822", "0.50041664", "0.50034827", "0.49934283", "0.49932694", "0.4978898", "0.49695393", "0.49543983", "0.4949705", "0.49483737", "0.4939361", "0.49306762", "0.49038556", "0.48995695", "0.48943815", "0.48901647", "0.48805463", "0.48788267", "0.4857029", "0.48562545", "0.48548484", "0.4852946", "0.48496076", "0.48469788", "0.48451343", "0.4829508", "0.48187542", "0.4818075", "0.48148733", "0.47999486", "0.4794854", "0.47917855", "0.4787408", "0.477824", "0.47727877", "0.47592992", "0.47583613", "0.47552857", "0.4749606", "0.47423005", "0.47405085", "0.47395974", "0.47349742", "0.4733931", "0.47295636", "0.4727889", "0.47233707", "0.47216886", "0.4720963", "0.47192878", "0.471832" ]
0.8593985
0
IsSpace return true if container is space
func (c *Container) IsSpace() bool { return c.Key != "" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func isSpace(c byte) bool {\n\treturn c == space\n}", "func isSpace(b byte) bool {\n\tswitch b {\n\tcase 32, 12, 9:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func IsSpaceRoot(r *Node) bool {\n\tpath := r.InternalPath()\n\tif spaceNameBytes, err := xattr.Get(path, xattrs.SpaceNameAttr); err == nil {\n\t\tif string(spaceNameBytes) != \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *IpamNetworkDataData) HasSpaceIsTemplate() bool {\n\tif o != nil && o.SpaceIsTemplate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsContainerized() (bool, error) {\n\t// TODO: Implement jail detection for freeBSD\n\treturn false, errors.New(\"cannot detect if we are in container\")\n}", "func (me TxsdClipPathTypeClipPathUnits) IsUserSpace() bool { return me.String() == \"userSpace\" }", "func (o *IpamNetworkDataData) HasSpaceDescription() bool {\n\tif o != nil && o.SpaceDescription != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (n *Node) IsSpaceRoot(ctx context.Context) bool {\n\t_, err := n.Xattr(ctx, prefixes.SpaceNameAttr)\n\treturn err == nil\n}", "func (me Tokens) HasSpaces() bool {\n\tfor i := 1; i < len(me); i++ {\n\t\tif diff := me[i].Pos.Off0 - (me[i-1].Pos.Off0 + len(me[i-1].Lexeme)); diff > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func isContainer(mode string) bool {\n\tparts := strings.SplitN(mode, \":\", 2)\n\treturn len(parts) > 1 && parts[0] == \"container\"\n}", "func isSpace(c rune) bool {\n\treturn c == ' ' || c == '\\t'\n}", "func (o *IpamNetworkDataData) HasSpaceName() bool {\n\tif o != nil && o.SpaceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (adapter *LevelAdapter) IsCyberspace() (result bool) {\n\tif properties := adapter.properties(); properties != nil {\n\t\tresult = *properties.CyberspaceFlag\n\t}\n\treturn\n}", "func (me TxsdTspanTypeLengthAdjust) IsSpacing() bool { return me.String() == \"spacing\" }", "func (o *IpamNetworkDataData) HasSpaceClassName() bool {\n\tif o != nil && o.SpaceClassName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdMarkerTypeMarkerUnits) IsUserSpace() bool { return me.String() == \"userSpace\" }", "func isContainerMetric(e *loggregator_v2.Envelope) bool {\n\tgauge := e.GetGauge()\n\tif len(gauge.Metrics) != 5 {\n\t\treturn false\n\t}\n\trequired := []string{\n\t\t\"cpu\",\n\t\t\"memory\",\n\t\t\"disk\",\n\t\t\"memory_quota\",\n\t\t\"disk_quota\",\n\t}\n\n\tfor _, req := range required {\n\t\tif _, found := gauge.Metrics[req]; !found {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (t *Type) IsContainer() bool {\n\t_, ok := frugalContainerTypes[t.Name]\n\treturn ok\n}", "func (s SpaceUnit) Space(SpaceUnit, int8) MetricUnit {\n\tpanic(\"Cannot add another space unit\")\n}", "func IsSpace(rune int) bool {\n\tif rune <= 0xFF {\t// quick Latin-1 check\n\t\tswitch rune {\n\t\tcase '\\t', '\\n', '\\v', '\\f', '\\r', ' ', 0x85, 0xA0:\n\t\t\treturn true\n\t\t}\n\t\treturn false;\n\t}\n\treturn Is(White_Space, rune);\n}", "func (s *Attribute) Space() *Dataspace {\n\thid := C.H5Aget_space(s.id)\n\tif int(hid) > 0 {\n\t\treturn newDataspace(hid)\n\t}\n\treturn nil\n}", "func (space *Space) IsNil() bool {\n\treturn space.Kind == 0\n}", "func IsSpaceChar(c byte) bool {\n\treturn c == 32 || c == 9\n}", "func isSpace(r rune) bool {\n\t// https://github.com/toml-lang/toml#spec\n\t// Whitespace means tab (0x09) or space (0x20)\n\treturn r == 0x09 || r == 0x20\n}", "func (n NetworkMode) IsContainer() bool {\n\t_, ok := containerID(string(n))\n\treturn ok\n}", "func (c CountUnit) Space(s SpaceUnit, dimension int8) MetricUnit {\n\treturn (&metricUnit{uint32(c)}).Space(s, dimension)\n}", "func IsSpace(r rune) bool", "func IsContainerized() (bool, error) {\n\tb, err := os.ReadFile(proc1Cgroup)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor _, line := range bytes.Split(b, []byte{'\\n'}) {\n\t\tif len(line) > 0 && !bytes.HasSuffix(line, []byte(\":/\")) && !bytes.HasSuffix(line, []byte(\":/init.scope\")) {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func isSpace(r rune) bool {\n\tswitch r {\n\tcase ' ', '\\t', '\\n', '\\v', '\\f', '\\r':\n\t\treturn true\n\t}\n\treturn false\n}", "func (s *Dataset) Space() *Dataspace {\n\thid := C.H5Dget_space(s.id)\n\tif int(hid) > 0 {\n\t\treturn newDataspace(hid)\n\t}\n\treturn nil\n}", "func (o *IpamNetworkDataData) HasSpaceId() bool {\n\tif o != nil && o.SpaceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t'\n}", "func (o *IpamNetworkDataData) HasSpaceParentSpaceId() bool {\n\tif o != nil && o.SpaceParentSpaceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (pod Pod) IsMemBound() bool {\n\tfor _, container := range pod.Containers {\n\t\tif container.IsMemBound() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (t TimeUnit) Space(s SpaceUnit, dimension int8) MetricUnit {\n\treturn (&metricUnit{uint32(t)}).Space(s, dimension)\n}", "func (l *Lexer) isSpace(ch byte) bool {\n\treturn ch == ' '\n}", "func (n PidMode) IsContainer() bool {\n\t_, ok := containerID(string(n))\n\treturn ok\n}", "func isSpace(r rune) bool {\n\tswitch r {\n\tcase '\\t', '\\v', '\\f', '\\r', ' ', 0x85, 0xA0:\n\t\treturn true\n\t}\n\treturn false\n}", "func (sp booleanSpace) Size() int {\n\treturn 2\n}", "func (o *StorageNetAppCloudTargetAllOf) HasIpspace() bool {\n\tif o != nil && o.Ipspace != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StorageNetAppCloudTargetAllOf) HasContainer() bool {\n\tif o != nil && o.Container != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isContainerTerminated(info *cadvisorapiv2.ContainerInfo) bool {\n\tif !info.Spec.HasCpu && !info.Spec.HasMemory && !info.Spec.HasNetwork {\n\t\treturn true\n\t}\n\tcstat, found := latestContainerStats(info)\n\tif !found {\n\t\treturn true\n\t}\n\tif cstat.Network != nil {\n\t\tiStats := cadvisorInfoToNetworkStats(info)\n\t\tif iStats != nil {\n\t\t\tfor _, iStat := range iStats.Interfaces {\n\t\t\t\tif *iStat.RxErrors != 0 || *iStat.TxErrors != 0 || *iStat.RxBytes != 0 || *iStat.TxBytes != 0 {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif cstat.CpuInst == nil || cstat.Memory == nil {\n\t\treturn true\n\t}\n\treturn cstat.CpuInst.Usage.Total == 0 && cstat.Memory.RSS == 0\n}", "func (o *IpamNetworkDataData) GetSpaceIsTemplate() string {\n\tif o == nil || o.SpaceIsTemplate == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.SpaceIsTemplate\n}", "func (n IpcMode) IsContainer() bool {\n\t_, ok := containerID(string(n))\n\treturn ok\n}", "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t' || r == '\\n'\n}", "func (o *IpamNetworkDataData) HasSpaceClassParameters() bool {\n\tif o != nil && o.SpaceClassParameters != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *Room) spaceFree(loc Point) bool {\n\tif loc.x < 0 || loc.x > 4 || loc.y < 0 || loc.y > 8 {\n\t\treturn false\n\t}\n\n\tif r.Grid[loc.x][loc.y].Solid {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func isSpace(b ...byte) bool {\n\n\treturn bytes.Contains([]byte(\" \\n\\r\\t\"), b)\n}", "func (info *LevelInformation) IsCyberspace() bool {\n\treturn info.CyberspaceFlag != 0\n}", "func (b *BaseElement) IsContainer() bool {\n\treturn false\n}", "func (c *CircBuf) Space() int {\n\treturn (c.tail - c.head - 1) & (len(c.buf) - 1)\n}", "func (o *HyperflexSnapshotStatus) HasUsedSpace() bool {\n\tif o != nil && o.UsedSpace != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *IpamAliasEditInput) HasSpaceName() bool {\n\tif o != nil && o.SpaceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (h *Heap) IsEmpty() bool {\n\tif len(h.slice) == 0 {\n\t\treturn true\n\t}\n\n\tif (h.trimValue != -1) && (h.slice[0].distance >= h.trimValue) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isSpace(r rune) bool {\n\treturn r == ' ' || r == '\\t' || r == '\\n' || r == '\\r' || r == '\\f' || r == '\\v'\n}", "func (v *Variant) IsContainer() bool {\n\treturn gobool(C.g_variant_is_container(v.native()))\n}", "func isSpace(r rune) bool {\n\tswitch {\n\tcase r == 0x85:\n\t\treturn false\n\tcase\n\t\tunicode.IsSpace(r),\n\t\tr == '\\uFEFF': // zero width non-breaking space\n\t\treturn true\n\n\tdefault:\n\t\treturn false\n\t}\n}", "func (o *Partition) GetIsContainer(ctx context.Context) (isContainer bool, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfacePartition, \"IsContainer\").Store(&isContainer)\n\treturn\n}", "func (o *StorageHyperFlexStorageContainer) HasProvisionedCapacity() bool {\n\tif o != nil && o.ProvisionedCapacity != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *IpamNetworkDataData) HasParentSpaceName() bool {\n\tif o != nil && o.ParentSpaceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c CgroupSpec) IsContainer() bool {\n\t_, ok := containerID(string(c))\n\treturn ok\n}", "func (eReference *eReferenceImpl) IsContainer() bool {\n\tpanic(\"IsContainer not implemented\")\n}", "func isSpaceChar(r rune) bool {\n\treturn r == ' ' || r == '\\t' || r == '\\r' || r == '\\n'\n}", "func (me TxsdClipPathTypeClipPathUnits) IsUserSpaceOnUse() bool {\n\treturn me.String() == \"userSpaceOnUse\"\n}", "func (o *StorageNetAppCifsShareAllOf) HasStorageContainer() bool {\n\tif o != nil && o.StorageContainer != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsDimension(t Type) bool {\n\tif v, ok := t.(*Operator); ok {\n\t\treturn v.Name == dimensionName\n\t}\n\treturn false\n}", "func (h *Heap) IsEmpty() bool { return h.count == 0 }", "func isSpace(b byte) bool {\n\treturn b == ' ' || b == '\\f' || b == '\\n' || b == '\\r' || b == '\\t' || b == '\\v'\n}", "func (s SetOfSpaces) Contains(space int) bool {\r\n\tfor _, index := range s.indices {\r\n\t\tif index == space {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}", "func (r ContainerPage) IsEmpty() (bool, error) {\n\tcontainers, err := ExtractContainers(r)\n\treturn len(containers) == 0, err\n}", "func isSpace(r rune) bool {\r\n\treturn r == ' ' || r == '\\t' || r == '\\n' || r == ','\r\n}", "func (o *IpamAliasEditInput) HasSpaceId() bool {\n\tif o != nil && o.SpaceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (sp *Space) Length() int {\n\treturn len(*sp)\n}", "func (u *User) HaveSpaceFor(realpath string) bool {\n\tif u.StorageQuota.HaveSpace(fs.GetFileSize(realpath)) {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "func (t Token) IsLength() bool {\n\tif t.TokenType == css.DimensionToken {\n\t\treturn true\n\t} else if t.TokenType == css.NumberToken && t.Data[0] == '0' {\n\t\treturn true\n\t} else if t.TokenType == css.FunctionToken {\n\t\tfun := ToHash(t.Data[:len(t.Data)-1])\n\t\tif fun == Calc || fun == Min || fun == Max || fun == Clamp || fun == Attr || fun == Var || fun == Env {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *IpamNetworkDataData) HasParentSpaceId() bool {\n\tif o != nil && o.ParentSpaceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdMovementType) IsGc() bool { return me.String() == \"GC\" }", "func isSpace(r rune) bool {\n\tif r <= '\\u00FF' {\n\t\tswitch r {\n\t\tcase ' ', '\\t', '\\v', '\\f':\n\t\t\treturn true\n\t\tcase '\\u0085', '\\u00A0':\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tif '\\u2000' <= r && r <= '\\u200a' {\n\t\treturn true\n\t}\n\tswitch r {\n\tcase '\\u1680', '\\u2028', '\\u2029', '\\u202f', '\\u205f', '\\u3000':\n\t\treturn true\n\t}\n\treturn false\n}", "func IsSpaces(str []byte) bool {\n\tfor _, c := range str {\n\t\tif c != ' ' {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (s *Spaces) Contains(spaceName string) bool {\n\tspaceNameToUpper := strings.ToUpper(spaceName)\n\tfor _, v := range s.Spaces {\n\t\tif strings.ToUpper(v) == spaceNameToUpper {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (wb *WidgetBase) AlwaysConsumeSpace() bool {\n\treturn wb.alwaysConsumeSpace\n}", "func (sm *SpaceManager) Space(ctx context.Context, space string) (storage.Space, error) {\n\tif !validateName(space) {\n\t\treturn nil, ErrorInvalidParam.Format(\"space\", space)\n\t}\n\treturn NewSpace(sm, space)\n}", "func (obj *Object) HasDims() bool {\n\treturn obj.ListObject() != nil || (obj.HyperCube() != nil && len(obj.HyperCube().DimensionInfo) > 0)\n}", "func (o *DnsZoneDataData) HasZoneSpaceName() bool {\n\tif o != nil && o.ZoneSpaceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TxsdMarkerTypeMarkerUnits) IsUserSpaceOnUse() bool { return me.String() == \"userSpaceOnUse\" }", "func (vec Vector2) IsUnit() bool {\n\treturn vec.Len() == 1\n}", "func (space Space) Dim(data []core.Elemt) int {\n\treturn space.vspace.Dim(data)\n}", "func CheckIsSpace(s string) bool {\n\tspace := true\n\n\tfor _, x := range s {\n\t\tif !unicode.IsSpace(x) {\n\t\t\tspace = false\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn space\n}", "func HasSpace(s string) bool {\n\tif len(s) == 0 {\n\t\treturn false\n\t}\n\tfor _, r := range s {\n\t\tif unicode.IsSpace(r) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (n *Node) IsDir(ctx context.Context) bool {\n\tattr, _ := n.XattrInt32(ctx, prefixes.TypeAttr)\n\treturn attr == int32(provider.ResourceType_RESOURCE_TYPE_CONTAINER)\n}", "func isWhitespace(ch rune) bool {\n\treturn ch == ' ' || ch == '\\t'\n}", "func (t *Type) IsRegularMemory() bool", "func (dist Beta) Space() RealSpace {\n\treturn dist.space\n}", "func (o *IpamNetworkDataData) SetSpaceIsTemplate(v string) {\n\to.SpaceIsTemplate = &v\n}", "func (pod Pod) IsCpuBound() bool {\n\tfor _, container := range pod.Containers {\n\t\tif container.IsCpuBound() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (g *Group) IsFull() bool {\n\treturn g.Size() >= g.MaxSize\n}" ]
[ "0.6675399", "0.63208467", "0.62378913", "0.61830646", "0.6046376", "0.6005166", "0.59704506", "0.5963759", "0.59173125", "0.590388", "0.5838448", "0.58182573", "0.5815866", "0.5789589", "0.5774671", "0.57681674", "0.5735624", "0.5731149", "0.5728202", "0.57250816", "0.57173115", "0.5705963", "0.56934917", "0.568219", "0.566712", "0.566218", "0.5661247", "0.5659956", "0.5658281", "0.56569105", "0.5656165", "0.56448156", "0.56448156", "0.56448156", "0.56448156", "0.56448156", "0.563795", "0.5625201", "0.5621792", "0.5592632", "0.55911756", "0.5587459", "0.5586323", "0.5549792", "0.5539093", "0.5517834", "0.5500408", "0.54800737", "0.5466013", "0.5459126", "0.54579794", "0.54517376", "0.5451426", "0.54417974", "0.5413032", "0.54117143", "0.5406505", "0.5403045", "0.5380143", "0.5337673", "0.53376025", "0.5335052", "0.53267956", "0.53076184", "0.5296922", "0.52765137", "0.5261227", "0.526096", "0.52572453", "0.52534205", "0.52452725", "0.524462", "0.5236087", "0.5236026", "0.52303493", "0.5197583", "0.5192101", "0.5176605", "0.516905", "0.5167984", "0.51594543", "0.5150859", "0.51485676", "0.51438236", "0.5138062", "0.5138017", "0.5086993", "0.5084447", "0.50730944", "0.5070843", "0.506718", "0.5065266", "0.50642115", "0.5061593", "0.5054326", "0.505145", "0.5034944", "0.50320035", "0.5023447", "0.502041" ]
0.8235814
0
Combined return united slice with all watchers
func (wi *WatchInfo) Combined() []*Watcher { var result []*Watcher result = append(result, wi.PageWatchers...) MAINLOOP: for _, watcher := range wi.SpaceWatchers { for _, pageWatcher := range wi.PageWatchers { if watcher.Key == pageWatcher.Key { continue MAINLOOP } } result = append(result, watcher) } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ThingChanSlice(inp ...[]Thing) (out ThingFrom) {\n\tcha := make(chan Thing)\n\tgo chanThingSlice(cha, inp...)\n\treturn cha\n}", "func mutatingWatcherFor(source watch.Interface, mutator func(runtime.Object) error) watch.Interface {\n\tw := mutatingWatcher{\n\t\tmutator: mutator,\n\t\tsource: source,\n\t\toutput: make(chan watch.Event),\n\t\twg: &sync.WaitGroup{},\n\t}\n\tw.wg.Add(1)\n\tgo func(input <-chan watch.Event, output chan<- watch.Event) {\n\t\tdefer w.wg.Done()\n\t\tfor event := range input {\n\t\t\tif err := mutator(event.Object); err != nil {\n\t\t\t\toutput <- watch.Event{\n\t\t\t\t\tType: watch.Error,\n\t\t\t\t\tObject: &errors.NewInternalError(fmt.Errorf(\"failed to mutate object in watch event: %v\", err)).ErrStatus,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput <- event\n\t\t\t}\n\t\t}\n\t}(source.ResultChan(), w.output)\n\treturn &w\n}", "func (w *Window) Slice() []float64 {\n\tw.mx.RLock()\n\t// 4 Times faster than \"defer Unlock\"\n\tret := w.base[w.start : w.start+w.Len]\n\tw.mx.RUnlock()\n\treturn ret\n}", "func (iobuf *buf) slice(free, base, bound uint) *Slice {\n\tatomic.AddInt32(&iobuf.refcount, 1)\n\treturn &Slice{iobuf: iobuf, free: free, base: base, Contents: iobuf.Contents[base:bound]}\n}", "func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {\n\tklog.V(3).Infof(\"ListAndWatch %v. filter bounds %+v. name %s. Watch page size %v. resync period %v\",\n\t\tr.expectedType, r.filterBounds, r.name, r.WatchListPageSize, r.resyncPeriod)\n\tvar resourceVersion string\n\n\t// Explicitly set \"0\" as resource version - it's fine for the List()\n\t// to be served from cache and potentially be delayed relative to\n\t// etcd contents. Reflector framework will catch up via Watch() eventually.\n\t// When ResourceVersion is empty, list will get from api server cache\n\toptions := metav1.ListOptions{ResourceVersion: r.listFromResourceVersion}\n\n\tif len(r.filterBounds) > 0 {\n\t\tif r.hasInitBounds() {\n\t\t\tif !r.waitForBoundInit(stopCh) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\tselect {\n\t\t\tcase <-stopCh:\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\tklog.V(4).Infof(\"ListAndWatchWithReset default fall through. bounds %+v\", r.filterBounds)\n\t\t\t}\n\t\t}\n\n\t\t// Pick up any bound changes\n\t\toptions = appendFieldSelector(options, r.createHashkeyListOptions())\n\t}\n\n\t// LIST\n\tif err := func() error {\n\t\tinitTrace := trace.New(\"Reflector \" + r.name + \" ListAndWatch\")\n\t\tdefer initTrace.LogIfLong(10 * time.Second)\n\t\tvar list runtime.Object\n\t\tvar err error\n\t\tlistCh := make(chan struct{}, 1)\n\t\tpanicCh := make(chan interface{}, 1)\n\t\tgo func() {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tpanicCh <- r\n\t\t\t\t}\n\t\t\t}()\n\t\t\t// Attempt to gather list in chunks, if supported by listerWatcher, if not, the first\n\t\t\t// list request will return the full response.\n\t\t\tpager := pager.New(pager.SimplePageFunc(func(opts metav1.ListOptions) (runtime.Object, error) {\n\t\t\t\treturn r.listerWatcher.List(opts)\n\t\t\t}))\n\t\t\tif r.WatchListPageSize != 0 {\n\t\t\t\tpager.PageSize = r.WatchListPageSize\n\t\t\t}\n\t\t\t// Pager falls back to full list if paginated list calls fail due to an \"Expired\" error.\n\t\t\t// Set resource version to \"\" as it cannot be limited to the cached ones due to the introduction of\n\t\t\t// \tapi server data partition\n\t\t\tlist, err = pager.List(context.Background(), options)\n\t\t\tclose(listCh)\n\t\t}()\n\n\t\tselect {\n\t\tcase <-stopCh:\n\t\t\treturn nil\n\t\tcase r := <-panicCh:\n\t\t\tpanic(r)\n\t\tcase <-listCh:\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%s: Failed to list %v: %v\", r.name, r.expectedType, err)\n\t\t}\n\t\tinitTrace.Step(\"Objects listed\")\n\t\tlistMetaInterface, err := meta.ListAccessor(list)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%s: Unable to understand list result %#v: %v\", r.name, list, err)\n\t\t}\n\t\tresourceVersion = listMetaInterface.GetResourceVersion()\n\t\tinitTrace.Step(\"Resource version extracted\")\n\t\titems, err := meta.ExtractList(list)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"%s: Unable to understand list result %#v (%v)\", r.name, list, err)\n\t\t}\n\t\tinitTrace.Step(\"Objects extracted\")\n\t\tif err := r.syncWith(items, resourceVersion); err != nil {\n\t\t\treturn fmt.Errorf(\"%s: Unable to sync list result: %v\", r.name, err)\n\t\t}\n\t\tinitTrace.Step(\"SyncWith done\")\n\t\tr.setLastSyncResourceVersion(resourceVersion)\n\t\tinitTrace.Step(\"Resource version updated\")\n\t\treturn nil\n\t}(); err != nil {\n\t\treturn err\n\t}\n\n\t// RESYNC\n\tresyncerrc := make(chan error, 1)\n\tcancelCh := make(chan struct{})\n\tdefer close(cancelCh)\n\tgo func() {\n\t\tresyncCh, cleanup := r.resyncChan()\n\t\tdefer func() {\n\t\t\tcleanup() // Call the last one written into cleanup\n\t\t}()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-resyncCh:\n\t\t\tcase <-stopCh:\n\t\t\t\treturn\n\t\t\tcase <-cancelCh:\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif r.ShouldResync == nil || r.ShouldResync() {\n\t\t\t\tklog.V(4).Infof(\"%s: forcing resync. type %v. resync period %v\", r.name, r.expectedType, r.resyncPeriod)\n\t\t\t\tif err := r.store.Resync(); err != nil {\n\t\t\t\t\tresyncerrc <- err\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tcleanup()\n\t\t\tresyncCh, cleanup = r.resyncChan()\n\t\t}\n\t}()\n\n\t// WATCH\n\tfor {\n\t\t// give the stopCh a chance to stop the loop, even in case of continue statements further down on errors\n\t\tselect {\n\t\tcase <-stopCh:\n\t\t\treturn nil\n\t\tdefault:\n\t\t}\n\n\t\ttimeoutSeconds := int64(minWatchTimeout.Seconds() * (rand.Float64() + 1.0))\n\t\toptions = metav1.ListOptions{\n\t\t\tResourceVersion: resourceVersion,\n\t\t\t// We want to avoid situations of hanging watchers. Stop any wachers that do not\n\t\t\t// receive any events within the timeout window.\n\t\t\tTimeoutSeconds: &timeoutSeconds,\n\t\t\t// To reduce load on kube-apiserver on watch restarts, you may enable watch bookmarks.\n\t\t\t// Reflector doesn't assume bookmarks are returned at all (if the server do not support\n\t\t\t// watch bookmarks, it will ignore this field).\n\t\t\t// Disabled in Alpha release of watch bookmarks feature.\n\t\t\tAllowWatchBookmarks: false,\n\t\t\tAllowPartialWatch: r.allowPartialWatch,\n\t\t}\n\n\t\tif len(r.filterBounds) > 0 {\n\t\t\toptions = appendFieldSelector(options, r.createHashkeyListOptions())\n\t\t}\n\t\taggregatedWatcher := r.listerWatcher.Watch(options)\n\t\terr := aggregatedWatcher.GetErrors()\n\t\tif err != nil {\n\t\t\tswitch err {\n\t\t\tcase io.EOF:\n\t\t\t\t// watch closed normally\n\t\t\tcase io.ErrUnexpectedEOF:\n\t\t\t\tklog.V(1).Infof(\"%s: Watch for %v closed with unexpected EOF: %v\", r.name, r.expectedType, err)\n\t\t\tdefault:\n\t\t\t\tutilruntime.HandleError(fmt.Errorf(\"%s: Failed to watch %v: %v\", r.name, r.expectedType, err))\n\t\t\t}\n\t\t\t// If this is \"connection refused\" error, it means that most likely apiserver is not responsive.\n\t\t\t// It doesn't make sense to re-list all objects because most likely we will be able to restart\n\t\t\t// watch where we ended.\n\t\t\t// If that's the case wait and resend watch request.\n\t\t\tif urlError, ok := err.(*url.Error); ok {\n\t\t\t\tif opError, ok := urlError.Err.(*net.OpError); ok {\n\t\t\t\t\tif errno, ok := opError.Err.(syscall.Errno); ok && errno == syscall.ECONNREFUSED {\n\t\t\t\t\t\ttime.Sleep(time.Second)\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\treturn nil\n\t\t}\n\n\t\tif err := r.watchHandler(aggregatedWatcher, &resourceVersion, resyncerrc, stopCh); err != nil {\n\t\t\tif err == errorResetFilterBoundRequested || err == errorClientSetResetRequested {\n\t\t\t\tselect {\n\t\t\t\tcase cancelCh <- struct{}{}:\n\t\t\t\t\tklog.V(4).Infof(\"Sent message to Resync cancelCh.\")\n\t\t\t\tdefault:\n\t\t\t\t\tklog.V(4).Infof(\"Resync cancelCh was closed.\")\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err != errorStopRequested {\n\t\t\t\tswitch {\n\t\t\t\tcase apierrs.IsResourceExpired(err):\n\t\t\t\t\tklog.V(4).Infof(\"%s: watch of %v ended with: %v\", r.name, r.expectedType, err)\n\t\t\t\tdefault:\n\t\t\t\t\tif strings.Contains(err.Error(), \"too old resource version\") {\n\t\t\t\t\t\t// Watching stopped because it trying to get older resource\n\t\t\t\t\t\t// version that api server can provide, set listFromResourceVersion\n\t\t\t\t\t\t// to allow temporary list from storage directly and avoid too old\n\t\t\t\t\t\t// resource version in follow up watch\n\t\t\t\t\t\tr.listFromResourceVersion = \"\"\n\t\t\t\t\t\terr1 := fmt.Errorf(\"Error [%v] from watch type %v\", err.Error(), r.expectedType)\n\t\t\t\t\t\treturn err1\n\t\t\t\t\t}\n\t\t\t\t\tklog.Warningf(\"%s: watch of %v ended with: %v\", r.name, r.expectedType, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (m *Machine) Watchers() []*watchers.WatcherDef {\n\treturn m.WatcherDefs\n}", "func (c *AnalyticsController) runWatches() {\n\tlastResourceVersion := big.NewInt(0)\n\tcurrentResourceVersion := big.NewInt(0)\n\twatchListItems := WatchFuncList(c.kclient, c.client)\n\tfor name := range watchListItems {\n\n\t\t// assign local variable (not in range operator above) so that each\n\t\t// goroutine gets the correct watch function required\n\t\twfnc := watchListItems[name]\n\t\tn := name\n\t\tbackoff := 1 * time.Second\n\n\t\tgo wait.Until(func() {\n\t\t\t// any return from this func only exits that invocation of the func.\n\t\t\t// wait.Until will call it again after its sync period.\n\t\t\twatchLog := log.WithFields(log.Fields{\n\t\t\t\t\"watch\": n,\n\t\t\t})\n\t\t\twatchLog.Infof(\"starting watch\")\n\t\t\tw, err := wfnc.watchFunc(metav1.ListOptions{})\n\t\t\tif err != nil {\n\t\t\t\twatchLog.Errorf(\"error creating watch: %v\", err)\n\t\t\t}\n\n\t\t\twatchLog.Debugf(\"backing off watch for %v seconds\", backoff)\n\t\t\ttime.Sleep(backoff)\n\t\t\tbackoff = backoff * 2\n\t\t\tif backoff > 60*time.Second {\n\t\t\t\tbackoff = 60 * time.Second\n\t\t\t}\n\n\t\t\tif w == nil {\n\t\t\t\twatchLog.Errorln(\"watch function nil, watch not created, returning\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase event, ok := <-w.ResultChan():\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\twatchLog.Warnln(\"watch channel closed unexpectedly, attempting to re-establish\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif event.Type == watch.Error {\n\t\t\t\t\t\twatchLog.Errorf(\"watch channel returned error: %s\", spew.Sdump(event))\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// success means the watch is working.\n\t\t\t\t\t// reset the backoff back to 1s for this watch\n\t\t\t\t\tbackoff = 1 * time.Second\n\n\t\t\t\t\tif event.Type == watch.Added || event.Type == watch.Deleted {\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\twatchLog.Errorf(\"Unable to create object meta for %v: %v\", event.Object, err)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tm, err := meta.Accessor(event.Object)\n\t\t\t\t\t\t// if both resource versions can be converted to numbers\n\t\t\t\t\t\t// and if the current resource version is lower than the\n\t\t\t\t\t\t// last recorded resource version for this resource type\n\t\t\t\t\t\t// then skip the event\n\t\t\t\t\t\tc.mutex.RLock()\n\t\t\t\t\t\tif _, ok := lastResourceVersion.SetString(c.watchResourceVersions[n], 10); ok {\n\t\t\t\t\t\t\tif _, ok = currentResourceVersion.SetString(m.GetResourceVersion(), 10); ok {\n\t\t\t\t\t\t\t\tif lastResourceVersion.Cmp(currentResourceVersion) == 1 {\n\t\t\t\t\t\t\t\t\twatchLog.Debugf(\"ResourceVersion %v is to old (%v)\",\n\t\t\t\t\t\t\t\t\t\tcurrentResourceVersion, c.watchResourceVersions[n])\n\t\t\t\t\t\t\t\t\tc.mutex.RUnlock()\n\t\t\t\t\t\t\t\t\tbreak\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\tc.mutex.RUnlock()\n\n\t\t\t\t\t\t// each watch is a separate go routine\n\t\t\t\t\t\tc.mutex.Lock()\n\t\t\t\t\t\tc.watchResourceVersions[n] = m.GetResourceVersion()\n\t\t\t\t\t\tc.mutex.Unlock()\n\n\t\t\t\t\t\tanalytic, err := newEvent(c.typer, event.Object, event.Type)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\twatchLog.Errorf(\"unexpected error creating analytic from watch event %#v\", event.Object)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// additional info will be set to the analytic and\n\t\t\t\t\t\t\t// an instance queued for all destinations\n\t\t\t\t\t\t\terr := c.AddEvent(analytic)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\twatchLog.Errorf(\"error adding event: %v - %v\", err, analytic)\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}, 1*time.Millisecond, c.stopChannel)\n\t}\n}", "func Watch(ctx context.Context, watcher watch.Interface) (chan *Target, chan *Target, chan *Target) {\n\tadded := make(chan *Target)\n\tfinished := make(chan *Target)\n\tdeleted := make(chan *Target)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase e := <-watcher.ResultChan():\n\t\t\t\tif e.Object == nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tpod := e.Object.(*v1.Pod)\n\n\t\t\t\tswitch e.Type {\n\t\t\t\tcase watch.Added:\n\t\t\t\t\tif pod.Status.Phase != v1.PodRunning {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, container := range pod.Spec.Containers {\n\t\t\t\t\t\tadded <- NewTarget(pod.Namespace, pod.Name, container.Name)\n\t\t\t\t\t}\n\t\t\t\tcase watch.Modified:\n\t\t\t\t\tswitch pod.Status.Phase {\n\t\t\t\t\tcase v1.PodRunning:\n\t\t\t\t\t\tfor _, container := range pod.Spec.Containers {\n\t\t\t\t\t\t\tadded <- NewTarget(pod.Namespace, pod.Name, container.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\tcase v1.PodSucceeded, v1.PodFailed:\n\t\t\t\t\t\tfor _, container := range pod.Spec.Containers {\n\t\t\t\t\t\t\tfinished <- NewTarget(pod.Namespace, pod.Name, container.Name)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase watch.Deleted:\n\t\t\t\t\tfor _, container := range pod.Spec.Containers {\n\t\t\t\t\t\tdeleted <- NewTarget(pod.Namespace, pod.Name, container.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tcase <-ctx.Done():\n\t\t\t\twatcher.Stop()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn added, finished, deleted\n}", "func Retain[T any](slice []T, fn func(v T) bool) []T {\n\tvar j int\n\tfor _, v := range slice {\n\t\tif fn(v) {\n\t\t\tslice[j] = v\n\t\t\tj++\n\t\t}\n\t}\n\treturn slice[:j]\n}", "func (M *K8sWatcher) GetEnabledWatchs() []func() kcache.Store {\n\twatchs := []func() kcache.Store{M.Watchpods}\n\tmethods := strings.Split(*config.Watch, \",\")\n\tif *config.Watch == \"\" || len(methods) == 0 {\n\t\treturn watchs\n\t}\n\n\tfor _, method := range methods {\n\t\tif strings.ToLower(method) == \"watchpods\" {\n\t\t\tcontinue\n\t\t}\n\t\tme, has := M.getMethod(method)\n\t\tif !has {\n\t\t\tglog.Error(\"Watch method not found.\")\n\t\t\tos.Exit(1)\n\t\t}\n\t\twatchs = append(watchs, me)\n\t}\n\treturn watchs\n}", "func (e *Pusher) ShowWatchers() {\n\tfor _, k := range e.Watchers {\n\t\tfmt.Println(\"Watcher: \", k)\n\t}\n}", "func (rr *Registry) Watch(ctx context.Context) ([]*WatchEvent, <-chan *WatchEvent, error) {\n\trr.mu.Lock()\n\tdefer rr.mu.Unlock()\n\n\tprefix := rr.prefixPath()\n\n\tgetRes, err := rr.kv.Get(ctx, prefix, etcdv3.WithPrefix())\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tcurrentEvents := make([]*WatchEvent, 0, len(getRes.Kvs))\n\tfor _, kv := range getRes.Kvs {\n\t\treg, err := rr.unmarshalRegistration(kv)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\twev := &WatchEvent{\n\t\t\tKey: string(kv.Key),\n\t\t\tReg: reg,\n\t\t\tType: Create,\n\t\t}\n\t\tcurrentEvents = append(currentEvents, wev)\n\t}\n\n\t// Channel to publish registry changes.\n\twatchEvents := make(chan *WatchEvent)\n\n\t// Write a change or exit the watcher.\n\tput := func(we *WatchEvent) {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase watchEvents <- we:\n\t\t}\n\t}\n\tputTerminalError := func(we *WatchEvent) {\n\t\tgo func() {\n\t\t\tdefer func() {\n\t\t\t\trecover()\n\t\t\t}()\n\t\t\tselect {\n\t\t\tcase <-time.After(10 * time.Minute):\n\t\t\tcase watchEvents <- we:\n\t\t\t}\n\t\t}()\n\t}\n\t// Create a watch-event from an event.\n\tcreateWatchEvent := func(ev *etcdv3.Event) *WatchEvent {\n\t\twev := &WatchEvent{Key: string(ev.Kv.Key)}\n\t\tif ev.IsCreate() {\n\t\t\twev.Type = Create\n\t\t} else if ev.IsModify() {\n\t\t\twev.Type = Modify\n\t\t} else {\n\t\t\twev.Type = Delete\n\t\t\t// Create base registration from just key.\n\t\t\treg := &Registration{}\n\t\t\tgraphType, graphName, err := rr.graphTypeAndNameFromKey(string(ev.Kv.Key))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\treg.Type = graphType\n\t\t\treg.Name = graphName\n\t\t\twev.Reg = reg\n\t\t\t// Need to return now because\n\t\t\t// delete events don't contain\n\t\t\t// any data to unmarshal.\n\t\t\treturn wev\n\t\t}\n\t\treg, err := rr.unmarshalRegistration(ev.Kv)\n\t\tif err != nil {\n\t\t\twev.Error = fmt.Errorf(\"%v: failed unmarshaling value: '%s'\", err, ev.Kv.Value)\n\t\t} else {\n\t\t\twev.Reg = reg\n\t\t}\n\t\treturn wev\n\t}\n\n\t// Watch deltas in etcd, with the give prefix, starting\n\t// at the revision of the get call above.\n\tdeltas := rr.client.Watch(ctx, prefix, etcdv3.WithPrefix(), etcdv3.WithRev(getRes.Header.Revision+1))\n\tgo func() {\n\t\tdefer close(watchEvents)\n\t\tfor {\n\t\t\tdelta, open := <-deltas\n\t\t\tif !open {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\tdefault:\n\t\t\t\t\tputTerminalError(&WatchEvent{Error: ErrWatchClosedUnexpectedly})\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif delta.Err() != nil {\n\t\t\t\tputTerminalError(&WatchEvent{Error: delta.Err()})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, event := range delta.Events {\n\t\t\t\tput(createWatchEvent(event))\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn currentEvents, watchEvents, nil\n}", "func (mock *HarborRepositoryInterfaceMock) WatchCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockHarborRepositoryInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockHarborRepositoryInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func (f *MemKv) setupWatchers(key string, v *memKvRec) {\n\tfor watchKey, wl := range f.cluster.watchers {\n\t\tfor _, w := range wl {\n\t\t\tif w.recursive {\n\t\t\t\tif strings.HasPrefix(key, watchKey) {\n\t\t\t\t\tv.watchers = append(v.watchers, w)\n\t\t\t\t\tsendEvent(w, key, v, false)\n\t\t\t\t}\n\t\t\t} else if watchKey == key {\n\t\t\t\tv.watchers = append(v.watchers, w)\n\t\t\t\tsendEvent(w, key, v, false)\n\t\t\t}\n\t\t}\n\t}\n}", "func (client *Client) Watch() <-chan AvailableServers {\n\tif len(client.discoveryConfigs) == 0 {\n\t\treturn nil\n\t}\n\n\tclient.once.Do(func() {\n\t\tfor _, sdConfig := range client.discoveryConfigs {\n\t\t\tgo func(sdConfig *DiscoveryConfig) {\n\t\t\t\tif err := sdConfig.plan.Run(client.consulAddr); err != nil {\n\t\t\t\t\tlog.Printf(\"Consul Watch Err: %+v\\n\", err)\n\t\t\t\t}\n\t\t\t}(sdConfig)\n\t\t}\n\t})\n\n\treturn client.watchChan\n}", "func (mock *SettingInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockSettingInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockSettingInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func (w *eventCollector) events(t *testing.T) Events {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\n\te := make(Events, len(w.e))\n\tcopy(e, w.e)\n\tw.e = make(Events, 0, 16)\n\treturn e\n}", "func (wr *WatchList) Clear() {\n\tfor wr.First(); wr.Remove() != nil; {\n\t}\n}", "func (this *Iter_UServ_UpdateNameToFoo) Slice() []*Row_UServ_UpdateNameToFoo {\n\tvar results []*Row_UServ_UpdateNameToFoo\n\tfor {\n\t\tif i, ok := this.Next(); ok {\n\t\t\tresults = append(results, i)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn results\n}", "func (s *ProxyService) Watch(newNodes []core.NodeInfo) {\n\tfmt.Println(newNodes)\n\n\tcopyConnMap := make(map[string]*grpc.ClientConn)\n\ts.mut.RLock()\n\tfor key, val := range s.connMap {\n\t\tcopyConnMap[key] = val\n\t}\n\toldNodes := s.nodes\n\ts.mut.RUnlock()\n\n\tdiff := core.ComputeAddressesDifference(oldNodes, newNodes)\n\n\tfor _, deleted := range diff.Deleted {\n\t\terr := copyConnMap[deleted].Close()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\n\t\tdelete(copyConnMap, deleted)\n\t}\n\n\tfor _, addr := range diff.Inserted {\n\t\tconnectParams := grpc.ConnectParams{\n\t\t\tBackoff: backoff.Config{\n\t\t\t\tBaseDelay: 5 * time.Second,\n\t\t\t\tMultiplier: 1.0,\n\t\t\t\tJitter: 0.3,\n\t\t\t\tMaxDelay: 10 * time.Second,\n\t\t\t},\n\t\t}\n\n\t\tconn, err := grpc.Dial(addr,\n\t\t\tgrpc.WithConnectParams(connectParams),\n\t\t\tgrpc.WithInsecure(),\n\t\t)\n\t\tif err != nil {\n\t\t\ts.logger.Error(\"Dial\", zap.Error(err))\n\t\t\tcontinue\n\t\t}\n\n\t\tcopyConnMap[addr] = conn\n\t}\n\n\ts.mut.Lock()\n\ts.nodes = newNodes\n\ts.connMap = copyConnMap\n\ts.mut.Unlock()\n}", "func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {\n\tvar resourceVersion string\n\tresyncCh, cleanup := r.resyncChan()\n\tdefer cleanup()\n\n\t// list, err := r.listerWatcher.List()\n\t// if err != nil {\n\t// \tglog.Errorf(\"Failed to list %v: %v\", r.expectedType, err)\n\t// \treturn fmt.Errorf(\"%s: Failed to list %v: %v\", r.name, r.expectedType, err)\n\t// }\n\t// glog.V(4).Infof(\"The list from listerWatcher is %v\", list)\n\t// meta, err := meta.Accessor(list)\n\t// if err != nil {\n\t// \tglog.Errorf(\"%s: Unable to understand list result %#v\", r.name, list)\n\t// \treturn fmt.Errorf(\"%s: Unable to understand list result %#v\", r.name, list)\n\t// }\n\t// glog.Infof(\"meta is %v\", meta)\n\t// resourceVersion = meta.ResourceVersion()\n\t// items, err := ExtractList(list)\n\t// // items := list.([]interface{})\n\n\t// if err != nil {\n\t// \tglog.Errorf(\"%s: Unable to understand list result %#v (%v)\", r.name, list, err)\n\t// \treturn fmt.Errorf(\"%s: Unable to understand list result %#v (%v)\", r.name, list, err)\n\t// }\n\t// if err := r.syncWith(items, resourceVersion); err != nil {\n\t// \tglog.Errorf(\"%s: Unable to sync list result: %v\", r.name, err)\n\t// \treturn fmt.Errorf(\"%s: Unable to sync list result: %v\", r.name, err)\n\t// }\n\t// r.setLastSyncResourceVersion(resourceVersion)\n\n\tresourceVersion = \"0\"\n\n\tfor {\n\t\tw, err := r.listerWatcher.Watch(resourceVersion)\n\n\t\tif err != nil {\n\t\t\tif etcdError, ok := err.(*etcderr.Error); ok && etcdError != nil && etcdError.ErrorCode == etcderr.EcodeKeyNotFound {\n\t\t\t\t// glog.Errorf(\"Key not found Error: %v\", err)\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch err {\n\t\t\tcase io.EOF:\n\t\t\t\t// watch closed normally\n\t\t\tcase io.ErrUnexpectedEOF:\n\t\t\t\tglog.V(1).Infof(\"%s: Watch for %v closed with unexpected EOF: %v\", r.name, r.expectedType, err)\n\t\t\tdefault:\n\t\t\t\tutilruntime.HandleError(fmt.Errorf(\"%s: Failed to watch %v: %v\", r.name, r.expectedType, err))\n\t\t\t}\n\t\t\t// If this is \"connection refused\" error, it means that most likely apiserver is not responsive.\n\t\t\t// It doesn't make sense to re-list all objects because most likely we will be able to restart\n\t\t\t// watch where we ended.\n\t\t\t// If that's the case wait and resend watch request.\n\t\t\tif urlError, ok := err.(*url.Error); ok {\n\t\t\t\tif opError, ok := urlError.Err.(*net.OpError); ok {\n\t\t\t\t\tif errno, ok := opError.Err.(syscall.Errno); ok && errno == syscall.ECONNREFUSED {\n\t\t\t\t\t\tglog.Warningf(\"Sleep, Zzzzzzzzzzzzzz\")\n\t\t\t\t\t\ttime.Sleep(time.Second)\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\tglog.Errorf(\"Error during calling watch: %v\", err)\n\t\t\treturn nil\n\t\t}\n\t\tglog.V(5).Infof(\"watch from listerWather is %v\", w)\n\n\t\tif err := r.watchHandler(w, &resourceVersion, resyncCh, stopCh); err != nil {\n\t\t\tif err != errorResyncRequested && err != errorStopRequested {\n\t\t\t\tglog.Warningf(\"%s: watch of %v ended with: %v\", r.name, r.expectedType, err)\n\t\t\t}\n\t\t\tglog.Error(\"Error calling watchHandler: %s. Return from for loop in ListAndWatch.\", err)\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func updateAndClear(conf *Configuration, slicev reflect.Value, c *mgo.Collection) reflect.Value {\n\tif err := updateRecords(conf, slicev, c); err != nil {\n\t\tlog.Printf(\"Not updated. %v\", err)\n\t\treturn slicev\n\t}\n\n\treturn reflect.MakeSlice(slicev.Type(), 0, 0)\n}", "func (p *TimePanel) Slice(from, to time.Time) TimePanelRO {\n\ti := sort.Search(len(p.dates), func(i int) bool {\n\t\treturn !p.dates[i].Before(from)\n\t})\n\tj := sort.Search(len(p.dates), func(i int) bool {\n\t\treturn !p.dates[i].Before(to)\n\t})\n\treturn p.ISlice(i, j)\n}", "func (t *SimpleChaincode) getAllWatches(stub shim.ChaincodeStubInterface, args []string) pb.Response{\n\t\n\t//get the AllBatches index\n\tvar owner string\n\towner =args[0]\n\tfmt.Printf(\"Value of Owner: %s\", owner)\n\tallBAsBytes,_ := stub.GetState(\"AllWatches\")\n\t\n\tvar res AllWatches\n\tjson.Unmarshal(allBAsBytes, &res)\n\t\n\tvar rab AllWatchesDetails\n\n\tfor i := range res.AllWatches{\n\n\t\tsbAsBytes,_ := stub.GetState(res.AllWatches[i])\n\t\t\n\t\tvar sb Product\n\t\tjson.Unmarshal(sbAsBytes, &sb)\n\n\tif(sb.Ownership == owner) {\n\t\tfmt.Printf(\"Value of Owner-1: %s\", sb.Ownership)\n\t\trab.Watches = append(rab.Watches,sb); \n\t}\n\t}\n\trabAsBytes, _ := json.Marshal(rab)\n\treturn shim.Success(rabAsBytes)\n}", "func (r *Reflector) watchList(stopCh <-chan struct{}) (watch.Interface, error) {\n\tvar w watch.Interface\n\tvar err error\n\tvar temporaryStore Store\n\tvar resourceVersion string\n\t// TODO(#115478): see if this function could be turned\n\t// into a method and see if error handling\n\t// could be unified with the r.watch method\n\tisErrorRetriableWithSideEffectsFn := func(err error) bool {\n\t\tif canRetry := isWatchErrorRetriable(err); canRetry {\n\t\t\tklog.V(2).Infof(\"%s: watch-list of %v returned %v - backing off\", r.name, r.typeDescription, err)\n\t\t\t<-r.backoffManager.Backoff().C()\n\t\t\treturn true\n\t\t}\n\t\tif isExpiredError(err) || isTooLargeResourceVersionError(err) {\n\t\t\t// we tried to re-establish a watch request but the provided RV\n\t\t\t// has either expired or it is greater than the server knows about.\n\t\t\t// In that case we reset the RV and\n\t\t\t// try to get a consistent snapshot from the watch cache (case 1)\n\t\t\tr.setIsLastSyncResourceVersionUnavailable(true)\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tinitTrace := trace.New(\"Reflector WatchList\", trace.Field{Key: \"name\", Value: r.name})\n\tdefer initTrace.LogIfLong(10 * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase <-stopCh:\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t}\n\n\t\tresourceVersion = \"\"\n\t\tlastKnownRV := r.rewatchResourceVersion()\n\t\ttemporaryStore = NewStore(DeletionHandlingMetaNamespaceKeyFunc)\n\t\t// TODO(#115478): large \"list\", slow clients, slow network, p&f\n\t\t// might slow down streaming and eventually fail.\n\t\t// maybe in such a case we should retry with an increased timeout?\n\t\ttimeoutSeconds := int64(minWatchTimeout.Seconds() * (rand.Float64() + 1.0))\n\t\toptions := metav1.ListOptions{\n\t\t\tResourceVersion: lastKnownRV,\n\t\t\tAllowWatchBookmarks: true,\n\t\t\tSendInitialEvents: pointer.Bool(true),\n\t\t\tResourceVersionMatch: metav1.ResourceVersionMatchNotOlderThan,\n\t\t\tTimeoutSeconds: &timeoutSeconds,\n\t\t}\n\t\tstart := r.clock.Now()\n\n\t\tw, err = r.listerWatcher.Watch(options)\n\t\tif err != nil {\n\t\t\tif isErrorRetriableWithSideEffectsFn(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tbookmarkReceived := pointer.Bool(false)\n\t\terr = watchHandler(start, w, temporaryStore, r.expectedType, r.expectedGVK, r.name, r.typeDescription,\n\t\t\tfunc(rv string) { resourceVersion = rv },\n\t\t\tbookmarkReceived,\n\t\t\tr.clock, make(chan error), stopCh)\n\t\tif err != nil {\n\t\t\tw.Stop() // stop and retry with clean state\n\t\t\tif err == errorStopRequested {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t\tif isErrorRetriableWithSideEffectsFn(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif *bookmarkReceived {\n\t\t\tbreak\n\t\t}\n\t}\n\t// We successfully got initial state from watch-list confirmed by the\n\t// \"k8s.io/initial-events-end\" bookmark.\n\tinitTrace.Step(\"Objects streamed\", trace.Field{Key: \"count\", Value: len(temporaryStore.List())})\n\tr.setIsLastSyncResourceVersionUnavailable(false)\n\tif err = r.store.Replace(temporaryStore.List(), resourceVersion); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to sync watch-list result: %v\", err)\n\t}\n\tinitTrace.Step(\"SyncWith done\")\n\tr.setLastSyncResourceVersion(resourceVersion)\n\n\treturn w, nil\n}", "func DoneWriteCloserSlice(inp <-chan io.WriteCloser) chan []io.WriteCloser {\n\tdone := make(chan []io.WriteCloser)\n\tgo func() {\n\t\tdefer close(done)\n\t\tWriteCloserS := []io.WriteCloser{}\n\t\tfor i := range inp {\n\t\t\tWriteCloserS = append(WriteCloserS, i)\n\t\t}\n\t\tdone <- WriteCloserS\n\t}()\n\treturn done\n}", "func (p *SliceOfMap) TakeW(sel func(O) bool) (new ISlice) {\n\tslice := NewSliceOfMapV()\n\tif p == nil || len(*p) == 0 {\n\t\treturn slice\n\t}\n\tl := len(*p)\n\tfor i := 0; i < l; i++ {\n\t\tif sel((*p)[i]) {\n\t\t\t*slice = append(*slice, (*p)[i])\n\t\t\tp.DropAt(i)\n\t\t\tl--\n\t\t\ti--\n\t\t}\n\t}\n\treturn slice\n}", "func (r *Reflector) list(stopCh <-chan struct{}) error {\n\tvar resourceVersion string\n\toptions := metav1.ListOptions{ResourceVersion: r.relistResourceVersion()}\n\n\tinitTrace := trace.New(\"Reflector ListAndWatch\", trace.Field{Key: \"name\", Value: r.name})\n\tdefer initTrace.LogIfLong(10 * time.Second)\n\tvar list runtime.Object\n\tvar paginatedResult bool\n\tvar err error\n\tlistCh := make(chan struct{}, 1)\n\tpanicCh := make(chan interface{}, 1)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\tpanicCh <- r\n\t\t\t}\n\t\t}()\n\t\t// Attempt to gather list in chunks, if supported by listerWatcher, if not, the first\n\t\t// list request will return the full response.\n\t\tpager := pager.New(pager.SimplePageFunc(func(opts metav1.ListOptions) (runtime.Object, error) {\n\t\t\treturn r.listerWatcher.List(opts)\n\t\t}))\n\t\tswitch {\n\t\tcase r.WatchListPageSize != 0:\n\t\t\tpager.PageSize = r.WatchListPageSize\n\t\tcase r.paginatedResult:\n\t\t\t// We got a paginated result initially. Assume this resource and server honor\n\t\t\t// paging requests (i.e. watch cache is probably disabled) and leave the default\n\t\t\t// pager size set.\n\t\tcase options.ResourceVersion != \"\" && options.ResourceVersion != \"0\":\n\t\t\t// User didn't explicitly request pagination.\n\t\t\t//\n\t\t\t// With ResourceVersion != \"\", we have a possibility to list from watch cache,\n\t\t\t// but we do that (for ResourceVersion != \"0\") only if Limit is unset.\n\t\t\t// To avoid thundering herd on etcd (e.g. on master upgrades), we explicitly\n\t\t\t// switch off pagination to force listing from watch cache (if enabled).\n\t\t\t// With the existing semantic of RV (result is at least as fresh as provided RV),\n\t\t\t// this is correct and doesn't lead to going back in time.\n\t\t\t//\n\t\t\t// We also don't turn off pagination for ResourceVersion=\"0\", since watch cache\n\t\t\t// is ignoring Limit in that case anyway, and if watch cache is not enabled\n\t\t\t// we don't introduce regression.\n\t\t\tpager.PageSize = 0\n\t\t}\n\n\t\tlist, paginatedResult, err = pager.ListWithAlloc(context.Background(), options)\n\t\tif isExpiredError(err) || isTooLargeResourceVersionError(err) {\n\t\t\tr.setIsLastSyncResourceVersionUnavailable(true)\n\t\t\t// Retry immediately if the resource version used to list is unavailable.\n\t\t\t// The pager already falls back to full list if paginated list calls fail due to an \"Expired\" error on\n\t\t\t// continuation pages, but the pager might not be enabled, the full list might fail because the\n\t\t\t// resource version it is listing at is expired or the cache may not yet be synced to the provided\n\t\t\t// resource version. So we need to fallback to resourceVersion=\"\" in all to recover and ensure\n\t\t\t// the reflector makes forward progress.\n\t\t\tlist, paginatedResult, err = pager.ListWithAlloc(context.Background(), metav1.ListOptions{ResourceVersion: r.relistResourceVersion()})\n\t\t}\n\t\tclose(listCh)\n\t}()\n\tselect {\n\tcase <-stopCh:\n\t\treturn nil\n\tcase r := <-panicCh:\n\t\tpanic(r)\n\tcase <-listCh:\n\t}\n\tinitTrace.Step(\"Objects listed\", trace.Field{Key: \"error\", Value: err})\n\tif err != nil {\n\t\tklog.Warningf(\"%s: failed to list %v: %v\", r.name, r.typeDescription, err)\n\t\treturn fmt.Errorf(\"failed to list %v: %w\", r.typeDescription, err)\n\t}\n\n\t// We check if the list was paginated and if so set the paginatedResult based on that.\n\t// However, we want to do that only for the initial list (which is the only case\n\t// when we set ResourceVersion=\"0\"). The reasoning behind it is that later, in some\n\t// situations we may force listing directly from etcd (by setting ResourceVersion=\"\")\n\t// which will return paginated result, even if watch cache is enabled. However, in\n\t// that case, we still want to prefer sending requests to watch cache if possible.\n\t//\n\t// Paginated result returned for request with ResourceVersion=\"0\" mean that watch\n\t// cache is disabled and there are a lot of objects of a given type. In such case,\n\t// there is no need to prefer listing from watch cache.\n\tif options.ResourceVersion == \"0\" && paginatedResult {\n\t\tr.paginatedResult = true\n\t}\n\n\tr.setIsLastSyncResourceVersionUnavailable(false) // list was successful\n\tlistMetaInterface, err := meta.ListAccessor(list)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to understand list result %#v: %v\", list, err)\n\t}\n\tresourceVersion = listMetaInterface.GetResourceVersion()\n\tinitTrace.Step(\"Resource version extracted\")\n\titems, err := meta.ExtractListWithAlloc(list)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to understand list result %#v (%v)\", list, err)\n\t}\n\tinitTrace.Step(\"Objects extracted\")\n\tif err := r.syncWith(items, resourceVersion); err != nil {\n\t\treturn fmt.Errorf(\"unable to sync list result: %v\", err)\n\t}\n\tinitTrace.Step(\"SyncWith done\")\n\tr.setLastSyncResourceVersion(resourceVersion)\n\tinitTrace.Step(\"Resource version updated\")\n\treturn nil\n}", "func (s *swiper) watch(ctx context.Context, topic, seed []byte) chan peer.AddrInfo {\n\tout := make(chan peer.AddrInfo)\n\n\tgo func() {\n\t\tfor {\n\t\t\tif ctx.Err() != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tperiodEnd := nextTimePeriod(time.Now(), s.interval)\n\t\t\tctx, cancel := context.WithDeadline(ctx, periodEnd)\n\t\t\tch, err := s.watchForPeriod(ctx, topic, seed, time.Now())\n\n\t\t\tif err != nil {\n\t\t\t\ts.logger.Error(\"unable to watch for period\", zap.Error(err))\n\t\t\t\t<-ctx.Done()\n\t\t\t} else {\n\t\t\t\tfor pid := range ch {\n\t\t\t\t\tout <- pid\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcancel()\n\t\t}\n\n\t\tclose(out)\n\t}()\n\n\treturn out\n}", "func (set *SetThreadSafe) ToSlice() []interface{} {\n\tvar ret []interface{}\n\tset.Items.Range(func(k, v interface{}) bool {\n\t\tret = append(ret, k)\n\t\treturn true\n\t})\n\treturn ret\n}", "func (mock *EtcdBackupInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockEtcdBackupInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockEtcdBackupInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func (sr *SpanRecorder) Started() []sdktrace.ReadWriteSpan {\n\tsr.startedMu.RLock()\n\tdefer sr.startedMu.RUnlock()\n\tdst := make([]sdktrace.ReadWriteSpan, len(sr.started))\n\tcopy(dst, sr.started)\n\treturn dst\n}", "func (l *Loader) RangeWatchers(fn func(uri string) bool) {\n\tl.watchers.Range(func(key, value interface{}) bool {\n\t\turi, _ := key.(string)\n\t\treturn fn(uri)\n\t})\n}", "func (c *ChangeWatcher) Start() {\n\n c.in = make(chan *RoomChange)\n c.out = make(chan *RoomChange)\n c.buffer = nil\n go func() {\n\n for c.in != nil {\n select {\n case in, ok := <-c.in:\n if !ok {\n c.in = nil\n } else {\n c.buffer = append(c.buffer, in)\n }\n\n case c.outC() <- c.curV():\n // Remove element from buffer\n c.buffer = c.buffer[1:]\n }\n }\n\n close(c.out)\n c.buffer = nil\n\n }()\n}", "func (mock *NamespacedCertificateInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockNamespacedCertificateInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockNamespacedCertificateInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func (mock *MultiClusterAppInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockMultiClusterAppInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockMultiClusterAppInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func CopySource( evs []Event ) []Event {\n res := make( []Event, len( evs ) )\n for i, ev := range evs { res[ i ] = CopyEvent( ev, false ) }\n return res\n}", "func (mock *PersistentVolumeClaimInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockPersistentVolumeClaimInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockPersistentVolumeClaimInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func (s *Server) Watch(ch chan []string) {\n\tfor ei := range ch {\n\t\tif len(ei) > 0 {\n\t\t\ts.Reload(ei)\n\t\t}\n\t}\n}", "func (self *T) Slice() []float64 {\n\treturn []float64{self[0], self[1]}\n}", "func (d delegate) GetBroadcasts(overhead, limit int) [][]byte { return nil }", "func (tw *TestWatch) Endpoints() []string {\n\tif tw.IsClosed() {\n\t\ttw.t.Error(\"The watch has been closed\")\n\t\treturn nil\n\t}\n\n\t// block waiting for the next slice of endpoints\n\treturn <-tw.endpoints\n}", "func (s SamplesC64) Slice(start, end int) Samples {\n\treturn s[start:end]\n}", "func (ml *MemoryLogger) Slice() []string {\n\tsl := ml.RingBuffer.Slice()\n\tret := make([]string, len(sl))\n\tfor i, lm := range sl {\n\t\tret[i] = lm.(string)\n\t}\n\treturn ret\n}", "func (l *AddOnList) Slice() []*AddOn {\n\tvar slice []*AddOn\n\tif l == nil {\n\t\tslice = make([]*AddOn, 0)\n\t} else {\n\t\tslice = make([]*AddOn, len(l.items))\n\t\tcopy(slice, l.items)\n\t}\n\treturn slice\n}", "func (d *EtcdStateDriver) WatchAll(baseKey string, rsps chan [2][]byte) error {\n\n\twatcher := d.Client.Watch(context.Background(), baseKey, client.WithPrefix())\n\tgo d.channelEtcdEvents(watcher, rsps)\n\n\treturn nil\n}", "func (w *watchObject) Events() chan EventInfo {\n\treturn w.eventInfoChan\n}", "func (mock *PodSecurityPolicyTemplateInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockPodSecurityPolicyTemplateInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockPodSecurityPolicyTemplateInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func (mock *SourceCodeProviderInterfaceMock) WatchCalls() []struct {\n\tOpts v1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts v1.ListOptions\n\t}\n\tlockSourceCodeProviderInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockSourceCodeProviderInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func (m *DevicePluginStub) ListAndWatch(e *pluginapi.ListAndWatchRequest, s ListAndWatchStream) error {\n\tglog.V(2).Infof(\"%s: ListAndWatch\", m.SocketName())\n\n\ts.Send(&pluginapi.ListAndWatchResponse{Devices: m.Devs})\n\n\tfor {\n\t\tselect {\n\t\tcase <-m.stop:\n\t\t\treturn nil\n\t\tcase updated := <-m.update:\n\t\t\tm.Devs = updated\n\t\t\ts.Send(&pluginapi.ListAndWatchResponse{Devices: m.Devs})\n\t\t}\n\t}\n}", "func (pr *consulPipeRouter) watchAll() {\n\tdefer pr.wait.Done()\n\tpr.client.WatchPrefix(pr.prefix, &consulPipe{}, pr.quit, func(key string, value interface{}) bool {\n\t\tcp := *value.(*consulPipe)\n\t\tselect {\n\t\tcase pr.actorChan <- func() { pr.handlePipeUpdate(key, cp) }:\n\t\t\treturn true\n\t\tcase <-pr.quit:\n\t\t\treturn false\n\t\t}\n\t})\n}", "func (f *extendedPodFactory) ListWatch(customResourceClient interface{}, ns string, fieldSelector string) cache.ListerWatcher {\n\tclient := customResourceClient.(clientset.Interface)\n\treturn &cache.ListWatch{\n\t\tListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {\n\t\t\treturn client.CoreV1().Pods(ns).List(context.TODO(), opts)\n\t\t},\n\t\tWatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) {\n\t\t\treturn client.CoreV1().Pods(ns).Watch(context.TODO(), opts)\n\t\t},\n\t}\n}", "func getChangedTowers(pt1, pt2 Point, rv1, rv2 int32, towers [][]*Tower, max *Point) ([]*Tower, []*Tower, []*Tower) {\n\tstart1, end1 := getPosLimit(pt1, max, rv1)\n\tstart2, end2 := getPosLimit(pt2, max, rv2)\n\n\taddTowers, removeTowers, unchangeTowers := []*Tower{}, []*Tower{}, []*Tower{}\n\n\tfor x := start1.X; x <= end1.X; x++ {\n\t\tfor y := start1.Y; y <= end1.Y; y++ {\n\t\t\tif isInRect(x, y, start2, end2) {\n\t\t\t\tunchangeTowers = append(unchangeTowers, towers[x][y])\n\t\t\t} else {\n\t\t\t\tremoveTowers = append(removeTowers, towers[x][y])\n\t\t\t}\n\t\t}\n\t}\n\n\tfor x := start2.X; x <= end2.X; x++ {\n\t\tfor y := start2.Y; y <= end2.Y; y++ {\n\t\t\tif !isInRect(x, y, start1, end1) {\n\t\t\t\taddTowers = append(addTowers, towers[x][y])\n\t\t\t}\n\t\t}\n\t}\n\n\treturn addTowers, removeTowers, unchangeTowers\n}", "func (s ChatParticipantAdminArray) Retain(keep func(x ChatParticipantAdmin) bool) ChatParticipantAdminArray {\n\tn := 0\n\tfor _, x := range s {\n\t\tif keep(x) {\n\t\t\ts[n] = x\n\t\t\tn++\n\t\t}\n\t}\n\ts = s[:n]\n\n\treturn s\n}", "func WorkWithSlices() {\n\tvar team []structs.TeamMember\n\n\ttm1 := structs.TeamMember{\"Jack\", 23, \"200501\", 5.6}\n\n\ttm2 := structs.TeamMember{\n\t\tName: \"Jones\",\n\t\tAge: 24,\n\t\tEmpId: \"200502\",\n\t\tRating: 6.5,\n\t}\n\n\tvar tm3 structs.TeamMember\n\ttm3.Name = \"Mary\"\n\ttm3.Age = 25\n\ttm3.EmpId = \"20050\"\n\ttm3.Rating = 6.7\n\n\tteam = append(team, tm1, tm2, tm3)\n\n\tteam2 := team //MAKES A COPY OF THE REFERENCE AND ALL VALUES BY REFERENCE\n\n\t//team2 = append(team2, tm3)\n\n\t//MODIFY EXISTING VALUE AND SEE\n\tteam2[0].Age = 100\n\n\tfmt.Println(\"========SLICES============\")\n\tfmt.Println(\"team = \", team)\n\tfmt.Println(\"team2 = \", team2)\n\n\tfor i, v := range team2 {\n\t\tfmt.Println(i, \".\", v)\n\t}\n\tfor _, v := range team2 {\n\t\tfmt.Println(v)\n\t}\n}", "func newWatcherSyncerTester(l []watchersyncer.ResourceType) *watcherSyncerTester {\n\t// Create the required watchers. This hs methods that we use to drive\n\t// responses.\n\tlws := map[string]*listWatchSource{}\n\tfor _, r := range l {\n\t\t// We create a watcher for each resource type. We'll store these off the\n\t\t// default enumeration path for that resource.\n\t\tname := model.ListOptionsToDefaultPathRoot(r.ListInterface)\n\t\tlws[name] = &listWatchSource{\n\t\t\tname: name,\n\t\t\twatchCallError: make(chan error, 50),\n\t\t\tlistCallResults: make(chan interface{}, 200),\n\t\t\tstopEvents: make(chan struct{}, 200),\n\t\t\tresults: make(chan api.WatchEvent, 200),\n\t\t}\n\t}\n\n\tfc := &fakeClient{\n\t\tlws: lws,\n\t}\n\n\t// Create the syncer tester.\n\tst := testutils.NewSyncerTester()\n\trst := &watcherSyncerTester{\n\t\tSyncerTester: st,\n\t\tfc: fc,\n\t\twatcherSyncer: watchersyncer.New(fc, l, st),\n\t\tlws: lws,\n\t}\n\trst.watcherSyncer.Start()\n\treturn rst\n}", "func (rb *RingBuffer[T]) GetAll() []T {\n\tif rb == nil {\n\t\treturn nil\n\t}\n\trb.mu.Lock()\n\tdefer rb.mu.Unlock()\n\tout := make([]T, len(rb.buf))\n\tfor i := 0; i < len(rb.buf); i++ {\n\t\tx := (rb.pos + i) % rb.max\n\t\tout[i] = rb.buf[x]\n\t}\n\treturn out\n}", "func (b *Byzcoin) Watch(ctx context.Context) <-chan *ledger.TransactionResult {\n\tc := make(chan *ledger.TransactionResult, 100)\n\tb.bc.Watch(ctx, observer{ch: c})\n\n\treturn c\n}", "func (mw *MultiWatcher) Watch(ctx context.Context) {\n\twg := sync.WaitGroup{}\n\twg.Add(len(mw.watchers))\n\tfor _, w := range mw.watchers {\n\t\tgo func(w *Watcher) {\n\t\t\tdefer wg.Done()\n\t\t\tw.Watch(ctx)\n\t\t}(w)\n\t}\n\twg.Wait()\n}", "func (a *AmbientIndex) All() []*model.WorkloadInfo {\n\ta.mu.RLock()\n\tdefer a.mu.RUnlock()\n\tres := make([]*model.WorkloadInfo, 0, len(a.byPod))\n\t// byPod will not have any duplicates, so we can just iterate over that.\n\tfor _, wl := range a.byPod {\n\t\tres = append(res, wl)\n\t}\n\treturn res\n}", "func DurationSlice(src []time.Duration) []*time.Duration {\n\tdst := make([]*time.Duration, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "func (r *rescanKeys) unspentSlice() []*wire.OutPoint {\n\tops := make([]*wire.OutPoint, 0, len(r.unspent))\n\tfor op := range r.unspent {\n\t\topCopy := op\n\t\tops = append(ops, &opCopy)\n\t}\n\treturn ops\n}", "func (list *LinkedList[T]) ToSlice() []T {\n\treturn list.Enumerate(context.Background()).ToSlice()\n}", "func (m *RdmaDevPlugin) ListAndWatch(e *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error {\n\tfmt.Println(\"exposing devices: \", m.devs)\n\ts.Send(&pluginapi.ListAndWatchResponse{Devices: m.devs})\n\n\tfor {\n\t\tselect {\n\t\tcase <-m.stop:\n\t\t\treturn nil\n\t\tcase d := <-m.health:\n\t\t\t// FIXME: there is no way to recover from the Unhealthy state.\n\t\t\td.Health = pluginapi.Unhealthy\n\t\t\ts.Send(&pluginapi.ListAndWatchResponse{Devices: m.devs})\n\t\t}\n\t}\n}", "func (items *items) getUntil(checker func(item interface{}) bool) []interface{} {\n\tlength := len(*items)\n\tif length == 0 {\n\t\treturn []interface{}{}\n\t}\n\n\treturnItems := make([]interface{}, 0, length)\n\tindex := 0\n\tfor i, item := range *items {\n\t\tif !checker(item) {\n\t\t\tbreak\n\t\t}\n\n\t\treturnItems = append(returnItems, item)\n\t\tindex = i\n\t}\n\n\t*items = (*items)[index:]\n\treturn returnItems\n}", "func (set *SetUI) Slice() SliceUI {\n\tset.lock.Lock()\n\tkeys := make(SliceUI, len(set.cache))\n\ti := 0\n\tfor k := range set.cache {\n\t\tkeys[i] = k\n\t}\n\tset.lock.Unlock()\n\treturn keys\n}", "func (mock *GitModuleClientMock) WatchCalls() []struct {\n\tNamespace string\n\tOpts v1b.ListOptions\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tOpts v1b.ListOptions\n\t}\n\tlockGitModuleClientMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockGitModuleClientMockWatch.RUnlock()\n\treturn calls\n}", "func (p *Partition) slice(from, to *time.Time) Entries {\n\t// take a snapshot to avoid concurrent modification (a slice is immutable)\n\tp.mu.RLock()\n\tentries := p.entries\n\tp.mu.RUnlock()\n\n\tstart := 0\n\tend := len(entries)\n\n\tif from != nil {\n\t\tstart = sort.Search(len(entries), func(i int) bool {\n\t\t\treturn entries[i].Timestamp.After(*from) || entries[i].Timestamp.Equal(*from)\n\t\t})\n\t}\n\tif to != nil {\n\t\tend = sort.Search(len(entries), func(i int) bool {\n\t\t\treturn entries[i].Timestamp.After(*to)\n\t\t})\n\t}\n\tif end < start {\n\t\t// should return empty slice?\n\t\treturn nil\n\t}\n\treturn entries[start:end]\n}", "func newListWatchFromClient(c virtwrap.Connection, events ...int) *cache.ListWatch {\n\tlistFunc := func(options kubev1.ListOptions) (runtime.Object, error) {\n\t\tdoms, err := c.ListAllDomains(libvirt.CONNECT_LIST_DOMAINS_ACTIVE | libvirt.CONNECT_LIST_DOMAINS_INACTIVE)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlist := virtwrap.DomainList{\n\t\t\tItems: []virtwrap.Domain{},\n\t\t}\n\t\tfor _, dom := range doms {\n\t\t\tdomain, err := NewDomain(dom)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tspec, err := NewDomainSpec(dom)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdomain.Spec = *spec\n\t\t\tstatus, reason, err := dom.GetState()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdomain.SetState(status, reason)\n\t\t\tlist.Items = append(list.Items, *domain)\n\t\t}\n\n\t\treturn &list, nil\n\t}\n\twatchFunc := func(options kubev1.ListOptions) (watch.Interface, error) {\n\t\treturn newDomainWatcher(c, events...)\n\t}\n\treturn &cache.ListWatch{ListFunc: listFunc, WatchFunc: watchFunc}\n}", "func (mock *ComposeConfigInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockComposeConfigInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockComposeConfigInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func (mock *GitModuleControllerMock) WatchCalls() []struct {\n\tNamespace string\n\tOpts v1b.ListOptions\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tOpts v1b.ListOptions\n\t}\n\tlockGitModuleControllerMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockGitModuleControllerMockWatch.RUnlock()\n\treturn calls\n}", "func (i *instrumentedListerWatcher) List(options metav1.ListOptions) (runtime.Object, error) {\n\ti.listTotal.Inc()\n\tret, err := i.next.List(options)\n\tif err != nil {\n\t\ti.listFailed.Inc()\n\t}\n\treturn ret, err\n}", "func (w *watcher) Containers() map[string]*Container {\n\tw.RLock()\n\tdefer w.RUnlock()\n\tres := make(map[string]*Container)\n\tfor k, v := range w.containers {\n\t\tif !w.shortID || len(k) != shortIDLen {\n\t\t\tres[k] = v\n\t\t}\n\t}\n\treturn res\n}", "func (this *Iter_UServ_Drop) Slice() []*Row_UServ_Drop {\n\tvar results []*Row_UServ_Drop\n\tfor {\n\t\tif i, ok := this.Next(); ok {\n\t\t\tresults = append(results, i)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn results\n}", "func (w *watcher) startWatching() {\n\tf := w.f\n\n\t// insert watcher in memKv's global list of watchers\n\t// insert watcher into key's watcher list\n\t// insert memKvRec into watcher's list (to handle Stop)\n\tf.cluster.Lock()\n\tdefer f.cluster.Unlock()\n\n\twl, ok := f.cluster.watchers[w.keyOrPrefix]\n\tif !ok {\n\t\twl = []*watcher{}\n\t}\n\twl = append(wl, w)\n\tf.cluster.watchers[w.keyOrPrefix] = wl\n\n\tif w.recursive {\n\t\tfor key, v := range f.cluster.kvs {\n\t\t\tif strings.HasPrefix(key, w.keyOrPrefix) {\n\t\t\t\tw.keys = append(w.keys, key)\n\t\t\t\tv.watchers = append(v.watchers, w)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif v, ok := f.cluster.kvs[w.keyOrPrefix]; ok {\n\t\t\tw.keys = []string{w.keyOrPrefix}\n\t\t\tv.watchers = append(v.watchers, w)\n\t\t}\n\t}\n\n\t// If starting from a lower version that current object's version\n\t// send current object(s) on the channel\n\tfor _, key := range w.keys {\n\t\tv := f.cluster.kvs[key]\n\t\tif v.revision >= w.fromVersion {\n\t\t\tsendEvent(w, key, v, false)\n\t\t}\n\t}\n}", "func (m *Group) GetEvents()([]Eventable) {\n return m.events\n}", "func (w *watcher) Events() chan string {\n\treturn w.events\n}", "func (s ChatParticipantArray) Retain(keep func(x ChatParticipant) bool) ChatParticipantArray {\n\tn := 0\n\tfor _, x := range s {\n\t\tif keep(x) {\n\t\t\ts[n] = x\n\t\t\tn++\n\t\t}\n\t}\n\ts = s[:n]\n\n\treturn s\n}", "func (ew *EventWatcher) events(ctx context.Context) ([]Event, error) {\n\tvar events []Event\n\tif err := ew.object.Call(ctx, &events, `function() {\n\t\tlet events = this.events;\n\t\tthis.events = [];\n\t\treturn events;\n\t}`); err != nil {\n\t\treturn nil, err\n\t}\n\treturn events, nil\n}", "func Watcher(ctx context.Context, ch *mp.WatchResponse) error {\n\tmtx.RLock()\n\tfor _, sub := range watchers[ch.Key] {\n\t\tselect {\n\t\tcase sub.next <- ch:\n\t\tcase <-time.After(time.Millisecond * 100):\n\t\t}\n\t}\n\tmtx.RUnlock()\n\treturn nil\n}", "func (s IPPortArray) Retain(keep func(x IPPort) bool) IPPortArray {\n\tn := 0\n\tfor _, x := range s {\n\t\tif keep(x) {\n\t\t\ts[n] = x\n\t\t\tn++\n\t\t}\n\t}\n\ts = s[:n]\n\n\treturn s\n}", "func (b *ChangeBuffer) Range() <-chan *list.Element {\n\tch := make(chan *list.Element)\n\tgo func() {\n\t\tdefer close(ch)\n\t\tfor c := b.Front(); c != nil; c = c.Next() {\n\t\t\tch <- c\n\t\t}\n\t}()\n\treturn ch\n}", "func Run(ctx context.Context, namespace string, clientset *kubernetes.Clientset) error {\n\n\tadded, removed, err := Watch(ctx, clientset.CoreV1().Pods(namespace), regexp.MustCompile(\".*\"), regexp.MustCompile(\".*\"), RUNNING, labels.Everything())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to set up watch: %v\", err)\n\t}\n\n\ttails := make(map[string]*Tail)\n\n\tgo func() {\n\t\tfor p := range added {\n\t\t\tid := p.GetID()\n\t\t\tif tails[id] != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttail := NewTail(p.Namespace, p.Pod, p.Container)\n\t\t\ttails[id] = tail\n\n\t\t\ttail.Start(ctx, clientset.CoreV1().Pods(p.Namespace))\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tfor p := range removed {\n\t\t\tid := p.GetID()\n\t\t\tif tails[id] == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttails[id].Close()\n\t\t\tdelete(tails, id)\n\t\t}\n\t}()\n\n\t<-ctx.Done()\n\n\treturn nil\n}", "func newWatchAggregator(c, wc Client, autoWatch bool, autoWatchRetry time.Duration) *watchAggregator {\n\tif autoWatchRetry == 0 {\n\t\tautoWatchRetry = defaultAutoWatchRetry\n\t}\n\taggregator := &watchAggregator{\n\t\tClient: c,\n\t\tpassiveClient: wc,\n\t\tautoWatch: autoWatch,\n\t\tautoWatchRetry: autoWatchRetry,\n\t\tlog: log.DefaultLogger(),\n\t\tsubscribers: make([]subscriber, 0),\n\t}\n\treturn aggregator\n}", "func (c *quarksStatefulSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"quarksstatefulsets\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch(ctx)\n}", "func (s *sliding) takeFrom(start LogPosition) []Update {\n\treturn s.log[:s.mutable-s.start][start-s.start:]\n}", "func (self *T) Slice() []float32 {\n\treturn []float32{\n\t\tself[0][0], self[0][1],\n\t\tself[1][0], self[1][1],\n\t}\n}", "func (c *clientImpl) WatchAll(namespaces Namespaces, labelSelector string, stopCh <-chan struct{}) (<-chan interface{}, error) {\n\teventCh := make(chan interface{}, 1)\n\n\tkubeLabelSelector, err := labels.Parse(labelSelector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(namespaces) == 0 {\n\t\tnamespaces = Namespaces{api.NamespaceAll}\n\t\tc.isNamespaceAll = true\n\t}\n\n\tvar informManager informerManager\n\tfor _, ns := range namespaces {\n\t\tns := ns\n\t\tinformManager.extend(c.WatchIngresses(ns, kubeLabelSelector, eventCh), true)\n\t\tinformManager.extend(c.WatchObjects(ns, kindServices, &v1.Service{}, c.svcStores, eventCh), true)\n\t\tinformManager.extend(c.WatchObjects(ns, kindEndpoints, &v1.Endpoints{}, c.epStores, eventCh), true)\n\t\t// Do not wait for the Secrets store to get synced since we cannot rely on\n\t\t// users having granted RBAC permissions for this object.\n\t\t// https://github.com/containous/traefik/issues/1784 should improve the\n\t\t// situation here in the future.\n\t\tinformManager.extend(c.WatchObjects(ns, kindSecrets, &v1.Secret{}, c.secStores, eventCh), false)\n\t}\n\n\tvar wg sync.WaitGroup\n\tfor _, informer := range informManager.informers {\n\t\tinformer := informer\n\t\tsafe.Go(func() {\n\t\t\twg.Add(1)\n\t\t\tinformer.Run(stopCh)\n\t\t\twg.Done()\n\t\t})\n\t}\n\n\tif !cache.WaitForCacheSync(stopCh, informManager.syncFuncs...) {\n\t\treturn nil, fmt.Errorf(\"timed out waiting for controller caches to sync\")\n\t}\n\n\tsafe.Go(func() {\n\t\t<-stopCh\n\t\twg.Wait()\n\t\tclose(eventCh)\n\t})\n\n\treturn eventCh, nil\n}", "func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {\n\tklog.V(3).Infof(\"Listing and watching %v from %s\", r.typeDescription, r.name)\n\tvar err error\n\tvar w watch.Interface\n\tfallbackToList := !r.UseWatchList\n\n\tif r.UseWatchList {\n\t\tw, err = r.watchList(stopCh)\n\t\tif w == nil && err == nil {\n\t\t\t// stopCh was closed\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\tif !apierrors.IsInvalid(err) {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tklog.Warning(\"The watch-list feature is not supported by the server, falling back to the previous LIST/WATCH semantics\")\n\t\t\tfallbackToList = true\n\t\t\t// Ensure that we won't accidentally pass some garbage down the watch.\n\t\t\tw = nil\n\t\t}\n\t}\n\n\tif fallbackToList {\n\t\terr = r.list(stopCh)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tklog.V(2).Infof(\"Caches populated for %v from %s\", r.typeDescription, r.name)\n\n\tresyncerrc := make(chan error, 1)\n\tcancelCh := make(chan struct{})\n\tdefer close(cancelCh)\n\tgo r.startResync(stopCh, cancelCh, resyncerrc)\n\treturn r.watch(w, stopCh, resyncerrc)\n}", "func (f *MemKv) sendWatchEvents(key string, v *memKvRec, deleted bool) {\n\tvar deleteRecKey = func(w *watcher, key string) {\n\t\tfor idx, value := range w.keys {\n\t\t\tif value == key {\n\t\t\t\tw.keys = append(w.keys[:idx], w.keys[idx+1:]...)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, w := range v.watchers {\n\t\tsendEvent(w, key, v, deleted)\n\t\tif deleted {\n\t\t\tdeleteRecKey(w, key)\n\t\t}\n\t}\n}", "func CopyFiltered(slice interface{}, funcs ...FilterFunc) interface{} {\n\trv := reflect.ValueOf(slice)\n\tif rv.Kind() != reflect.Slice {\n\t\tpanic(\"not a slice\")\n\t}\n\n\tlength := rv.Len()\n\n\tptrfiltered := reflect.New(rv.Type())\n\tptrfiltered.Elem().Set(\n\t\t//reflect.MakeSlice(rv.Type(), 0, length))\n\t\treflect.MakeSlice(rv.Type(), length, length)) // copy is done by dest[j] = src[i], so it's allocated in advance\n\tfiltered := ptrfiltered.Elem()\n\n\treflect.Copy(filtered, rv)\n\n\tFilter(ptrfiltered.Interface(), funcs...)\n\n\treturn filtered.Interface()\n}", "func (m *CambriconDevicePlugin) ListAndWatch(e *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error {\n\ts.Send(&pluginapi.ListAndWatchResponse{Devices: m.devs})\n\n\tfor {\n\t\tselect {\n\t\tcase <-m.stop:\n\t\t\treturn nil\n\t\tcase d := <-m.health:\n\t\t\tfor i, dev := range m.devs {\n\t\t\t\tif dev.ID == d.ID {\n\t\t\t\t\tm.devs[i].Health = d.Health\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\ts.Send(&pluginapi.ListAndWatchResponse{Devices: m.devs})\n\t\t}\n\t}\n}", "func (l *HandoffList) Slice() []*Handoff {\n\tvar slice []*Handoff\n\tif l == nil {\n\t\tslice = make([]*Handoff, 0)\n\t} else {\n\t\tslice = make([]*Handoff, len(l.items))\n\t\tcopy(slice, l.items)\n\t}\n\treturn slice\n}", "func WatchEndpoints(client *kubernetes.Clientset, ec EndpointsCache, l log.Logger) cache.SharedInformer {\n\tlw := cache.NewListWatchFromClient(client.CoreV1().RESTClient(), \"endpoints\", v1.NamespaceAll, fields.Everything())\n\tew := cache.NewSharedInformer(lw, new(v1.Endpoints), 30*time.Minute)\n\tew.AddEventHandler(&EndpointsWatchAdapter{\n\t\tEndpointsCache: ec,\n\t\tLogger: l.WithPrefix(\"EndpointsWatcherAdapter\"),\n\t})\n\treturn ew\n}", "func (c *inMemoryProviders) Watch(opts v1.ListOptions) (watch.Interface, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\topts.Watch = true\n\treturn c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"inmemoryproviders\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tWatch()\n}", "func (s *Scanner) C() <-chan []Measurement {\n\treturn s.ch\n}", "func (s *SmartContract) GetAllWatches(ctx contractapi.TransactionContextInterface, args []string) error {\n\n\t//get the AllBatches index\n\tvar owner string\n\towner = args[0]\n\tfmt.Printf(\"Value of Owner: %s\", owner)\n\tallBAsBytes, _ := ctx.GetStub().GetState(\"AllWatches\")\n\n\tvar res AllWatches\n\tjson.Unmarshal(allBAsBytes, &res)\n\n\tvar rab AllWatchesDetails\n\n\tfor i := range res.AllWatches {\n\n\t\tsbAsBytes, _ := ctx.GetStub().GetState(res.AllWatches[i])\n\n\t\tvar sb Product\n\t\tjson.Unmarshal(sbAsBytes, &sb)\n\n\t\tif sb.Status == owner {\n\t\t\tfmt.Printf(\"Value of Owner-1: %s\", sb.Status)\n\t\t\trab.Watches = append(rab.Watches, sb)\n\t\t}\n\t}\n\trabAsBytes, _ := json.Marshal(rab)\n\treturn ctx.GetStub().PutState(args[0], rabAsBytes)\n}", "func (mock *GlobalRoleBindingInterfaceMock) WatchCalls() []struct {\n\tOpts metav1.ListOptions\n} {\n\tvar calls []struct {\n\t\tOpts metav1.ListOptions\n\t}\n\tlockGlobalRoleBindingInterfaceMockWatch.RLock()\n\tcalls = mock.calls.Watch\n\tlockGlobalRoleBindingInterfaceMockWatch.RUnlock()\n\treturn calls\n}", "func collectEvents(f func()) (evs []events.Event) {\n\toldPS := events.DefaultPubSub\n\tevents.DefaultPubSub = &MockEventPubSub{\n\t\tPublishFunc: func(ev events.Event) { evs = append(evs, ev) },\n\t}\n\tdefer func() { events.DefaultPubSub = oldPS }()\n\n\tf()\n\treturn evs\n}", "func (l *SubscriptionRegistrationList) Slice() []*SubscriptionRegistration {\n\tvar slice []*SubscriptionRegistration\n\tif l == nil {\n\t\tslice = make([]*SubscriptionRegistration, 0)\n\t} else {\n\t\tslice = make([]*SubscriptionRegistration, len(l.items))\n\t\tcopy(slice, l.items)\n\t}\n\treturn slice\n}" ]
[ "0.5222102", "0.52214664", "0.5113484", "0.5051384", "0.5022026", "0.5010823", "0.49848473", "0.49482363", "0.48892376", "0.48768497", "0.48226663", "0.48220932", "0.48068982", "0.47980753", "0.47792238", "0.47734892", "0.47717527", "0.4766235", "0.47632176", "0.47610208", "0.47473517", "0.47440815", "0.47382593", "0.47305703", "0.47250772", "0.4716123", "0.4715893", "0.47058725", "0.47038874", "0.4687973", "0.46795657", "0.4675939", "0.4670837", "0.4665684", "0.4659751", "0.46554", "0.4632218", "0.4625784", "0.46253058", "0.46206152", "0.46155742", "0.461533", "0.4614365", "0.4606903", "0.45953146", "0.45926768", "0.45845526", "0.45715943", "0.45625937", "0.45622584", "0.4552747", "0.45526135", "0.4552237", "0.45486397", "0.4546946", "0.45445028", "0.45328784", "0.4532114", "0.45308167", "0.45254037", "0.45235923", "0.45222282", "0.45214283", "0.4520066", "0.45187625", "0.4511293", "0.450679", "0.45010772", "0.4501021", "0.4500782", "0.44872016", "0.4485114", "0.4475466", "0.44752136", "0.4473929", "0.44698212", "0.4468385", "0.44673717", "0.44646347", "0.44589186", "0.44574735", "0.44572583", "0.4455811", "0.4454028", "0.44490883", "0.44475782", "0.444058", "0.44361895", "0.44353068", "0.4431796", "0.4429602", "0.4425212", "0.44248033", "0.4423447", "0.4422431", "0.44173312", "0.4416833", "0.44144386", "0.44116867", "0.43984058" ]
0.5794027
0
////////////////////////////////////////////////////////////////////////////////// // UnmarshalJSON is custom Date format unmarshaler
func (d *Date) UnmarshalJSON(b []byte) error { var err error d.Time, err = time.Parse(time.RFC3339, strings.Trim(string(b), "\"")) if err != nil { return fmt.Errorf("Cannot unmarshal Date value: %v", err) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (j *JSONDate) UnmarshalJSON(b []byte) error {\n\ts := strings.Trim(string(b), \"\\\"\")\n\tif s == \"null\" {\n\t\treturn nil\n\t}\n\tt, err := time.Parse(\"2006-01-02\", s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*j = JSONDate(t)\n\treturn nil\n}", "func (d *Date) UnmarshalJSON(data []byte) error {\n\tvar dateStr string\n\terr := json.Unmarshal(data, &dateStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tparsed, err := time.Parse(DateFormat, dateStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.Time = parsed\n\treturn nil\n}", "func (d *Date) UnmarshalJSON(data []byte) (err error) {\n\td.Time, err = time.Parse(fullDateJSON, string(data))\n\treturn err\n}", "func (td *Date) UnmarshalJSON(input []byte) error {\n\tloc, err := time.LoadLocation(\"Europe/Amsterdam\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t// don't parse on empty dates\n\tif string(input) == `\"\"` {\n\t\treturn nil\n\t}\n\tnewTime, err := time.ParseInLocation(`\"2006-01-02\"`, string(input), loc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttd.Time = newTime\n\treturn nil\n}", "func (t *JSONDate) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\ts = Stripchars(s, \"\\\"\")\n\t// x, err := time.Parse(\"2006-01-02\", s)\n\tx, err := StringToDate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x.Before(earliestDate) {\n\t\tx = earliestDate\n\t}\n\t*t = JSONDate(x)\n\treturn nil\n}", "func (t *JSONDate) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\ts = Stripchars(s, \"\\\"\")\n\tif len(s) == 0 {\n\t\t*t = JSONDate(TIME0)\n\t\treturn nil\n\t}\n\t// x, err := time.Parse(\"2006-01-02\", s)\n\tx, err := StringToDate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x.Before(earliestDate) {\n\t\tx = earliestDate\n\t}\n\t*t = JSONDate(x)\n\treturn nil\n}", "func (d *Date) UnmarshalJSON(dateBytes []byte) (err error) {\n\tstrDate, err := Unquote(dateBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tt, err := time.Parse(DATE_FORMAT, strDate)\n\tif err != nil {\n\t\treturn\n\t}\n\n\toldFmt := d.Fmt\n\tif oldFmt == \"\" {\n\t\toldFmt = DATE_FORMAT\n\t}\n\n\t(*d).Time = Time{t, oldFmt}\n\n\treturn\n}", "func (j *JsonReleaseDate) UnmarshalJSON(b []byte) error {\n\ts := strings.Trim(string(b), \"\\\"\")\n\tt, err := time.Parse(\"2006-01-02\", s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*j = JsonReleaseDate(t)\n\treturn nil\n}", "func (v *dateField) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker41(&r, v)\n\treturn r.Error()\n}", "func (t *NumericDate) UnmarshalJSON(data []byte) error {\n\tvar value json.Number\n\tif err := json.Unmarshal(data, &value); err != nil {\n\t\treturn err\n\t}\n\tf, err := value.Float64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsec, dec := math.Modf(f)\n\tts := time.Unix(int64(sec), int64(dec*1e9))\n\t*t = NumericDate{ts}\n\treturn nil\n}", "func (t *JSONDateTime) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\ts = Stripchars(s, \"\\\"\")\n\t// x, err := time.Parse(\"2006-01-02\", s)\n\tx, err := StringToDate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x.Before(earliestDate) {\n\t\tx = earliestDate\n\t}\n\t*t = JSONDateTime(x)\n\treturn nil\n}", "func (d *DateValue) UnmarshalJSON(b []byte) error {\n\tif string(b) == \"null\" {\n\t\treturn nil\n\t}\n\n\tvar jsonDate jsonDateValue\n\tif err := json.Unmarshal(b, &jsonDate); err != nil {\n\t\treturn err\n\t}\n\t*d = DateValue{Value: time.Time(jsonDate.Value)}\n\treturn nil\n}", "func (t *JSONDateTime) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\ts = Stripchars(s, \"\\\"\")\n\t// x, err := time.Parse(\"2006-01-02\", s)\n\tif len(s) == 0 {\n\t\t*t = JSONDateTime(TIME0)\n\t\treturn nil\n\t}\n\tx, err := StringToDate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x.Before(earliestDate) {\n\t\tx = earliestDate\n\t}\n\t*t = JSONDateTime(x)\n\treturn nil\n}", "func (d *DateFormat) UnmarshalJSON(data []byte) error {\n\tdataStr, err := strconv.Unquote(string(data))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to parse date format\")\n\t}\n\n\tdataStr = strings.TrimSpace(dataStr)\n\tdataStr = strings.ToLower(dataStr)\n\n\tswitch dataStr {\n\tcase string(DateFormatDDMMYYYY):\n\t\t*d = DateFormatDDMMYYYY\n\tcase string(DateFormatMMDDYYYY):\n\t\t*d = DateFormatMMDDYYYY\n\tdefault:\n\t\treturn errors.Errorf(\"invalid date format '%s'\", dataStr)\n\t}\n\n\treturn nil\n}", "func (tt *OpenDate) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"\\\"2006-01-02T15:04:05.9Z\\\"\", string(data))\n\t*tt = OpenDate{&t}\n\treturn err\n}", "func (dt *DateTime) UnmarshalJSON(data []byte) error {\n\treturn dt.src.UnmarshalJSON(data)\n}", "func (d *DateTime) UnmarshalJSON(data []byte) (err error) {\n\tvar str string\n\terr = json.Unmarshal(data, &str)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttime, err := time.Parse(time.RFC3339, str)\n\td.Time = &time\n\treturn err\n}", "func (n *NullDate) UnmarshalJSON(b []byte) error {\n\tn.Valid = false\n\tn.Date = civil.Date{}\n\tif bytes.Equal(b, jsonNull) {\n\t\treturn nil\n\t}\n\n\tif err := json.Unmarshal(b, &n.Date); err != nil {\n\t\treturn err\n\t}\n\tn.Valid = true\n\treturn nil\n}", "func (d *DateTime) UnmarshalJSON(data []byte) (err error) {\n\treturn d.Time.UnmarshalJSON(data)\n}", "func (v *dateRangeField) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker40(&r, v)\n\treturn r.Error()\n}", "func (t *ISODate) UnmarshalJSON(data []byte) error {\n\tvar value interface{}\n\terr := json.Unmarshal(data, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch value.(type) {\n\tcase string:\n\t\tv := value.(string)\n\t\tfmt.Println(\"UnmarshalJSON TIMESTAMP\", v)\n\t\tif v == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\td, err := ParseTimestamp(v)\n\t\tfmt.Println(\"UnmarshalJSON ParseTimestamp\", d, d.UTC())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = d\n\tcase float64:\n\t\t*t = ISODate{time.Unix(0, int64(value.(float64))*int64(time.Millisecond)).UTC()}\n\tdefault:\n\t\treturn fmt.Errorf(\"Couldn't convert json from (%T) %s to a time.Time\", value, data)\n\t}\n\treturn nil\n}", "func (v *CalendarDay) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&r, v)\n\treturn r.Error()\n}", "func (t *timeOrDate) UnmarshalJSON(b []byte) error {\n\tif string(b) == \"null\" {\n\t\treturn nil\n\t}\n\n\tvar timeStr string\n\tif err := json.Unmarshal(b, &timeStr); err != nil {\n\t\treturn err\n\t}\n\n\t// Try parsing as an RFC3339 timestamp\n\tif tm, err := time.Parse(time.RFC3339, timeStr); err == nil {\n\t\t*t = timeOrDate(tm)\n\t\treturn nil\n\t}\n\n\t// Try parsing as a date\n\ttm, err := time.Parse(\"2006-01-02\", timeStr)\n\tif err == nil {\n\t\t*t = timeOrDate(tm)\n\t}\n\treturn err\n}", "func (booking *Booking) UnmarshalJSON(b []byte) error {\n\ttemp := struct{\n\t\tName string `json:\"name\"`\n\t\tDate string `json:\"date\"`\n\t}{}\n\n\terr := json.Unmarshal(b, &temp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tformat := \"2006-01-02\"\n\tdate, err := time.Parse(format , temp.Date)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbooking.Name = temp.Name\n\tbooking.Date = date\n\treturn nil\n}", "func (a *DateOfMonthScheduledTriggerFilter) UnmarshalJSON(b []byte) error {\n\t// we don't do anything special here, but because our embedded DaysPerMonthScheduledTriggerFilter has a custom UnmarshalJSON, we must do it too\n\terr := json.Unmarshal(b, &a.DaysPerMonthScheduledTriggerFilter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlocals := struct {\n\t\tDateOfMonth string `json:\"DateOfMonth,omitempty\"`\n\t}{}\n\terr = json.Unmarshal(b, &locals)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.DateOfMonth = locals.DateOfMonth\n\treturn nil\n}", "func (t *TimeNoTZ) UnmarshalJSON(date []byte) error {\n\tnt, err := time.Parse(TimeNoTZLayout, string(date))\n\t*t = TimeNoTZ(nt)\n\treturn err\n}", "func (v *calendarDaySlice) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(&r, v)\n\treturn r.Error()\n}", "func (t *iso8601Datetime) UnmarshalJSON(data []byte) error {\n\t// Ignore null, like in the main JSON package.\n\tif string(data) == \"null\" {\n\t\treturn nil\n\t}\n\t// Fractional seconds are handled implicitly by Parse.\n\tvar err error\n\tif t.Time, err = time.Parse(strconv.Quote(iso8601Layout), string(data)); err != nil {\n\t\treturn ErrInvalidISO8601\n\t}\n\treturn err\n}", "func (t *Timestamp) UnmarshalJSON(data []byte) (err error) {\n\tt.Time, err = time.Parse(`\"`+time.RFC3339+`\"`, string(data))\n\treturn\n}", "func (mdt *MediaDateTime) UnmarshalJSON(b []byte) (err error) {\n\tif b[0] == '\"' && b[len(b)-1] == '\"' {\n\t\tb = b[1 : len(b)-1]\n\t}\n\tif string(b) == \"0000-00-00 00:00:00\" {\n\t\tmdt.Time = time.Time{}\n\t\treturn nil\n\t}\n\tmdt.Time, err = time.Parse(dateTimeLayout, string(b))\n\treturn err\n}", "func (s *Serving) UnmarshalJSON(text []byte) (err error) {\n\tvar sj servingJSON\n\terr = json.Unmarshal(text, &sj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.MealPlanID = sj.MealPlanID\n\ts.MealID = sj.MealID\n\n\ts.Date, err = time.Parse(JSONDateFormat, sj.Date)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tif data == nil {\n\t\treturn nil\n\t}\n\tstr := string(data)\n\tif len(strings.Trim(str, \" \")) == 0 {\n\t\treturn nil\n\t}\n\tstr = strings.Trim(str, \" \\\"\")\n\ttime, err := time.Parse(\"02-01-2006\", str)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time = time\n\treturn nil\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(src []byte) error {\n\tsrc = bytes.Trim(src, \"\\\"\")\n\tts, err := strconv.ParseInt(string(src), 10, 64)\n\tif err == nil {\n\t\ttm := time.Unix(ts/1e3, ts%1e3*1e6).UTC()\n\t\t*t = Timestamp(tm)\n\t\treturn nil\n\t}\n\n\tlayout := fmt.Sprintf(`%s`, time.RFC3339)\n\ttm, err := time.Parse(layout, string(src))\n\tif err == nil {\n\t\t*t = Timestamp(tm)\n\t\treturn nil\n\t}\n\n\tlayout = `2006-01-02`\n\ttm, err = time.Parse(layout, string(src))\n\t*t = Timestamp(tm)\n\treturn err\n}", "func (r *WeekDay) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"WeekDay: should be a string, got %s\", string(data))\n\t}\n\tv, ok := defWeekDayNameToValue[s]\n\tif !ok {\n\t\treturn fmt.Errorf(\"WeekDay(%q) is invalid value\", s)\n\t}\n\t*r = v\n\treturn nil\n}", "func (t Timestamp) UnmarshalJSON(b []byte) (err error) {\n\ttsUnix, _ := strconv.ParseInt(string(b), 10, 0)\n\tt = Timestamp(time.Unix(tsUnix, 0))\n\treturn\n}", "func (t *timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = timestamp(time.Unix(int64(ts), 0))\n\treturn nil\n}", "func (n *NullDateTime) UnmarshalJSON(b []byte) error {\n\tn.Valid = false\n\tn.DateTime = civil.DateTime{}\n\tif bytes.Equal(b, jsonNull) {\n\t\treturn nil\n\t}\n\n\ts, err := strconv.Unquote(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdt, err := parseCivilDateTime(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn.DateTime = dt\n\n\tn.Valid = true\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Timestamp(time.Unix(int64(ts), 0))\n\treturn nil\n}", "func (ts *Timestamp) UnmarshalJSON(value []byte) error {\n\n\t// Handle the null constant.\n\tif string(value) == \"null\" {\n\t\treturn nil\n\t}\n\n\t// Parse the timestamp.\n\tt, err := time.Parse(ReferenceTime, string(value))\n\t*ts = Timestamp(t)\n\treturn err\n}", "func (v *dateField) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson390b7126DecodeGithubComChancedPicker41(l, v)\n}", "func (v *Timestamp) UnmarshalJSON(data []byte) error {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\tvar in interface{}\n\tif err := json.Unmarshal(data, &in); err != nil {\n\t\treturn err\n\t}\n\treturn v.Scan(in)\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) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Timestamp(time.Unix(int64(ts), 0))\n\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Timestamp(time.Unix(int64(ts), 0))\n\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(data []byte) error {\n\t// Ignore null, like in the main JSON package.\n\tif string(data) == \"null\" {\n\t\treturn nil\n\t}\n\n\tunix, err := strconv.ParseInt(string(data), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Timestamp(unix)\n\treturn nil\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 (t *unix) UnmarshalJSON(data []byte) error {\n\t// Ignore null, like in the main JSON package.\n\ts := string(data)\n\tif s == \"null\" {\n\t\treturn nil\n\t}\n\n\tv, err := stringToInt64(s)\n\tif err != nil {\n\t\t// return this specific error to maintain existing tests.\n\t\t// TODO: consider refactoring tests to not assert against error string\n\t\treturn ErrInvalidTime\n\t}\n\n\tt.Time = time.Unix(v, 0).In(time.UTC)\n\n\treturn nil\n}", "func (t *JSONTime) UnmarshalJSON(buf []byte) error {\n\ttt, err := time.Parse(\"2006-01-02 15:04\", strings.Trim(string(buf), `\"`))\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time = tt\n\treturn nil\n}", "func (t *CodeBuildTime) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\n\tts, err := time.Parse(codeBuildTimeFormat, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = CodeBuildTime(ts)\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(b []byte) (err error) {\n\ts := strings.Trim(string(b), \"\\\"\")\n\tif s == \"null\" {\n\t\tt.Time = time.Time{}\n\t\treturn\n\t}\n\tif strings.HasSuffix(s, \"Z\") {\n\t\ts = s[:len(s)-1]\n\t}\n\n\tt.Time, err = time.Parse(dateFormat, s)\n\treturn\n}", "func (nt *NullTime) UnmarshalJSON(b []byte) (err error) {\n\t// scan for null\n\tif bytes.Equal(b, []byte(\"null\")) {\n\t\treturn nt.Scan(nil)\n\t}\n\tvar t time.Time\n\tvar err2 error\n\tif err := json.Unmarshal(b, &t); err != nil {\n\t\t// Try for JS new Date().toJSON()\n\t\tif t, err2 = time.Parse(\"2006-01-02T15:04:05.000Z\", string(b)); err2 != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nt.Scan(t)\n}", "func (t *JSONTime) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\ttm, err := time.Parse(\"2006-01-02 15:04:05\", s)\n\tt.Time = tm\n\treturn err\n}", "func (v *TimeEntryActivity) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson44273644DecodeGithubComSomniSomGoRedmine1(&r, v)\n\treturn r.Error()\n}", "func (f *DataFormat) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"Data Format type should be a string, got %s\", data)\n\t}\n\n\tdf, err := ParseDataFormatString(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*f = df\n\treturn nil\n}", "func (v *Event) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonF642ad3eDecodeGithubComFrequencyanalyticsFrequency(&r, v)\n\treturn r.Error()\n}", "func (t *UnixTimestamp) UnmarshalJSON(data []byte) (err error) {\n\tseconds, err := strconv.Atoi(\n\t\tstrings.Trim(string(data), \"\\\\\\\"\"),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = UnixTimestamp(time.Unix(int64(seconds), 0))\n\n\treturn nil\n}", "func (jt *JSONRFC3339NoZTimezone) UnmarshalJSON(data []byte) error {\n\tb := bytes.NewBuffer(data)\n\tdec := json.NewDecoder(b)\n\tvar s string\n\tif err := dec.Decode(&s); err != nil {\n\t\treturn err\n\t}\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\tt, err := time.Parse(RFC3339NoZ, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*jt = JSONRFC3339NoZTimezone(t)\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 (t *Time) UnmarshalJSON(data []byte) error {\n\tvar s int64\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"data should be number, got %s\", data)\n\t}\n\t*t = Time{time.Unix(s, 0)}\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 (tt *Time) UnmarshalJSON(input []byte) error {\n\tloc, err := time.LoadLocation(\"Europe/Amsterdam\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t// don't parse on empty dates\n\tif string(input) == `\"\"` {\n\t\treturn nil\n\t}\n\tnewTime, err := time.ParseInLocation(`\"2006-01-02 15:04:05\"`, string(input), loc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttt.Time = newTime\n\treturn nil\n}", "func (tt *EventTime) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"\\\"2006-01-02T15:04:05.9Z\\\"\", string(data))\n\t*tt = EventTime{&t}\n\treturn err\n}", "func (v *EventDomContentEventFired) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoPage84(&r, v)\n\treturn r.Error()\n}", "func (e *ExportRecurrencePeriod) 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 *Time) UnmarshalJSON(data []byte) error {}", "func (t *Transaction) UnmarshalJSON(data []byte) error {\n\ttype TransactionData Transaction\n\twrapper := &struct {\n\t\tCreated string `json:\"created\"`\n\t\t*TransactionData\n\t}{\n\t\tTransactionData: (*TransactionData)(t),\n\t}\n\tif err := json.Unmarshal(data, &wrapper); err != nil {\n\t\treturn err\n\t}\n\tt1, err := time.Parse(time.RFC3339, wrapper.Created)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Created = t1.Unix()\n\treturn nil\n}", "func (a *OnceDailyScheduledTriggerFilter) UnmarshalJSON(b []byte) error {\n\t// we don't do anything special here, but because our embedded scheduledTriggerFilter has a custom UnmarshalJSON, we must do it too\n\terr := json.Unmarshal(b, &a.scheduledTriggerFilter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlocals := struct {\n\t\tDays []Weekday `json:\"DaysOfWeek,omitempty\"`\n\t}{}\n\terr = json.Unmarshal(b, &locals)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.Days = locals.Days\n\treturn nil\n}", "func (j *JobDeliveryInfo) 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\", j, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"scheduledDateTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ScheduledDateTime\", &j.ScheduledDateTime)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (v *EventLoadEventFired) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoPage70(&r, v)\n\treturn r.Error()\n}", "func (t *JSONTime) UnmarshalJSON(data []byte) error { \r\n// Ignore null, like in the main JSON package. \r\n\tif string(data) == \"null\" { \r\n\t\treturn nil \r\n\t} \r\n\t// Fractional seconds are handled implicitly by Parse. \r\n\tvar err error \r\n\t(*t).Time, err = time.ParseInLocation(`\"`+YYYYMMDDHHMISS+`\"`, string(data), time.Local) \r\n\treturn err \r\n}", "func (tt *TickerTime) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"2006-01-02T15:04:05.9\", string(data))\n\t*tt = TickerTime{&t}\n\treturn err\n}", "func (j *Event) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tint64ts := int64(ts)\n\tif len(b) > 10 {\n\t\t//support for milisecond timestamps\n\t\tint64ts = int64(ts / 1000)\n\t}\n\t*t = Timestamp(time.Unix(int64ts, 0).UTC())\n\n\treturn nil\n}", "func (v *PointInTime) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker51(&r, v)\n\treturn r.Error()\n}", "func (b *LegendTime) UnmarshalJSON(src []byte) (err error) {\n\tstr := string(src[1 : len(src)-1])\n\n\tif str == \"ul\" {\n\t\treturn\n\t}\n\n\tb.Time, err = time.Parse(\"2006-01-02T15:04:05\", str)\n\n\tif err != nil {\n\t\t// Try again with another time format\n\t\tb.Time, err = time.Parse(\"Mon Jan _2\", str)\n\t}\n\treturn\n}", "func (v *Event) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6601e8cdDecodeGithubComGoParkMailRu2018242GameServerTypes12(&r, v)\n\treturn r.Error()\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 (c *CalendarMovie) UnmarshalJSON(bytes []byte) error {\n\ttype B CalendarMovie\n\ttype A struct {\n\t\tB\n\t\tReleased string `json:\"released\"`\n\t}\n\n\tvar a = new(A)\n\terr := json.Unmarshal(bytes, a)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ta.B.Released, err = time.Parse(`2006-01-02`, a.Released)\n\t*c = CalendarMovie(a.B)\n\treturn err\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 (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 (v *timeEntryActivitiesResult) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson44273644DecodeGithubComSomniSomGoRedmine(&r, v)\n\treturn r.Error()\n}", "func (t *Time) UnmarshalJSON(data []byte) (err error) {\n\n\tif string(data) == \"null\" {\n\t\tt.Time = time.Time{}\n\t\treturn\n\t}\n\n\tt.Time, err = time.Parse(`\"`+time.RFC3339+`\"`, string(data))\n\n\treturn\n}", "func (t *JSONTime) UnmarshalJSON(b []byte) error {\n\n\ts := strings.Trim(string(b), \"`'\\\" \")\n\n\tvar timeVal = time.Time{}\n\tvar err error\n\tif s != \"\" && s != \"null\" {\n\t\ttimeVal, err = time.Parse(time.RFC3339Nano, s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t*t = JSONTime(timeVal)\n\treturn nil\n}", "func (_ PolicyVersion) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\tif s == `\"2012-10-17\"` || s == `\"2008-10-17\"` {\n\t\treturn nil\n\t}\n\treturn InvalidPolicyVersionError(s)\n}", "func (w *Entry) UnmarshalJSON(bb []byte) error {\n\t<<!!YOUR_CODE!!>>\n}", "func (v *BaseHistoricalFundingRate) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi130(&r, v)\n\treturn r.Error()\n}", "func (ts *Timestamp) UnmarshalJSON(b []byte) error {\n\n\tif ekaenc.IsNullJSON(b) {\n\t\tif ts != nil {\n\t\t\t*ts = 0\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Length variants:\n\t// Date length variants: 10, 8\n\t// Clock length variants: 4, 5, 6, 8,\n\t// Quotes: 2,\n\t// Date time separator: 1.\n\t//\n\t// So, summary variants:\n\t// - 15 (8+4+2+1),\n\t// - 16 (8+5+2+1),\n\t// - 17 (8+6+2+1, 10+4+2+1),\n\t// - 18 (10+5+2+1),\n\t// - 19 (8+8+2+1, 10+6+2+1),\n\t// - 21 (10+8+2+1).\n\n\tswitch l := len(b); {\n\n\tcase !(l >= 15 && l <= 19) && l != 21:\n\t\treturn _ERR_NOT_ISO8601_TIMESTAMP\n\n\tcase b[0] != '\"' && b[l-1] != '\"':\n\t\treturn _ERR_BAD_JSON_TIMESTAMP_QUO\n\n\tdefault:\n\t\treturn ts.ParseFrom(b[1:l-1])\n\t}\n}", "func (v *SwapFundingTime) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi31(&r, v)\n\treturn r.Error()\n}", "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tvar v interface{}\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn errors.Wrap(err, \"failed to parse duration\")\n\t}\n\tswitch value := v.(type) {\n\tcase float64:\n\t\td.Duration = time.Duration(value*365*24) * time.Hour\n\tdefault:\n\t\treturn errors.New(\"invalid duration\")\n\t}\n\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tval := string(data)\n\tif val == `\"\"` {\n\t\treturn nil\n\t}\n\tnow, err := time.ParseInLocation(`\"2006-01-02 15:04:05\"`, val, time.Local)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Time(now)\n\treturn nil\n}", "func (t *Orderbook) UnmarshalJSON(data []byte) error {\n\tvar err error\n\ttype Alias Orderbook\n\taux := &struct {\n\t\tTimestamp string `json:\"timestamp\"`\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(t),\n\t}\n\tif err = json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(b []byte) error {\n\tval, err := time.Parse(`\"2006-01-02T15:04:05\"`, string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Time(val)\n\n\treturn nil\n}", "func (mp *MealPlan) UnmarshalJSON(text []byte) (err error) {\n\tvar mpj mealPlanJSON\n\terr = json.Unmarshal(text, &mpj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmp.ID = mpj.ID\n\tmp.Notes = mpj.Notes\n\n\tmp.StartDate, err = time.Parse(JSONDateFormat, mpj.StartDate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmp.EndDate, err = time.Parse(JSONDateFormat, mpj.EndDate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (v *dateRangeField) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson390b7126DecodeGithubComChancedPicker40(l, v)\n}", "func (i *MonthlySchedule) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"MonthlySchedule should be a string, got %s\", data)\n\t}\n\n\tvar err error\n\t*i, err = MonthlyScheduleString(s)\n\treturn err\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tmillis, err := strconv.ParseInt(string(data), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Time(time.Unix(0, millis*int64(time.Millisecond)))\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) (err error) {\n\tif data[0] != []byte(`\"`)[0] || data[len(data)-1] != []byte(`\"`)[0] {\n\t\treturn errors.New(\"Not quoted\")\n\t}\n\t*t, err = ParseTime(string(data[1 : len(data)-1]))\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 (d *Duration) UnmarshalJSON(b []byte) (err error) {\n\td.Duration, err = time.ParseDuration(strings.Trim(string(b), `\"`))\n\treturn\n}" ]
[ "0.81394374", "0.80700237", "0.8037812", "0.7958249", "0.7948897", "0.79188573", "0.78638464", "0.7809091", "0.776579", "0.74939996", "0.7479637", "0.7475169", "0.73422307", "0.7309434", "0.7237858", "0.7201589", "0.7178287", "0.71777284", "0.7090374", "0.70767206", "0.6944116", "0.6854123", "0.68519706", "0.67177117", "0.6687022", "0.66382337", "0.65509146", "0.6529476", "0.6522171", "0.6475837", "0.6452237", "0.6445174", "0.6443975", "0.6415733", "0.6410009", "0.6373477", "0.63598096", "0.6347537", "0.63048023", "0.6302331", "0.629823", "0.6296717", "0.6295264", "0.62841415", "0.62841415", "0.6253975", "0.6251896", "0.6236161", "0.6232577", "0.6227599", "0.6214106", "0.6211136", "0.62082577", "0.61943114", "0.61685246", "0.61619246", "0.61613417", "0.61401826", "0.61348534", "0.6129809", "0.6129208", "0.6127124", "0.6127073", "0.61011153", "0.609347", "0.60918087", "0.6084996", "0.6082301", "0.60809", "0.6072374", "0.60529023", "0.60496575", "0.6046668", "0.60371315", "0.60322666", "0.6030944", "0.60236776", "0.6014286", "0.6008125", "0.6001234", "0.5992711", "0.5982748", "0.5977716", "0.59658694", "0.5965156", "0.59637177", "0.5962398", "0.5955632", "0.5953296", "0.59527427", "0.5952259", "0.5950239", "0.59438884", "0.5924572", "0.5913412", "0.589772", "0.5894228", "0.5878928", "0.5876692", "0.5868769" ]
0.7944045
5
UnmarshalJSON is custom container ID unmarshaler
func (c *ContainerID) UnmarshalJSON(b []byte) error { switch { case len(b) == 0: // nop case b[0] == '"': *c = ContainerID(strings.Replace(string(b), "\"", "", -1)) default: *c = ContainerID(string(b)) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Container) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &c.ID)\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 (j *JobID) UnmarshalJSON(b []byte) error {\n\tvar u UUID\n\tif err := json.Unmarshal(b, &u); err != nil {\n\t\treturn err\n\t}\n\t*j = JobID(u)\n\treturn nil\n}", "func (id *ID) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\tif s == \"null\" {\n\t\t*id = nilID\n\t\treturn nil\n\t}\n\treturn id.UnmarshalText(b[1 : len(b)-1])\n}", "func (uid *MyULID) UnmarshalJSON(data []byte) error {\n\tvar s string\n\terr := json.Unmarshal(data, &s)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttmp, err := ulid.Parse(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*uid = MyULID(string(tmp[:]))\n\treturn nil\n}", "func (v *AdScriptID) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoPage108(&r, v)\n\treturn r.Error()\n}", "func (id *KeyID) UnmarshalJSON(data []byte) error {\n\t// need to strip leading and trailing double quotes\n\tif data[0] != '\"' || data[len(data)-1] != '\"' {\n\t\treturn fmt.Errorf(\"KeyID is not quoted\")\n\t}\n\tdata = data[1 : len(data)-1]\n\t*id = make([]byte, hex.DecodedLen(len(data)))\n\t_, err := hex.Decode(*id, data)\n\treturn err\n}", "func (o *Kanban) UnmarshalJSON(data []byte) error {\n\tkv := make(map[string]interface{})\n\tif err := json.Unmarshal(data, &kv); err != nil {\n\t\treturn err\n\t}\n\to.FromMap(kv)\n\tif idstr, ok := kv[\"id\"].(string); ok {\n\t\to.ID = idstr\n\t}\n\treturn nil\n}", "func (j *QueueId) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (o *Echo) UnmarshalJSON(data []byte) error {\n\tkv := make(map[string]interface{})\n\tif err := json.Unmarshal(data, &kv); err != nil {\n\t\treturn err\n\t}\n\to.FromMap(kv)\n\tif idstr, ok := kv[\"id\"].(string); ok {\n\t\to.ID = idstr\n\t}\n\treturn nil\n}", "func (x *XID) UnmarshalJSON(b []byte) (err error) {\n\tif string(b) == \"null\" {\n\t\t*x = nilXID\n\t\treturn\n\t}\n\t*x, err = ParseXID(b2s(b[1 : len(b)-1]))\n\treturn\n}", "func (d *IdentityDocument) UnmarshalJSON(data []byte) error {\n\ttype identityDocument IdentityDocument\n\tvar doc identityDocument\n\terr := json.Unmarshal(data, &doc)\n\n\tif err == nil {\n\t\t*d = IdentityDocument(doc)\n\t} else {\n\t\t// the id is surrounded by \"\\\" characters, so strip them\n\t\td.ID = string(data[1 : len(data)-1])\n\t}\n\n\treturn nil\n}", "func (o *ExportData) UnmarshalJSON(data []byte) error {\n\tkv := make(map[string]interface{})\n\tif err := json.Unmarshal(data, &kv); err != nil {\n\t\treturn err\n\t}\n\to.FromMap(kv)\n\tif idstr, ok := kv[\"id\"].(string); ok {\n\t\to.ID = idstr\n\t}\n\treturn nil\n}", "func (o *Array_ID_A) UnmarshalJSON(b []byte) error {\n\treturn o.DeserializeJSON(b)\n}", "func (t *TrustedIDProvider) 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\", t, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &t.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &t.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &t.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &t.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (tid *TransactionID) UnmarshalJSON(b []byte) error {\n\treturn (*crypto.Hash)(tid).UnmarshalJSON(b)\n}", "func (c *ContainerNetworkInterface) 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 \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &c.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &c.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &c.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &c.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &c.Type)\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 (sc *StorageContainer) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar storageContainerProperties StorageContainerProperties\n\t\t\t\terr = json.Unmarshal(*v, &storageContainerProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tsc.StorageContainerProperties = &storageContainerProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tsc.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tsc.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tsc.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (sid *SpanID) UnmarshalJSON(data []byte) error {\n\tsid.id = [8]byte{}\n\treturn unmarshalJSON(sid.id[:], data)\n}", "func (id *JobID) UnmarshalJSON(b []byte) error {\n\t// Sanity check. +2 for wrapping quotes.\n\tif len(b) != jobIDStrLen+2 {\n\t\treturn errors.New(\"invalid uuid string\")\n\t}\n\n\t// Remove wrapping quotes from before converting to uuid,\n\t// i.e. `\"de305d54-75b4-431b-adb2-eb6b9e546014\"` --> `de305d54-75b4-431b-adb2-eb6b9e546014`\n\tu, err := uuid.FromString(string(b[1 : len(b)-1]))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*id = JobID(u)\n\treturn nil\n}", "func (e *ExpressRouteConnectionID) 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\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &e.ID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (z *Int) UnmarshalJSON(text []byte) error {}", "func (d *Dir) UnmarshalJSON(b []byte) error {\n\tvar j string\n\terr := json.Unmarshal(b, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Note that if the string cannot be found then it will be set to the zero value, 'Created' in this case.\n\t*d = toID[j]\n\treturn nil\n}", "func (id *NodeID) UnmarshalJSON(data []byte) error {\n\tvar unquoted string\n\terr := json.Unmarshal(data, &unquoted)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*id, err = NodeIDFromString(unquoted)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (u *UID) UnmarshalJSON(data []byte) error {\n\tu.Str = string(data[1 : len(data)-1])\n\treturn nil\n}", "func (bid *BlockID) UnmarshalJSON(b []byte) error {\n\treturn (*crypto.Hash)(bid).UnmarshalJSON(b)\n}", "func (fcid *FileContractID) UnmarshalJSON(b []byte) error {\n\treturn (*crypto.Hash)(fcid).UnmarshalJSON(b)\n}", "func (t *TaxID) UnmarshalJSON(data []byte) error {\n\tif id, ok := ParseID(data); ok {\n\t\tt.ID = id\n\t\treturn nil\n\t}\n\n\ttype taxID TaxID\n\tvar v taxID\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\n\t*t = TaxID(v)\n\treturn nil\n}", "func (v *Kick) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer20(&r, v)\n\treturn r.Error()\n}", "func (t *TenantIDDescription) 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\", t, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &t.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &t.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", t, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (oid *OutputID) UnmarshalJSON(b []byte) error {\n\treturn (*crypto.Hash)(oid).UnmarshalJSON(b)\n}", "func (j *CreateNhAssetOperation) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (a *ActivityReferenceIDAdded) UnmarshalJSON(b []byte) error {\n\tvar helper activityReferenceIDAddedUnmarshalHelper\n\tif err := json.Unmarshal(b, &helper); err != nil {\n\t\treturn err\n\t}\n\t*a = ActivityReferenceIDAdded(helper.Attributes)\n\treturn nil\n}", "func (e *ExpressRouteCircuitPeeringID) 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\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &e.ID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (id *ScheduleID) UnmarshalJSON(data []byte) error {\n\tscheduleID, err := ScheduleIDFromString(strings.Replace(string(data), \"\\\"\", \"\", 2))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tid.Shard = scheduleID.Shard\n\tid.Realm = scheduleID.Realm\n\tid.Schedule = scheduleID.Schedule\n\tid.checksum = scheduleID.checksum\n\n\treturn nil\n}", "func (containerType *ContainerType) UnmarshalJSON(b []byte) error {\n\tstrType := string(b)\n\n\tswitch strType {\n\tcase \"null\":\n\t\t*containerType = ContainerNormal\n\t\tseelog.Warn(\"Unmarshalled nil ContainerType as Normal\")\n\t\treturn nil\n\t// 'true' or 'false' for compatibility with state version <= 5\n\tcase \"true\":\n\t\t*containerType = ContainerEmptyHostVolume\n\t\treturn nil\n\tcase \"false\":\n\t\t*containerType = ContainerNormal\n\t\treturn nil\n\t}\n\n\tif len(strType) < 2 {\n\t\t*containerType = ContainerNormal\n\t\treturn errors.New(\"invalid length set for ContainerType: \" + string(b))\n\t}\n\tif b[0] != '\"' || b[len(b)-1] != '\"' {\n\t\t*containerType = ContainerNormal\n\t\treturn errors.New(\"invalid value set for ContainerType, must be a string or null; got \" + string(b))\n\t}\n\tstrType = string(b[1 : len(b)-1])\n\n\tcontType, ok := stringToContainerType[strType]\n\tif !ok {\n\t\t*containerType = ContainerNormal\n\t\treturn errors.New(\"unrecognized ContainerType: \" + strType)\n\t}\n\t*containerType = contType\n\treturn nil\n}", "func (a *AssetContainerSas) 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 \"assetContainerSasUrls\":\n\t\t\terr = unpopulate(val, \"AssetContainerSasUrls\", &a.AssetContainerSasUrls)\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 (v *parentIDQuery) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker15(&r, v)\n\treturn r.Error()\n}", "func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {\n\tf.d.jsonUnmarshalV(tm)\n}", "func (fi *FlexInt) UnmarshalJSON(b []byte) error {\n\tif b[0] != '\"' {\n\t\treturn json.Unmarshal(b, (*int)(fi))\n\t}\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\ti, err := strconv.Atoi(s)\n\tif err != nil {\n\t\treturn nil\n\t}\n\t*fi = FlexInt(i)\n\treturn nil\n}", "func (m *MediaServiceIdentity) 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\", m, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &m.PrincipalID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &m.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &m.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"userAssignedIdentities\":\n\t\t\terr = unpopulate(val, \"UserAssignedIdentities\", &m.UserAssignedIdentities)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (p *PaymentID) UnmarshalJSON(data []byte) error {\n\tvar str string\n\terr := json.Unmarshal(data, &str)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*p, err = ParsePaymentIDStr(str)\n\treturn err\n}", "func (u *UID) UnmarshalJSON(data []byte) error {\n\t// treat empty strings as null\n\tif len(data) == 0 || string(data) == \"\" || string(data) == \"\\\"\\\"\" || string(data) == \"\\\"null\\\"\" {\n\t\tu.NullUUID = uuid.NullUUID{Valid: false}\n\t\treturn nil\n\t}\n\n\treturn json.Unmarshal(data, &u.NullUUID)\n}", "func (this *ContainerImageConfiguration) UnmarshalJSON(b []byte) error {\n\treturn CommonUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "func (o *OrchestratorIdentity) 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\", o, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &o.PrincipalID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &o.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &o.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", o, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (v *PlantainerShadowMetadataSt) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson5bd79fa1DecodeMevericcoreMcplantainer9(&r, v)\n\treturn r.Error()\n}", "func IntUnmarshalJSON(z *big.Int, text []byte) error", "func (u *UUID) UnmarshalJSON(d []byte) error {\n\tcontent, err := strconv.Unquote(string(d))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn u.UnmarshalJSON([]byte(content))\n}", "func (i *Identity) 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\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &i.PrincipalID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &i.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &i.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"userAssignedIdentities\":\n\t\t\terr = unpopulate(val, \"UserAssignedIdentities\", &i.UserAssignedIdentities)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (i *Identity) 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\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &i.PrincipalID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &i.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &i.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"userAssignedIdentities\":\n\t\t\terr = unpopulate(val, \"UserAssignedIdentities\", &i.UserAssignedIdentities)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (v *idsQuery) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker27(&r, v)\n\treturn r.Error()\n}", "func jsonToSingleContainer(json types.ContainerJSON) types.Container {\n\treturn types.Container{\n\t\tID: json.ID,\n\t\tNames: []string{json.Name},\n\t\tLabels: json.Config.Labels,\n\t\tState: json.State.Status,\n\t\tStatus: json.State.Status,\n\t}\n}", "func (u *UUID) UnmarshalJSON(b []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\treturn u.UnmarshalText([]byte(s))\n}", "func (l *ListContainerSasInput) 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\", l, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"expiryTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ExpiryTime\", &l.ExpiryTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"permissions\":\n\t\t\terr = unpopulate(val, \"Permissions\", &l.Permissions)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", l, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (e *Unsigned) UnmarshalJSON(b []byte) error {\n\to := outEnvelope{}\n\terr := json.Unmarshal(b, &o)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar body identity.Mutable\n\n\tt := o.ID.Type()\n\tswitch t {\n\tcase 0x01:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.UserV1{}\n\t\tcase 2:\n\t\t\tbody = &primitive.User{}\n\t\t}\n\tcase 0x03:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Service{}\n\t\t}\n\tcase 0x04:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Project{}\n\t\t}\n\tcase 0x05:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Environment{}\n\t\t}\n\tcase 0x0d:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Org{}\n\t\t}\n\tcase 0x0e:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Membership{}\n\t\t}\n\tcase 0x0f:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Team{}\n\t\t}\n\tcase 0x10:\n\t\tswitch o.Version {\n\t\tcase 2:\n\t\t\tbody = &primitive.Token{}\n\t\t}\n\tcase 0x11:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Policy{}\n\t\t}\n\tcase 0x12:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.PolicyAttachment{}\n\t\t}\n\tcase 0x13:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.OrgInvite{}\n\t\t}\n\tcase 0x17:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Machine{}\n\t\t}\n\tcase 0x18:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.MachineToken{}\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown primitive type id: %#02x\", t)\n\t}\n\n\tif body == nil {\n\t\treturn fmt.Errorf(\"Unknown schema version %d for primitive type id: %#02x\", o.Version, t)\n\t}\n\n\terr = json.Unmarshal(o.Body, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.ID = o.ID\n\te.Version = o.Version\n\n\te.Body = body\n\n\treturn nil\n}", "func unmarshalJSON(i *big.Int, bz []byte) error {\n\tvar text string\n\terr := json.Unmarshal(bz, &text)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn i.UnmarshalText([]byte(text))\n}", "func (i *ImageTemplateManagedImageSource) 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 \"imageId\":\n\t\t\terr = unpopulate(val, &i.ImageID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, &i.Type)\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 (m *TamIdentifiers) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tName string `json:\"Name,omitempty\"`\n\n\t\tValue string `json:\"Value,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO0); err != nil {\n\t\treturn err\n\t}\n\n\tm.Name = dataAO0.Name\n\n\tm.Value = dataAO0.Value\n\n\treturn nil\n}", "func (this *NamespacedName) UnmarshalJSON(b []byte) error {\n\treturn CommonUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "func (i *Invoice) UnmarshalJSON(data []byte) error {\n\tif id, ok := ParseID(data); ok {\n\t\ti.ID = id\n\t\treturn nil\n\t}\n\n\ttype invoice Invoice\n\tvar v invoice\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\n\t*i = Invoice(v)\n\treturn nil\n}", "func (u *UUID) UnmarshalJSON(b []byte) error {\n\tif len(b) != 38 || b[0] != '\"' || b[37] != '\"' {\n\t\treturn ErrInvalidUUID\n\t}\n\tid, err := Parse(b[1:37])\n\tif err != nil {\n\t\treturn err\n\t}\n\t*u = id\n\treturn nil\n}", "func (f *FlexString) UnmarshalJSON(b []byte) error {\n\tif b[0] != '\"' {\n\t\tvar i int\n\t\terr := json.Unmarshal(b, &i)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*f = FlexString(strconv.Itoa(i))\n\t\treturn nil\n\t}\n\treturn json.Unmarshal(b, (*string)(f))\n}", "func (v *VirtualHubID) 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\", v, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &v.ID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (a *OIDCIdentity) Unmarshal(bytes []byte) error {\n\treturn trace.Wrap(json.Unmarshal(bytes, a))\n}", "func (d *LegacyDec) UnmarshalJSON(bz []byte) error {\n\tif d.i == nil {\n\t\td.i = new(big.Int)\n\t}\n\n\tvar text string\n\terr := json.Unmarshal(bz, &text)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: Reuse dec allocation\n\tnewDec, err := LegacyNewDecFromStr(text)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.i = newDec.i\n\treturn nil\n}", "func UnmarshalJSON(b []byte, discriminator string, f Factory) (interface{}, error) {\n\tm := make(map[string]interface{})\n\terr := json.Unmarshal(b, &m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Decode(m, discriminator, f)\n}", "func (c *CreateOrUpdateTrustedIDProviderProperties) 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 \"idProvider\":\n\t\t\terr = unpopulate(val, \"IDProvider\", &c.IDProvider)\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 (m *NavBarContainerStruct) UnmarshalJSON(bytes []byte) error{\n var tmp NavBarContainerStruct\n\n if err := json.Unmarshal(bytes, &tmp); err != nil {\n return err\n }\n m.NavBar = tmp.NavBar\n m.NavBar.ComponentData.NavBarItems = tmp.NavBarItems\n m.NavBarItems = tmp.NavBarItems\n return nil\n}", "func (r *RegisteredAsn) 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\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &r.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (this *BaseKubernetesContainerConfiguration) UnmarshalJSON(b []byte) error {\n\treturn CommonUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "func (u *UserAssignedIdentity) 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 \"clientId\":\n\t\t\terr = unpopulate(val, \"ClientID\", &u.ClientID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &u.PrincipalID)\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 (u *UserAssignedIdentity) 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 \"clientId\":\n\t\t\terr = unpopulate(val, \"ClientID\", &u.ClientID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &u.PrincipalID)\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 (u *UserAssignedIdentity) 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 \"clientId\":\n\t\t\terr = unpopulate(val, \"ClientID\", &u.ClientID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &u.PrincipalID)\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 (j *LuaInt) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (i *ImageTemplateManagedImageDistributor) 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 \"artifactTags\":\n\t\t\terr = unpopulate(val, &i.ArtifactTags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"imageId\":\n\t\t\terr = unpopulate(val, &i.ImageID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, &i.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"runOutputName\":\n\t\t\terr = unpopulate(val, &i.RunOutputName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, &i.Type)\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 parsePIDFromJSON(j []byte, runtime string) (int, error) {\n\n\tvar pid int\n\n\t// in crio, pid is present inside pid attribute of inspect output\n\t// in containerd, pid is present inside `info.pid` of inspect output\n\tif runtime == \"containerd\" {\n\t\tvar resp InspectResponse\n\t\tif err := json.Unmarshal(j, &resp); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tpid = resp.Info.PID\n\t} else if runtime == \"crio\" {\n\t\tvar resp InfoDetails\n\t\tif err := json.Unmarshal(j, &resp); err != nil {\n\t\t\treturn 0, errors.Errorf(\"[cri]: Could not find pid field in json: %s\", string(j))\n\t\t}\n\t\tpid = resp.PID\n\t} else {\n\t\treturn 0, errors.Errorf(\"[cri]: No supported container runtime, runtime: %v\", runtime)\n\t}\n\n\tif pid == 0 {\n\t\treturn 0, errors.Errorf(\"[cri]: No running target container found, pid: %v\", string(pid))\n\t}\n\n\treturn pid, nil\n}", "func (x *CMsgDOTAPopup_PopupID) 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 = CMsgDOTAPopup_PopupID(num)\n\treturn nil\n}", "func (f *RetireConnectionIDFrame) UnmarshalJSONObject(dec *gojay.Decoder, key string) error {\n\tif key == \"sequence_number\" {\n\t\treturn dec.Uint64(&f.SequenceNumber)\n\t}\n\treturn nil\n}", "func (u *UserAssignedManagedIdentity) 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 \"clientId\":\n\t\t\terr = unpopulate(val, \"ClientID\", &u.ClientID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &u.PrincipalID)\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 (s *SystemAssignedServiceIdentity) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"principalId\":\n\t\t\terr = unpopulate(val, \"PrincipalID\", &s.PrincipalID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tenantId\":\n\t\t\terr = unpopulate(val, \"TenantID\", &s.TenantID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &s.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (o *Orchestrator) 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\", o, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &o.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"identity\":\n\t\t\terr = unpopulate(val, \"Identity\", &o.Identity)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"kind\":\n\t\t\terr = unpopulate(val, \"Kind\", &o.Kind)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &o.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &o.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &o.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &o.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &o.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", o, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (m *TimeUnit) UnmarshalJSON(b []byte) error {\n\tvar j string\n\terr := json.Unmarshal(b, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Note that if the string cannot be found then it will be set to the zero value, 'Created' in this case.\n\t*m = toTimeUnitID[j]\n\treturn nil\n}", "func (s *StorageInformation) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &s.ID)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (o *ProjectWebhook) UnmarshalJSON(data []byte) error {\n\tkv := make(map[string]interface{})\n\tif err := json.Unmarshal(data, &kv); err != nil {\n\t\treturn err\n\t}\n\to.FromMap(kv)\n\tif idstr, ok := kv[\"id\"].(string); ok {\n\t\to.ID = idstr\n\t}\n\treturn nil\n}", "func (c *ContainerNetworkInterfaceConfiguration) 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 \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &c.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &c.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &c.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &c.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &c.Type)\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 (j *BootInitiationRespPacket) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (k *KustoPoolDatabasesClientCreateOrUpdateResult) UnmarshalJSON(data []byte) error {\n\tres, err := unmarshalDatabaseClassification(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tk.DatabaseClassification = res\n\treturn nil\n}", "func (i *Issuer) UnmarshalJSON(data []byte) error {\n\tvar name Name\n\tif err := name.UnmarshalJSON(data); err != nil {\n\t\treturn err\n\t}\n\t*i = Issuer(name)\n\treturn nil\n}", "func (id *ID) Unmarshal(dec *marshal.Decoder) {\n\tb := dec.Byte()\n\tswitch b {\n\tcase 0:\n\t\t*id = ID(dec.Varint())\n\tcase 1:\n\t\t*id = Intern(dec.Symbol())\n\tdefault:\n\t\tlog.Panicf(\"unmarshal symbol.id: corrupt data %v\", b)\n\t}\n}", "func (id *UUID) UnmarshalJSON(data []byte) error {\n\t// Data is expected to be a json string, like: \"819c4ff4-31b4-4519-5d24-3c4a129b8649\"\n\tif len(data) < 2 || data[0] != '\"' || data[len(data)-1] != '\"' {\n\t\treturn fmt.Errorf(\"invalid UUID in JSON, %v is not a valid JSON string\", string(data))\n\t}\n\n\t// Grab string value without the surrounding \" characters\n\tvalue := string(data[1 : len(data)-1])\n\tparsed, err := ParseUUID(value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid UUID in JSON, %v: %v\", value, err)\n\t}\n\n\t// Dereference pointer value and store parsed\n\t*id = parsed\n\treturn nil\n}", "func (u *UID) UnmarshalJSON(b []byte) error {\n\tif !utf8.Valid(b) {\n\t\treturn fmt.Errorf(\"invalid UID string: %s\", b)\n\t}\n\n\tuid, err := strconv.Unquote(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*u = UID(uid)\n\treturn nil\n}", "func (c *IntString) UnmarshalJSON(bytes []byte) error {\n\tr := make([]byte, 0)\n\tfor _, b := range bytes {\n\t\tswitch string(b) {\n\t\tcase \"\\\"\":\n\t\tdefault:\n\t\t\tr = append(r, b)\n\t\t}\n\t}\n\t*c = (IntString)(r)\n\treturn nil\n}", "func (v *GetAdScriptIDParams) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoPage59(&r, v)\n\treturn r.Error()\n}", "func (v *TransactionsSinceIDRequest) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonE82c8e88DecodeGithubComKamaiuOandaGoModel(&r, v)\n\treturn r.Error()\n}", "func (e *Signed) UnmarshalJSON(b []byte) error {\n\to := outEnvelope{}\n\terr := json.Unmarshal(b, &o)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar body identity.Immutable\n\n\tt := o.ID.Type()\n\tswitch t {\n\tcase 0x06:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.PublicKey{}\n\t\t}\n\tcase 0x07:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.PrivateKey{}\n\t\t}\n\tcase 0x08:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.Claim{}\n\t\t}\n\tcase 0x09:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.KeyringV1{}\n\t\tcase 2:\n\t\t\tbody = &primitive.Keyring{}\n\t\t}\n\tcase 0x0a:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.KeyringMemberV1{}\n\t\tcase 2:\n\t\t\tbody = &primitive.KeyringMember{}\n\t\t}\n\tcase 0x0b:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.CredentialV1{}\n\t\tcase 2:\n\t\t\tbody = &primitive.Credential{}\n\t\t}\n\tcase 0x15:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.KeyringMemberClaim{}\n\t\t}\n\tcase 0x16:\n\t\tswitch o.Version {\n\t\tcase 1:\n\t\t\tbody = &primitive.MEKShare{}\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown primitive type id: %#02x\", t)\n\t}\n\n\tif body == nil {\n\t\treturn fmt.Errorf(\"Unknown schema version %d for primitive type id: %#02x\", o.Version, t)\n\t}\n\n\terr = json.Unmarshal(o.Body, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.ID = o.ID\n\te.Version = o.Version\n\te.Signature = o.Signature\n\te.Body = body\n\n\treturn nil\n}", "func (this *Service) UnmarshalJSON(b []byte) error {\n\treturn CommonUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "func (v *Part) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer12(&r, v)\n\treturn r.Error()\n}", "func (i *Intangible) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.Name = &name\n\t\t\t}\n\t\tcase \"url\":\n\t\t\tif v != nil {\n\t\t\t\tvar URL string\n\t\t\t\terr = json.Unmarshal(*v, &URL)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.URL = &URL\n\t\t\t}\n\t\tcase \"image\":\n\t\t\tif v != nil {\n\t\t\t\tvar imageVar ImageObject\n\t\t\t\terr = json.Unmarshal(*v, &imageVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.Image = &imageVar\n\t\t\t}\n\t\tcase \"description\":\n\t\t\tif v != nil {\n\t\t\t\tvar description string\n\t\t\t\terr = json.Unmarshal(*v, &description)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.Description = &description\n\t\t\t}\n\t\tcase \"entityPresentationInfo\":\n\t\t\tif v != nil {\n\t\t\t\tvar entityPresentationInfo EntitiesEntityPresentationInfo\n\t\t\t\terr = json.Unmarshal(*v, &entityPresentationInfo)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.EntityPresentationInfo = &entityPresentationInfo\n\t\t\t}\n\t\tcase \"bingId\":\n\t\t\tif v != nil {\n\t\t\t\tvar bingID string\n\t\t\t\terr = json.Unmarshal(*v, &bingID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.BingID = &bingID\n\t\t\t}\n\t\tcase \"contractualRules\":\n\t\t\tif v != nil {\n\t\t\t\tcontractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.ContractualRules = &contractualRules\n\t\t\t}\n\t\tcase \"webSearchUrl\":\n\t\t\tif v != nil {\n\t\t\t\tvar webSearchURL string\n\t\t\t\terr = json.Unmarshal(*v, &webSearchURL)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.WebSearchURL = &webSearchURL\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.ID = &ID\n\t\t\t}\n\t\tcase \"_type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar TypeBasicResponseBase\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ti.Type = typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (this *Quantity) UnmarshalJSON(b []byte) error {\n\treturn CommonUnmarshaler.Unmarshal(bytes.NewReader(b), this)\n}", "func (v *MACCommandIdentifier) UnmarshalJSON(b []byte) error {\n\tif bt, ok := unmarshalJSONString(b); ok {\n\t\treturn v.UnmarshalText(bt)\n\t}\n\ti, err := unmarshalEnumFromNumber(\"MACCommandIdentifier\", MACCommandIdentifier_name, b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = MACCommandIdentifier(i)\n\treturn nil\n}", "func (v *EventContextCreated) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoWebaudio3(&r, v)\n\treturn r.Error()\n}" ]
[ "0.7148999", "0.6506939", "0.6456671", "0.626328", "0.62423307", "0.62230057", "0.62131965", "0.62050635", "0.61372226", "0.6101458", "0.6020385", "0.60104495", "0.5999803", "0.59816074", "0.5956228", "0.5951397", "0.59462184", "0.5914333", "0.59087616", "0.5903828", "0.5874978", "0.58515394", "0.58384144", "0.58218277", "0.58130175", "0.57958853", "0.57921165", "0.5761687", "0.57532996", "0.5752603", "0.57493794", "0.57391036", "0.5724651", "0.57108915", "0.5696814", "0.5663221", "0.56572175", "0.5654916", "0.56540674", "0.56516004", "0.56408614", "0.5636818", "0.5634443", "0.56306756", "0.56247836", "0.5605456", "0.5602584", "0.560076", "0.560076", "0.5598185", "0.55845463", "0.55799437", "0.5576217", "0.5574511", "0.55714923", "0.5568862", "0.5558053", "0.555223", "0.5550268", "0.55430007", "0.5529326", "0.55237025", "0.5519857", "0.55169016", "0.5515196", "0.5490712", "0.54841", "0.5483804", "0.5480973", "0.54794025", "0.54794025", "0.54794025", "0.54757714", "0.5475621", "0.5474887", "0.54736245", "0.5473523", "0.5472396", "0.54691166", "0.54689", "0.54654384", "0.5463835", "0.5463796", "0.54605687", "0.5460482", "0.5457678", "0.54553473", "0.54537344", "0.5453514", "0.5453319", "0.5445702", "0.5440861", "0.5440032", "0.5438039", "0.5430982", "0.5430595", "0.54285574", "0.5424692", "0.54235655", "0.54224676" ]
0.74064636
0
UnmarshalJSON is custom position unmarshaler
func (ep *ExtensionPosition) UnmarshalJSON(b []byte) error { if string(b) == "\"none\"" { *ep = ExtensionPosition(-1) return nil } v, err := strconv.Atoi(string(b)) if err != nil { return fmt.Errorf("Cannot unmarshal ExtensionPosition value: %v", err) } *ep = ExtensionPosition(v) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v *Position) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(&r, v)\n\treturn r.Error()\n}", "func (v *positionSlice) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca1(&r, v)\n\treturn r.Error()\n}", "func (x *RelativePosition) 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 = RelativePosition(num)\n\treturn nil\n}", "func (v *FuturesPositionBase) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi66(&r, v)\n\treturn r.Error()\n}", "func (v *Position) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(l, v)\n}", "func (v *FuturesPosition) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi67(&r, v)\n\treturn r.Error()\n}", "func (v *SwapPosition) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi21(&r, v)\n\treturn r.Error()\n}", "func (v *ClosePositionData) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi114(&r, v)\n\treturn r.Error()\n}", "func (v *ClosePositionInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi113(&r, v)\n\treturn r.Error()\n}", "func (v *FuturesFixedPosition) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi86(&r, v)\n\treturn r.Error()\n}", "func (p *WindowPosition) UnmarshalJSON(raw []byte) error {\n\tvar str string\n\n\terr := json.Unmarshal(raw, &str)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch strings.ToLower(str) {\n\tcase \"top\":\n\t\t*p = WindowPositionTop\n\tcase \"bottom\":\n\t\t*p = WindowPositionBottom\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid position %q\", str)\n\t}\n\n\treturn nil\n}", "func (v *FuturesCrossPosition) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi96(&r, v)\n\treturn r.Error()\n}", "func (v *positionSlice) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca1(l, v)\n}", "func (v *FuturesClosePositionParams) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi100(&r, v)\n\treturn r.Error()\n}", "func (v *SwapPositionHolding) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi20(&r, v)\n\treturn r.Error()\n}", "func (v *IndexedShape) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker53(&r, v)\n\treturn r.Error()\n}", "func (z *Int) UnmarshalJSON(text []byte) error {}", "func (v *FuturesClosePositionResult) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi99(&r, v)\n\treturn r.Error()\n}", "func (v *SwapPositionList) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi19(&r, v)\n\treturn r.Error()\n}", "func (v *FuturesFixedPositionHolding) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi85(&r, v)\n\treturn r.Error()\n}", "func (p *Point) UnmarshalJSON(data []byte) error {\n\tvar geo struct {\n\t\tCoordinates Position `json:\"coordinates\"`\n\t}\n\n\tif err := json.Unmarshal(data, &geo); err != nil {\n\t\treturn err\n\t}\n\n\t*p = Point(geo.Coordinates)\n\treturn nil\n}", "func unmarshalJSON(i *big.Int, bz []byte) error {\n\tvar text string\n\terr := json.Unmarshal(bz, &text)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn i.UnmarshalText([]byte(text))\n}", "func (p *Point) UnmarshalJSON(data []byte) error {\n // TODO throw an error if there is an issue parsing the body.\n dec := json.NewDecoder(bytes.NewReader(data))\n var values map[string]float64\n err := dec.Decode(&values)\n\n if err != nil {\n log.Print(err)\n return err\n }\n\n *p = *NewPoint(values[\"latitude\"], values[\"longitude\"])\n\n return nil\n}", "func (e *ExtendedLocation) 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\", e, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &e.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &e.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", e, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (v *PlaceOrderInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi56(&r, v)\n\treturn r.Error()\n}", "func (o *DataItems0) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar aO0 models.PermissionObject\n\tif err := swag.ReadJSON(raw, &aO0); err != nil {\n\t\treturn err\n\t}\n\to.PermissionObject = aO0\n\n\t// AO1\n\tvar dataAO1 struct {\n\t\tCreated strfmt.DateTime `json:\"created,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO1); err != nil {\n\t\treturn err\n\t}\n\n\to.Created = dataAO1.Created\n\n\treturn nil\n}", "func (v *ExportItem) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonB83d7b77DecodeGoplaygroundMyjson1(&r, v)\n\treturn r.Error()\n}", "func (d *LegacyDec) UnmarshalJSON(bz []byte) error {\n\tif d.i == nil {\n\t\td.i = new(big.Int)\n\t}\n\n\tvar text string\n\terr := json.Unmarshal(bz, &text)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: Reuse dec allocation\n\tnewDec, err := LegacyNewDecFromStr(text)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.i = newDec.i\n\treturn nil\n}", "func (v *BasePlaceOrderInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi119(&r, v)\n\treturn r.Error()\n}", "func (t *Orderbook) UnmarshalJSON(data []byte) error {\n\tvar err error\n\ttype Alias Orderbook\n\taux := &struct {\n\t\tTimestamp string `json:\"timestamp\"`\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(t),\n\t}\n\tif err = json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (v *ClosePositionInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi113(l, v)\n}", "func (v *SwapPosition) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi21(l, v)\n}", "func (j *Producer) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *FuturesPositionBase) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi66(l, v)\n}", "func (j *ForceSettlementOrder) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (j *FactoryPluginPacket) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (j *LuaInt) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *ClosePositionData) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi114(l, v)\n}", "func (v *Part) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer12(&r, v)\n\treturn r.Error()\n}", "func unmarshalJSON(j extv1.JSON, output *any) error {\n\tif len(j.Raw) == 0 {\n\t\treturn nil\n\t}\n\treturn json.Unmarshal(j.Raw, output)\n}", "func (*Parser) Unmarshal(p []byte, v interface{}) error {\n\tbomFileFormat := cyclonedx.BOMFileFormatJSON\n\tif !json.Valid(p) {\n\t\tbomFileFormat = cyclonedx.BOMFileFormatXML\n\t}\n\tbom := new(cyclonedx.BOM)\n\tdecoder := cyclonedx.NewBOMDecoder(bytes.NewBuffer(p), bomFileFormat)\n\tif err := decoder.Decode(bom); err != nil {\n\t\tpanic(err)\n\t}\n\n\ttemp := p\n\n\tif bomFileFormat == cyclonedx.BOMFileFormatXML {\n\t\tvar data cyclonedx.BOM\n\t\tif err := xml.Unmarshal(p, &data); err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling XML error: %v\", err)\n\t\t}\n\t\tif d, err := json.Marshal(data); err == nil {\n\t\t\ttemp = d\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"marshalling JSON error: %v\", err)\n\t\t}\n\t}\n\n\terr := json.Unmarshal(temp, v)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling JSON error: %v\", err)\n\t}\n\n\treturn nil\n}", "func (o *DataItems0) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar aO0 models.MainData\n\tif err := swag.ReadJSON(raw, &aO0); err != nil {\n\t\treturn err\n\t}\n\to.MainData = aO0\n\n\t// AO1\n\tvar aO1 models.ExtendedData\n\tif err := swag.ReadJSON(raw, &aO1); err != nil {\n\t\treturn err\n\t}\n\to.ExtendedData = aO1\n\n\t// AO2\n\tvar aO2 models.ServiceObject\n\tif err := swag.ReadJSON(raw, &aO2); err != nil {\n\t\treturn err\n\t}\n\to.ServiceObject = aO2\n\n\t// AO3\n\tvar dataAO3 struct {\n\t\tClass interface{} `json:\"class,omitempty\"`\n\n\t\tClinicGUID string `json:\"clinicGUID,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO3); err != nil {\n\t\treturn err\n\t}\n\n\to.Class = dataAO3.Class\n\n\to.ClinicGUID = dataAO3.ClinicGUID\n\n\treturn nil\n}", "func (v *DataRateOffset) UnmarshalJSON(b []byte) error {\n\tif bt, ok := unmarshalJSONString(b); ok {\n\t\treturn v.UnmarshalText(bt)\n\t}\n\ti, err := unmarshalEnumFromNumber(\"DataRateOffset\", DataRateOffset_name, b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = DataRateOffset(i)\n\treturn nil\n}", "func (j *Segment) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *FuturesBatchNewOrderItem) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi104(&r, v)\n\treturn r.Error()\n}", "func (v *FuturesCrossPositionHolding) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi95(&r, v)\n\treturn r.Error()\n}", "func (v *Boo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeMsgpJson(&r, v)\n\treturn r.Error()\n}", "func (v *PlaceOrdersInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi55(&r, v)\n\treturn r.Error()\n}", "func (v *EventNavigatedWithinDocument) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoPage69(&r, v)\n\treturn r.Error()\n}", "func (v *Item) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeDrhyuComIndexerModels2(&r, v)\n\treturn r.Error()\n}", "func (j *FactoryPluginRespPacket) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *FuturesPosition) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi67(l, v)\n}", "func (v *Order) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(&r, v)\n\treturn r.Error()\n}", "func (v *BaseOrderInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi120(&r, v)\n\treturn r.Error()\n}", "func (j *Publisher) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (o *FindScriptsOKBodyItems0AllOf0) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tID *string `json:\"id\"`\n\n\t\tRev *string `json:\"rev\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO0); err != nil {\n\t\treturn err\n\t}\n\n\to.ID = dataAO0.ID\n\n\to.Rev = dataAO0.Rev\n\n\t// AO1\n\tvar dataAO1 struct {\n\t\tCreatedAt *string `json:\"created_at\"`\n\n\t\tUpdatedAt string `json:\"updated_at,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO1); err != nil {\n\t\treturn err\n\t}\n\n\to.CreatedAt = dataAO1.CreatedAt\n\n\to.UpdatedAt = dataAO1.UpdatedAt\n\n\treturn nil\n}", "func (mi *MapItem) UnmarshalJSON(b []byte) error {\n\tvar v interface{}\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn err\n\t}\n\tmi.Value = v\n\tmi.index = nextIndex()\n\treturn nil\n}", "func (j *jsonNative) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (j *Type) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (c *ContractIndexData) UnmarshalJSON(b []byte) (err error) {\n\tvar resp []map[string]interface{}\n\n\tif err := json.Unmarshal(b, &resp); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling: %v\", err)\n\t}\n\n\tc.Symbol = resp[0][\"symbol\"].(string)\n\tc.Price = resp[0][\"index_price\"].(float64)\n\tc.Ts = int(resp[0][\"index_ts\"].(float64))\n\n\treturn\n}", "func (v *item) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonD2b7633eDecodeGithubComZhekabyGoGeneratorMongoRequestwrapperTests(&r, v)\n\treturn r.Error()\n}", "func (v *OrderInfo) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi62(&r, v)\n\treturn r.Error()\n}", "func (l *LocationInfo) UnmarshalJSON(d []byte) error {\n\ttype T2 LocationInfo // create new type with same structure as T but without its method set!\n\tx := struct {\n\t\tT2 // embed\n\t\tCapacity json.Number `json:\"capacity\"`\n\t}{T2: T2(*l)} // don't forget this, if you do and 't' already has some fields set you would lose them\n\n\tif err := json.Unmarshal(d, &x); err != nil {\n\t\treturn err\n\t}\n\t*l = LocationInfo(x.T2)\n\tl.Capacity = x.Capacity.String()\n\treturn nil\n}", "func (v *orderSlice) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca2(&r, v)\n\treturn r.Error()\n}", "func (j *LuaNumber) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (j *Event) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (j *ProposalUpdateOperation) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *FuturesFixedPosition) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi86(l, v)\n}", "func (j *ListPluginPacket) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (j *Message) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *Order) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi63(&r, v)\n\treturn r.Error()\n}", "func IntUnmarshalJSON(z *big.Int, text []byte) error", "func (v *Element) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonB83d7b77DecodeGoplaygroundMyjson2(&r, v)\n\treturn r.Error()\n}", "func (j *QueueId) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (pi *proxyItem) Unmarshal(data []byte) error {\n\tif pi == nil || pi.obj == nil {\n\t\treturn nil\n\t}\n\n\tswitch m := pi.obj.(type) {\n\tcase encoding.BinaryUnmarshaler:\n\t\treturn m.UnmarshalBinary(data)\n\tcase storage.Unmarshaler:\n\t\treturn m.Unmarshal(data)\n\t}\n\treturn json.Unmarshal(data, &pi.obj)\n}", "func (m *MultiPoint) UnmarshalJSON(data []byte) error {\n\tvar geo struct {\n\t\tCoordinates []Position `json:\"coordinates\"`\n\t}\n\n\tif err := json.Unmarshal(data, &geo); err != nil {\n\t\treturn err\n\t}\n\n\t*m = MultiPoint(geo.Coordinates)\n\treturn nil\n}", "func (j *CreateNhAssetOperation) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *WSDepthItem) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi10(&r, v)\n\treturn r.Error()\n}", "func (s *StreamingLocator) 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\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &s.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &s.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &s.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &s.SystemData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &s.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (a *Meta_Longitude) UnmarshalJSON(b []byte) error {\n\tobject := make(map[string]json.RawMessage)\n\terr := json.Unmarshal(b, &object)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(object) != 0 {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t\tfor fieldName, fieldBuf := range object {\n\t\t\tvar fieldVal interface{}\n\t\t\terr := json.Unmarshal(fieldBuf, &fieldVal)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, fmt.Sprintf(\"error unmarshaling field %s\", fieldName))\n\t\t\t}\n\t\t\ta.AdditionalProperties[fieldName] = fieldVal\n\t\t}\n\t}\n\treturn nil\n}", "func (z *Z) UnmarshalJSON(input []byte) error {\n\ttype Z struct {\n\t\tS *string `json:\"s\"`\n\t\tI *int32 `json:\"iVal\"`\n\t}\n\tvar dec Z\n\tif err := json.Unmarshal(input, &dec); err != nil {\n\t\treturn err\n\t}\n\tif dec.S != nil {\n\t\tz.S = *dec.S\n\t}\n\tif dec.I != nil {\n\t\tz.I = *dec.I\n\t}\n\treturn nil\n}", "func (v *OneUpdateLike) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\tdecodeOneUpdateLike(&r, v)\n\treturn r.Error()\n}", "func (v *Annotation) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6a975c40DecodeGithubComSerhio83DruidPkgStructs3(&r, v)\n\treturn r.Error()\n}", "func (j *qProxyClient) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (pu *podUnmarshaller) unmarshal(data []byte, v interface{}) error {\n\treturn pu.jsonConfig.Unmarshal(data, v)\n}", "func (v *BlitzedItemResponse) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6a975c40DecodeJsonBenchmark4(&r, v)\n\treturn r.Error()\n}", "func (j *EventMsg) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *FuturesBatchNewOrderParams) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi103(&r, v)\n\treturn r.Error()\n}", "func (jz JSONGzipEncoding) Unmarshal(data []byte, value interface{}) error {\n\tjsonData, err := GzipDecode(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(jsonData, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (v *geoPointField) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker33(&r, v)\n\treturn r.Error()\n}", "func (v *OneLike) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\tdecodeOneLike(&r, v)\n\treturn r.Error()\n}", "func (v *Vector) UnmarshalJSON(b []byte) error {\n\tvar text string\n\tif err := json.Unmarshal(b, &text); err != nil {\n\t\treturn err\n\t}\n\tcooS := strings.Split(text, \" \")\n\tif len(cooS) != 2 {\n\t\treturn errors.New(\"coordinate should have two values\")\n\t}\n\n\tvar err error\n\tif v.X, err = strconv.ParseFloat(cooS[0], 64); err != nil {\n\t\treturn errors.New(\"could not parse X\")\n\t}\n\tif v.Y, err = strconv.ParseFloat(cooS[1], 64); err != nil {\n\t\treturn errors.New(\"could not parse Y\")\n\t}\n\treturn nil\n}", "func (x *MemcacheIncrementRequest_Direction) 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 = MemcacheIncrementRequest_Direction(num)\n\treturn nil\n}", "func (v *DocumentResponse) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6a975c40DecodeJsonBenchmark3(&r, v)\n\treturn r.Error()\n}", "func (v *Mode) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson42239ddeDecodeGithubComKhliengDispatchServer16(&r, v)\n\treturn r.Error()\n}", "func (j *Packet) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (j *RunPacket) UnmarshalJSON(input []byte) error {\n\tfs := fflib.NewFFLexer(input)\n\treturn j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)\n}", "func (v *PbTestObject) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson5fcf962eDecodeGithubComJsonIteratorGoBenchmarkWith10IntFields(&r, v)\n\treturn r.Error()\n}", "func (v *SpotOrderResponse) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi41(&r, v)\n\treturn r.Error()\n}", "func (i *ItemsField) UnmarshalJSON(data []byte) error {\n\tif peekToken(data) == json.Delim('{') {\n\t\ti.Items = new(RefOrSchema)\n\t\treturn json.Unmarshal(data, i.Items)\n\t}\n\treturn json.Unmarshal(data, &i.TupleFields)\n}" ]
[ "0.74146724", "0.6868145", "0.67995036", "0.6693155", "0.66368324", "0.6594695", "0.6593127", "0.65247303", "0.6522809", "0.649227", "0.6414832", "0.62570053", "0.61681646", "0.6066703", "0.60507333", "0.6030418", "0.600614", "0.5978521", "0.5969089", "0.5952851", "0.594557", "0.5904134", "0.58865505", "0.58136326", "0.5797172", "0.57904655", "0.57898843", "0.57784945", "0.5762611", "0.5759248", "0.5746328", "0.57379735", "0.57348853", "0.5730107", "0.57221264", "0.5719001", "0.57170963", "0.5711581", "0.57030135", "0.56915665", "0.56912524", "0.56885034", "0.568457", "0.5682686", "0.5677275", "0.5674604", "0.5669968", "0.5668395", "0.566594", "0.56650054", "0.5660544", "0.56581753", "0.5642537", "0.5621995", "0.5621931", "0.56174237", "0.56155777", "0.56056327", "0.56055135", "0.56023985", "0.55959773", "0.55945635", "0.5592169", "0.5579938", "0.55785495", "0.55752665", "0.55560905", "0.55430746", "0.5537311", "0.5535689", "0.5530465", "0.55254525", "0.5521924", "0.55202794", "0.5519868", "0.55196726", "0.5517913", "0.5516033", "0.55151176", "0.550868", "0.54948205", "0.549414", "0.5493839", "0.5491112", "0.5488122", "0.5484555", "0.5483539", "0.54826736", "0.5480674", "0.5480143", "0.54663587", "0.54634655", "0.5461619", "0.545581", "0.54553735", "0.5455333", "0.545296", "0.54484236", "0.5447551", "0.54467" ]
0.6696502
3
UnmarshalJSON is custom Timestamp format unmarshaler
func (d *Timestamp) UnmarshalJSON(b []byte) error { ts, err := strconv.ParseInt(string(b), 10, 64) if err != nil { return err } d.Time = time.Unix(ts/1000, (ts%1000)*1000000) if err != nil { return fmt.Errorf("Cannot unmarshal Timestamp value: %v", err) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Timestamp) UnmarshalJSON(data []byte) (err error) {\n\tt.Time, err = time.Parse(`\"`+time.RFC3339+`\"`, string(data))\n\treturn\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 Timestamp) UnmarshalJSON(b []byte) (err error) {\n\ttsUnix, _ := strconv.ParseInt(string(b), 10, 0)\n\tt = Timestamp(time.Unix(tsUnix, 0))\n\treturn\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Timestamp(time.Unix(int64(ts), 0))\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Timestamp(time.Unix(int64(ts), 0))\n\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Timestamp(time.Unix(int64(ts), 0))\n\n\treturn nil\n}", "func (v *Timestamp) UnmarshalJSON(data []byte) error {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\tvar in interface{}\n\tif err := json.Unmarshal(data, &in); err != nil {\n\t\treturn err\n\t}\n\treturn v.Scan(in)\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tint64ts := int64(ts)\n\tif len(b) > 10 {\n\t\t//support for milisecond timestamps\n\t\tint64ts = int64(ts / 1000)\n\t}\n\t*t = Timestamp(time.Unix(int64ts, 0).UTC())\n\n\treturn nil\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 (t *timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = timestamp(time.Unix(int64(ts), 0))\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 (t *Timestamp) UnmarshalJSON(src []byte) error {\n\tsrc = bytes.Trim(src, \"\\\"\")\n\tts, err := strconv.ParseInt(string(src), 10, 64)\n\tif err == nil {\n\t\ttm := time.Unix(ts/1e3, ts%1e3*1e6).UTC()\n\t\t*t = Timestamp(tm)\n\t\treturn nil\n\t}\n\n\tlayout := fmt.Sprintf(`%s`, time.RFC3339)\n\ttm, err := time.Parse(layout, string(src))\n\tif err == nil {\n\t\t*t = Timestamp(tm)\n\t\treturn nil\n\t}\n\n\tlayout = `2006-01-02`\n\ttm, err = time.Parse(layout, string(src))\n\t*t = Timestamp(tm)\n\treturn err\n}", "func (t *Time) UnmarshalJSON(data []byte) error {}", "func (t *Timestamp) UnmarshalJSON(data []byte) error {\n\t// Ignore null, like in the main JSON package.\n\tif string(data) == \"null\" {\n\t\treturn nil\n\t}\n\n\tunix, err := strconv.ParseInt(string(data), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Timestamp(unix)\n\treturn nil\n}", "func (t *UnixTimestamp) UnmarshalJSON(data []byte) (err error) {\n\tseconds, err := strconv.Atoi(\n\t\tstrings.Trim(string(data), \"\\\\\\\"\"),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = UnixTimestamp(time.Unix(int64(seconds), 0))\n\n\treturn nil\n}", "func (ts *Timestamp) UnmarshalJSON(b []byte) error {\n\n\tif ekaenc.IsNullJSON(b) {\n\t\tif ts != nil {\n\t\t\t*ts = 0\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Length variants:\n\t// Date length variants: 10, 8\n\t// Clock length variants: 4, 5, 6, 8,\n\t// Quotes: 2,\n\t// Date time separator: 1.\n\t//\n\t// So, summary variants:\n\t// - 15 (8+4+2+1),\n\t// - 16 (8+5+2+1),\n\t// - 17 (8+6+2+1, 10+4+2+1),\n\t// - 18 (10+5+2+1),\n\t// - 19 (8+8+2+1, 10+6+2+1),\n\t// - 21 (10+8+2+1).\n\n\tswitch l := len(b); {\n\n\tcase !(l >= 15 && l <= 19) && l != 21:\n\t\treturn _ERR_NOT_ISO8601_TIMESTAMP\n\n\tcase b[0] != '\"' && b[l-1] != '\"':\n\t\treturn _ERR_BAD_JSON_TIMESTAMP_QUO\n\n\tdefault:\n\t\treturn ts.ParseFrom(b[1:l-1])\n\t}\n}", "func (ts *Timestamp) UnmarshalJSON(value []byte) error {\n\n\t// Handle the null constant.\n\tif string(value) == \"null\" {\n\t\treturn nil\n\t}\n\n\t// Parse the timestamp.\n\tt, err := time.Parse(ReferenceTime, string(value))\n\t*ts = Timestamp(t)\n\treturn err\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 (tt *TickerTime) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"2006-01-02T15:04:05.9\", string(data))\n\t*tt = TickerTime{&t}\n\treturn err\n}", "func (n *NullTimestamp) UnmarshalJSON(b []byte) error {\n\tn.Valid = false\n\tn.Timestamp = time.Time{}\n\tif bytes.Equal(b, jsonNull) {\n\t\treturn nil\n\t}\n\n\tif err := json.Unmarshal(b, &n.Timestamp); err != nil {\n\t\treturn err\n\t}\n\tn.Valid = true\n\treturn nil\n}", "func (tt *TimeWithSecond) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"\\\"2006-01-02T15:04:05\\\"\", string(data))\n\t*tt = TimeWithSecond{&t}\n\treturn err\n}", "func (t *JSONTime) UnmarshalJSON(data []byte) error { \r\n// Ignore null, like in the main JSON package. \r\n\tif string(data) == \"null\" { \r\n\t\treturn nil \r\n\t} \r\n\t// Fractional seconds are handled implicitly by Parse. \r\n\tvar err error \r\n\t(*t).Time, err = time.ParseInLocation(`\"`+YYYYMMDDHHMISS+`\"`, string(data), time.Local) \r\n\treturn err \r\n}", "func (d *DateTime) UnmarshalJSON(data []byte) (err error) {\n\treturn d.Time.UnmarshalJSON(data)\n}", "func (v *TimestampNano) UnmarshalJSON(data []byte) error {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\tvar in interface{}\n\tif err := json.Unmarshal(data, &in); err != nil {\n\t\treturn err\n\t}\n\treturn v.Scan(in)\n}", "func (tt *EventTime) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"\\\"2006-01-02T15:04:05.9Z\\\"\", string(data))\n\t*tt = EventTime{&t}\n\treturn err\n}", "func (nt *NullTime) UnmarshalJSON(b []byte) (err error) {\n\t// scan for null\n\tif bytes.Equal(b, []byte(\"null\")) {\n\t\treturn nt.Scan(nil)\n\t}\n\tvar t time.Time\n\tvar err2 error\n\tif err := json.Unmarshal(b, &t); err != nil {\n\t\t// Try for JS new Date().toJSON()\n\t\tif t, err2 = time.Parse(\"2006-01-02T15:04:05.000Z\", string(b)); err2 != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nt.Scan(t)\n}", "func (dt *DateTime) UnmarshalJSON(data []byte) error {\n\treturn dt.src.UnmarshalJSON(data)\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 (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 (t *JSONDateTime) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\ts = Stripchars(s, \"\\\"\")\n\t// x, err := time.Parse(\"2006-01-02\", s)\n\tif len(s) == 0 {\n\t\t*t = JSONDateTime(TIME0)\n\t\treturn nil\n\t}\n\tx, err := StringToDate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x.Before(earliestDate) {\n\t\tx = earliestDate\n\t}\n\t*t = JSONDateTime(x)\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 (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 (t *Time) UnmarshalJSON(data []byte) error {\n\tmillis, err := strconv.ParseInt(string(data), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Time(time.Unix(0, millis*int64(time.Millisecond)))\n\treturn nil\n}", "func (t *JSONDateTime) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\ts = Stripchars(s, \"\\\"\")\n\t// x, err := time.Parse(\"2006-01-02\", s)\n\tx, err := StringToDate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x.Before(earliestDate) {\n\t\tx = earliestDate\n\t}\n\t*t = JSONDateTime(x)\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(b []byte) (err error) {\n\ts := strings.Trim(string(b), \"\\\"\")\n\tif s == \"null\" {\n\t\tt.Time = time.Time{}\n\t\treturn\n\t}\n\tif strings.HasSuffix(s, \"Z\") {\n\t\ts = s[:len(s)-1]\n\t}\n\n\tt.Time, err = time.Parse(dateFormat, s)\n\treturn\n}", "func (tt *OpenDate) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"\\\"2006-01-02T15:04:05.9Z\\\"\", string(data))\n\t*tt = OpenDate{&t}\n\treturn err\n}", "func (t *timeOrDate) UnmarshalJSON(b []byte) error {\n\tif string(b) == \"null\" {\n\t\treturn nil\n\t}\n\n\tvar timeStr string\n\tif err := json.Unmarshal(b, &timeStr); err != nil {\n\t\treturn err\n\t}\n\n\t// Try parsing as an RFC3339 timestamp\n\tif tm, err := time.Parse(time.RFC3339, timeStr); err == nil {\n\t\t*t = timeOrDate(tm)\n\t\treturn nil\n\t}\n\n\t// Try parsing as a date\n\ttm, err := time.Parse(\"2006-01-02\", timeStr)\n\tif err == nil {\n\t\t*t = timeOrDate(tm)\n\t}\n\treturn err\n}", "func (t *Transaction) UnmarshalJSON(data []byte) error {\n\ttype TransactionData Transaction\n\twrapper := &struct {\n\t\tCreated string `json:\"created\"`\n\t\t*TransactionData\n\t}{\n\t\tTransactionData: (*TransactionData)(t),\n\t}\n\tif err := json.Unmarshal(data, &wrapper); err != nil {\n\t\treturn err\n\t}\n\tt1, err := time.Parse(time.RFC3339, wrapper.Created)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Created = t1.Unix()\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\treturn t.UnmarshalText(data)\n}", "func (t *iso8601Datetime) UnmarshalJSON(data []byte) error {\n\t// Ignore null, like in the main JSON package.\n\tif string(data) == \"null\" {\n\t\treturn nil\n\t}\n\t// Fractional seconds are handled implicitly by Parse.\n\tvar err error\n\tif t.Time, err = time.Parse(strconv.Quote(iso8601Layout), string(data)); err != nil {\n\t\treturn ErrInvalidISO8601\n\t}\n\treturn err\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 UnmarshalTimestamp(s *jsonplugin.UnmarshalState) *timestamppb.Timestamp {\n\tif s.ReadNil() {\n\t\treturn nil\n\t}\n\tt := s.ReadTime()\n\tif s.Err() != nil {\n\t\treturn nil\n\t}\n\treturn timestamppb.New(*t)\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tvar s int64\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"data should be number, got %s\", data)\n\t}\n\t*t = Time{time.Unix(s, 0)}\n\treturn nil\n}", "func (t *JSONTime) UnmarshalJSON(buf []byte) error {\n\ttt, err := time.Parse(\"2006-01-02 15:04\", strings.Trim(string(buf), `\"`))\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time = tt\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tif data == nil {\n\t\treturn nil\n\t}\n\tstr := string(data)\n\tif len(strings.Trim(str, \" \")) == 0 {\n\t\treturn nil\n\t}\n\tstr = strings.Trim(str, \" \\\"\")\n\ttime, err := time.Parse(\"02-01-2006\", str)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time = time\n\treturn nil\n}", "func (t *TimeNoTZ) UnmarshalJSON(date []byte) error {\n\tnt, err := time.Parse(TimeNoTZLayout, string(date))\n\t*t = TimeNoTZ(nt)\n\treturn err\n}", "func (t *JSONTime) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\ttm, err := time.Parse(\"2006-01-02 15:04:05\", s)\n\tt.Time = tm\n\treturn err\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 (t *Time) UnmarshalJSON(b []byte) error {\n\tval, err := time.Parse(`\"2006-01-02T15:04:05\"`, string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Time(val)\n\n\treturn nil\n}", "func (nt *NullTime) UnmarshalJSON(data []byte) error {\n\t// Fractional seconds are handled implicitly by Parse.\n\ttt, err := time.Parse(\"2006-01-02T15:04:05Z\", string(data))\n\tif err != nil {\n\t\t*nt = NullTime{Valid: false}\n\t} else {\n\t\t*nt = NullTime{Valid: true, Time: tt}\n\t}\n\n\treturn nil\n}", "func (t *JSONTime) UnmarshalJSON(b []byte) error {\n\n\ts := strings.Trim(string(b), \"`'\\\" \")\n\n\tvar timeVal = time.Time{}\n\tvar err error\n\tif s != \"\" && s != \"null\" {\n\t\ttimeVal, err = time.Parse(time.RFC3339Nano, s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t*t = JSONTime(timeVal)\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) (err error) {\n\n\tif string(data) == \"null\" {\n\t\tt.Time = time.Time{}\n\t\treturn\n\t}\n\n\tt.Time, err = time.Parse(`\"`+time.RFC3339+`\"`, string(data))\n\n\treturn\n}", "func (d *DateTime) UnmarshalJSON(data []byte) (err error) {\n\tvar str string\n\terr = json.Unmarshal(data, &str)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttime, err := time.Parse(time.RFC3339, str)\n\td.Time = &time\n\treturn err\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tval := string(data)\n\tif val == `\"\"` {\n\t\treturn nil\n\t}\n\tnow, err := time.ParseInLocation(`\"2006-01-02 15:04:05\"`, val, time.Local)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Time(now)\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) (err error) {\n\tif data[0] != []byte(`\"`)[0] || data[len(data)-1] != []byte(`\"`)[0] {\n\t\treturn errors.New(\"Not quoted\")\n\t}\n\t*t, err = ParseTime(string(data[1 : len(data)-1]))\n\treturn\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 *PointInTime) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker51(&r, v)\n\treturn r.Error()\n}", "func (nt *NullTime) UnmarshalJSON(bytes []byte) error {\n\tif string(bytes) == \"null\" {\n\t\tnt.Valid = false\n\t\treturn nil\n\t}\n\tnt.Valid = true\n\treturn json.Unmarshal(bytes, &nt.Time)\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tt.Present = true\n\n\tif bytes.Equal(data, null) {\n\t\treturn nil\n\t}\n\n\tif err := json.Unmarshal(data, &t.Value); err != nil {\n\t\treturn err\n\t}\n\n\tt.Valid = true\n\treturn nil\n}", "func (gt GitTime) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\t// Time stamps from Gitiles sometimes have a UTC offset (e.g., -7800), and\n\t// sometimes not, so we try both variants before failing.\n\tt, err := time.Parse(`Mon Jan 02 15:04:05 2006`, s)\n\tswitch err.(type) {\n\tcase *time.ParseError:\n\t\tt, err = time.Parse(`Mon Jan 02 15:04:05 2006 -0700`, s)\n\t}\n\tif err == nil {\n\t\tgt = GitTime(t)\n\t}\n\treturn err\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tvar ts time.Time\n\tif err := ts.UnmarshalJSON(data); err != nil {\n\t\treturn err\n\t}\n\n\tt.Time = ts\n\treturn nil\n}", "func (mdt *MediaDateTime) UnmarshalJSON(b []byte) (err error) {\n\tif b[0] == '\"' && b[len(b)-1] == '\"' {\n\t\tb = b[1 : len(b)-1]\n\t}\n\tif string(b) == \"0000-00-00 00:00:00\" {\n\t\tmdt.Time = time.Time{}\n\t\treturn nil\n\t}\n\tmdt.Time, err = time.Parse(dateTimeLayout, string(b))\n\treturn err\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 (t *Time) UnmarshalJSON(b []byte) error {\n\n\tif ekaenc.IsNullJSON(b) {\n\t\tif t != nil {\n\t\t\t*t = 0\n\t\t}\n\t\treturn nil\n\t}\n\n\tswitch l := len(b); {\n\n\tcase !(l >= 6 && l <= 8) && l != 10:\n\t\t// The length must be:\n\t\t// - 6: \"hhmm\",\n\t\t// - 7: \"hh:mm\",\n\t\t// - 8: \"hhmmss\"\n\t\t// - 10: \"hh:mm:ss\"\n\t\treturn _ERR_NOT_ISO8601_TIME\n\n\tcase b[0] != '\"' || b[l-1] != '\"':\n\t\t// Forgotten quotes? Incorrect JSON?\n\t\treturn _ERR_BAD_JSON_TIME_QUO\n\n\tdefault:\n\t\treturn t.ParseFrom(b[1:l-1])\n\t}\n}", "func (tt *Time) UnmarshalJSON(input []byte) error {\n\tloc, err := time.LoadLocation(\"Europe/Amsterdam\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t// don't parse on empty dates\n\tif string(input) == `\"\"` {\n\t\treturn nil\n\t}\n\tnewTime, err := time.ParseInLocation(`\"2006-01-02 15:04:05\"`, string(input), loc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttt.Time = newTime\n\treturn nil\n}", "func (t *JSONDate) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\ts = Stripchars(s, \"\\\"\")\n\tif len(s) == 0 {\n\t\t*t = JSONDate(TIME0)\n\t\treturn nil\n\t}\n\t// x, err := time.Parse(\"2006-01-02\", s)\n\tx, err := StringToDate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x.Before(earliestDate) {\n\t\tx = earliestDate\n\t}\n\t*t = JSONDate(x)\n\treturn nil\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 *Qtime) UnmarshalJSON(b []byte) (err error) {\n\tb = b[1 : len(b)-1]\n\tt.Time, err = time.Parse(ISO8601, string(b))\n\treturn err\n}", "func (nt *Time) UnmarshalJSON(data []byte) error {\n\tvar t time.Time\n\tif data != nil {\n\t\tif err := json.Unmarshal(data, &t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tnt.Time = t\n\treturn nil\n}", "func (t *epochTime) UnmarshalJSON(s []byte) (err error) {\n\tr := strings.Replace(string(s), `\"`, ``, -1)\n\tq, err := strconv.ParseInt(r, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\teT := time.Unix(q/1000, 0)\n\t// fmt.Printf(\"eT, %+v | %s\\n\", eT, string(eT.Format(time.RFC822)))\n\t*(*time.Time)(t) = eT\n\treturn\n}", "func (t *unix) UnmarshalJSON(data []byte) error {\n\t// Ignore null, like in the main JSON package.\n\ts := string(data)\n\tif s == \"null\" {\n\t\treturn nil\n\t}\n\n\tv, err := stringToInt64(s)\n\tif err != nil {\n\t\t// return this specific error to maintain existing tests.\n\t\t// TODO: consider refactoring tests to not assert against error string\n\t\treturn ErrInvalidTime\n\t}\n\n\tt.Time = time.Unix(v, 0).In(time.UTC)\n\n\treturn nil\n}", "func (t *UnixTime) UnmarshalJSON(raw []byte) error {\n\tvar n int64\n\tif err := json.Unmarshal(raw, &n); err == nil {\n\t\tunix := UnixTime(n)\n\t\tif err := unix.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = unix\n\t\treturn nil\n\t}\n\n\tvar stdtime time.Time\n\tif err := json.Unmarshal(raw, &stdtime); err == nil {\n\t\tunix := UnixTime(stdtime.Unix())\n\t\tif err := unix.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = unix\n\t\treturn nil\n\t}\n\n\treturn errors.Wrap(errors.ErrInput, \"invalid time format\")\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tstr := string(data)\n\tif str == \"null\" {\n\t\treturn nil\n\t}\n\ttime, err := time.Parse(RFC3339NanoFixed, strings.Trim(str, `\"`))\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time = time\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 (t *Unix) UnmarshalJSON(in []byte) (err error) {\n\tsecs, err := strconv.ParseInt(string(in), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Unix(time.Unix(secs, 0))\n\treturn nil\n}", "func (t *UnixTime) UnmarshalJSON(raw []byte) error {\n\tvar n int64\n\tif err := json.Unmarshal(raw, &n); err == nil {\n\t\tunix := UnixTime(n)\n\t\tif err := unix.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = unix\n\t\treturn nil\n\t}\n\n\tvar stdtime time.Time\n\tif err := json.Unmarshal(raw, &stdtime); err == nil {\n\t\tunix := UnixTime(stdtime.Unix())\n\t\tif err := unix.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = unix\n\t\treturn nil\n\t}\n\n\treturn errors.Wrap(errors.ErrInvalidInput, \"invalid time format\")\n}", "func (t *Orderbook) UnmarshalJSON(data []byte) error {\n\tvar err error\n\ttype Alias Orderbook\n\taux := &struct {\n\t\tTimestamp string `json:\"timestamp\"`\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(t),\n\t}\n\tif err = json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (t *NumericDate) UnmarshalJSON(data []byte) error {\n\tvar value json.Number\n\tif err := json.Unmarshal(data, &value); err != nil {\n\t\treturn err\n\t}\n\tf, err := value.Float64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsec, dec := math.Modf(f)\n\tts := time.Unix(int64(sec), int64(dec*1e9))\n\t*t = NumericDate{ts}\n\treturn nil\n}", "func (j *JSONDate) UnmarshalJSON(b []byte) error {\n\ts := strings.Trim(string(b), \"\\\"\")\n\tif s == \"null\" {\n\t\treturn nil\n\t}\n\tt, err := time.Parse(\"2006-01-02\", s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*j = JSONDate(t)\n\treturn nil\n}", "func (v *ServerTime) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson25363b2dDecodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi53(&r, v)\n\treturn r.Error()\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tdecoded, err := NewTimeFromString(string(data[1 : len(data)-1]))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = decoded\n\treturn nil\n}", "func (p *Point) UnmarshalJSON(b []byte) error {\n\tvar normal struct {\n\t\tName string `json:\"name\"`\n\t\tTags map[string]string `json:\"tags\"`\n\t\tTimestamp time.Time `json:\"timestamp\"`\n\t\tPrecision string `json:\"precision\"`\n\t\tFields map[string]interface{} `json:\"fields\"`\n\t}\n\tvar epoch struct {\n\t\tName string `json:\"name\"`\n\t\tTags map[string]string `json:\"tags\"`\n\t\tTimestamp *int64 `json:\"timestamp\"`\n\t\tPrecision string `json:\"precision\"`\n\t\tFields map[string]interface{} `json:\"fields\"`\n\t}\n\n\tif err := func() error {\n\t\tvar err error\n\t\tdec := json.NewDecoder(bytes.NewBuffer(b))\n\t\tdec.UseNumber()\n\t\tif err = dec.Decode(&epoch); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Convert from epoch to time.Time, but only if Timestamp\n\t\t// was actually set.\n\t\tvar ts time.Time\n\t\tif epoch.Timestamp != nil {\n\t\t\tts, err = EpochToTime(*epoch.Timestamp, epoch.Precision)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tp.Name = epoch.Name\n\t\tp.Tags = epoch.Tags\n\t\tp.Timestamp = Timestamp(ts)\n\t\tp.Precision = epoch.Precision\n\t\tp.Fields = normalizeFields(epoch.Fields)\n\t\treturn nil\n\t}(); err == nil {\n\t\treturn nil\n\t}\n\n\tdec := json.NewDecoder(bytes.NewBuffer(b))\n\tdec.UseNumber()\n\tif err := dec.Decode(&normal); err != nil {\n\t\treturn err\n\t}\n\tnormal.Timestamp = SetPrecision(normal.Timestamp, normal.Precision)\n\tp.Name = normal.Name\n\tp.Tags = normal.Tags\n\tp.Timestamp = Timestamp(normal.Timestamp)\n\tp.Precision = normal.Precision\n\tp.Fields = normalizeFields(normal.Fields)\n\n\treturn nil\n}", "func (t *ISODate) UnmarshalJSON(data []byte) error {\n\tvar value interface{}\n\terr := json.Unmarshal(data, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch value.(type) {\n\tcase string:\n\t\tv := value.(string)\n\t\tfmt.Println(\"UnmarshalJSON TIMESTAMP\", v)\n\t\tif v == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\td, err := ParseTimestamp(v)\n\t\tfmt.Println(\"UnmarshalJSON ParseTimestamp\", d, d.UTC())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = d\n\tcase float64:\n\t\t*t = ISODate{time.Unix(0, int64(value.(float64))*int64(time.Millisecond)).UTC()}\n\tdefault:\n\t\treturn fmt.Errorf(\"Couldn't convert json from (%T) %s to a time.Time\", value, data)\n\t}\n\treturn nil\n}", "func (b *LegendTime) UnmarshalJSON(src []byte) (err error) {\n\tstr := string(src[1 : len(src)-1])\n\n\tif str == \"ul\" {\n\t\treturn\n\t}\n\n\tb.Time, err = time.Parse(\"2006-01-02T15:04:05\", str)\n\n\tif err != nil {\n\t\t// Try again with another time format\n\t\tb.Time, err = time.Parse(\"Mon Jan _2\", str)\n\t}\n\treturn\n}", "func (t *JSONDate) UnmarshalJSON(b []byte) error {\n\ts := string(b)\n\ts = Stripchars(s, \"\\\"\")\n\t// x, err := time.Parse(\"2006-01-02\", s)\n\tx, err := StringToDate(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x.Before(earliestDate) {\n\t\tx = earliestDate\n\t}\n\t*t = JSONDate(x)\n\treturn nil\n}", "func (td *Date) UnmarshalJSON(input []byte) error {\n\tloc, err := time.LoadLocation(\"Europe/Amsterdam\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t// don't parse on empty dates\n\tif string(input) == `\"\"` {\n\t\treturn nil\n\t}\n\tnewTime, err := time.ParseInLocation(`\"2006-01-02\"`, string(input), loc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttd.Time = newTime\n\treturn nil\n}", "func (t *CodeBuildTime) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\n\tts, err := time.Parse(codeBuildTimeFormat, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = CodeBuildTime(ts)\n\treturn nil\n}", "func (j *JsonReleaseDate) UnmarshalJSON(b []byte) error {\n\ts := strings.Trim(string(b), \"\\\"\")\n\tt, err := time.Parse(\"2006-01-02\", s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*j = JsonReleaseDate(t)\n\treturn nil\n}", "func (t *SessionTime) UnmarshalJSON(data []byte) error {\n\t// Fractional seconds are handled implicitly by Parse\n\tval, err := time.Parse(sessionFmt, string(data))\n\t*t = SessionTime(val)\n\treturn err\n}", "func (t *unixMilli) UnmarshalJSON(data []byte) error {\n\t// Ignore null, like in the main JSON package.\n\ts := string(data)\n\tif s == \"null\" {\n\t\treturn nil\n\t}\n\n\tv, err := stringToInt64(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt.Time = time.Unix(v/1000, (v % 1000 * int64(time.Millisecond))).In(time.UTC)\n\n\treturn nil\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 (ts *Timestamp) unmarshal(ad *netlink.AttributeDecoder) error {\n\n\t// A Timestamp will always have at least a start time\n\tif ad.Len() == 0 {\n\t\treturn errors.Wrap(errNeedSingleChild, opUnTimestamp)\n\t}\n\n\tfor ad.Next() {\n\t\tswitch timestampType(ad.Type()) {\n\t\tcase ctaTimestampStart:\n\t\t\tts.Start = time.Unix(0, int64(ad.Uint64()))\n\t\tcase ctaTimestampStop:\n\t\t\tts.Stop = time.Unix(0, int64(ad.Uint64()))\n\t\tdefault:\n\t\t\treturn fmt.Errorf(errAttributeChild, ad.Type())\n\t\t}\n\t}\n\n\treturn ad.Err()\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 (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 (d *Date) UnmarshalJSON(data []byte) (err error) {\n\td.Time, err = time.Parse(fullDateJSON, string(data))\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 (n *NullTime) UnmarshalJSON(b []byte) error {\n\tn.Valid = false\n\tn.Time = civil.Time{}\n\tif bytes.Equal(b, jsonNull) {\n\t\treturn nil\n\t}\n\n\ts, err := strconv.Unquote(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt, err := civil.ParseTime(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn.Time = t\n\n\tn.Valid = true\n\treturn nil\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 (nt *NullTime) UnmarshalJSON(data []byte) error {\n\tvar err error\n\n\tasString := string(data)\n\n\tlenStr := len([]rune(asString))\n\n\tif lenStr > 4 {\n\t\tasString, err = strconv.Unquote(string(data))\n\t\tif err != nil {\n\t\t\tnt.Valid = false\n\t\t\treturn fmt.Errorf(\"NullTime unmarshal error: invalid input %s\\n%v\", asString, err)\n\t\t}\n\t}\n\n\tif asString == \"null\" || asString == \"nil\" || asString == \"\" {\n\t\tnt.Valid = false\n\t} else {\n\n\t\t// lenStr := len([]rune(asString))\n\t\t// if lenStr == 10 {\n\t\t// \tnt.Time, err = time.Parse(\"2006-01-02\", asString)\n\t\t// } else {\n\t\t// \tnt.Time, err = time.Parse(\"2006-01-02T15:04:05\", asString)\n\t\t// }\n\n\t\tnt.Time, err = time.Parse(\"2006-01-02T15:04:05\", asString)\n\n\t\tif err != nil {\n\t\t\tnt.Valid = false\n\t\t\treturn fmt.Errorf(\"NullTime unmarshal error: invalid input %s\\n%v\", asString, err)\n\t\t}\n\t\tnt.Valid = true\n\t}\n\n\treturn 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}" ]
[ "0.77599716", "0.76214904", "0.76178885", "0.7563524", "0.7549915", "0.7549915", "0.7534542", "0.7486828", "0.74658304", "0.743619", "0.7401778", "0.73976845", "0.73660606", "0.73597485", "0.7257218", "0.7239708", "0.7195749", "0.7048042", "0.68625087", "0.684933", "0.6839843", "0.6821708", "0.676996", "0.6755834", "0.67464685", "0.6736895", "0.67287797", "0.66999006", "0.6689734", "0.6663752", "0.6661995", "0.6653726", "0.6624656", "0.661859", "0.6607752", "0.66033185", "0.65726227", "0.6560649", "0.6545964", "0.6536792", "0.6534428", "0.65330577", "0.65114737", "0.65063477", "0.6501011", "0.64969844", "0.6479684", "0.64701164", "0.64636064", "0.6439252", "0.6439044", "0.643395", "0.6430333", "0.64272815", "0.63917863", "0.63784707", "0.63602483", "0.6351676", "0.6348183", "0.6345783", "0.63405365", "0.6337589", "0.633717", "0.6337061", "0.63175845", "0.63167787", "0.62931347", "0.6269245", "0.6256097", "0.6253773", "0.6241278", "0.6236649", "0.6234831", "0.6233274", "0.62243015", "0.6223522", "0.6222743", "0.6219081", "0.62072116", "0.620502", "0.6202543", "0.619463", "0.6193104", "0.61831164", "0.61815584", "0.6180743", "0.61558294", "0.61552465", "0.6149464", "0.61182636", "0.61068726", "0.6103881", "0.60899717", "0.60654354", "0.6057219", "0.605365", "0.6018411", "0.60096896", "0.60037315", "0.5975971" ]
0.75225425
7
////////////////////////////////////////////////////////////////////////////////// // Validate validates parameters
func (p EmptyParameters) Validate() error { return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func validateParams() {\n\tif domain == \"\" {\n\t\tprintAndExit(\"-domain is required!\", true)\n\t}\n\n\tif passLength < 1 {\n\t\tprintAndExit(\"-password-length must be a positive number!\", true)\n\t}\n\n\tif passLength < 8 {\n\t\tfmt.Println(\"WARN: -password-length is too short. We will grant your wish, but this might be a security risk. Consider using longer password.\", false)\n\t}\n}", "func ValidateParam(param Param) error {\n if len(param.value) < 4096 {\n return ErrInvalidArgumentLength\n }\n // TODO: Format validation should be based on data type\n // Yes, it should be based on type switch\n //for _, paramRune := range param.value {\n // if !unicode.IsLetter(paramRune) {\n // return errors.New(ErrInvalidParamFormat)\n // }\n //}\n return nil\n}", "func Validate(params Params) (err error) {\n\tif params.Length <= 0 {\n\t\treturn errors.New(\"Length must be more than 0\")\n\t}\n\tif params.Square <= 0 {\n\t\treturn errors.New(\"Square must be more than 0\")\n\t}\n\treturn nil\n}", "func validateParams(method model.Method, params map[string]interface{}) (bool, error) {\n\tvar notSpecified []model.Parameter\n\tfor _, param := range method.Parameters {\n\t\tvalue := params[param.Name]\n\t\tif param.Required {\n\t\t\tif value != \"\" && value != nil{\n\t\t\t\tactualType := getTypeName(value)\n\t\t\t\tif actualType != param.Type {\n\t\t\t\t\tmsg := fmt.Sprintf(\"Wrong argument '%s' for method '%s'. Expected type '%s', but found '%s'\", param.Name, method.Name, param.Type, actualType)\n\t\t\t\t\tlog.Printf(\"[ERROR] \" + msg)\n\t\t\t\t\treturn false, errors.New(msg)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnotSpecified = append(notSpecified, param)\n\t\t\t}\n\t\t} else {\n\t\t\tif value != \"\" && value != nil {\n\t\t\t\t// optional parameters check\n\t\t\t\tactualType := getTypeName(value)\n\t\t\t\tif actualType != param.Type {\n\t\t\t\t\tmsg := fmt.Sprintf(\"Wrong argument '%s' for method '%s'. Expected type '%s', but found '%s'\", param.Name, method.Name, param.Type, actualType)\n\t\t\t\t\tlog.Printf(\"[ERROR] \" + msg)\n\t\t\t\t\treturn false, errors.New(msg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(notSpecified) != 0 {\n\t\tvar paramStr string = \"\"\n\t\tfor _, param := range notSpecified {\n\t\t\tparamStr += fmt.Sprintf(\"'%s', \", param.Name)\n\t\t}\n\t\tmsg := fmt.Sprintf(\"Required parameters are not provided for '%s' method. Please specify: %s\", method.Name, paramStr[:len(paramStr) - 2])\n\t\tlog.Printf(\"[ERROR] \" + msg)\n\t\treturn false, errors.New(msg)\n\t}\n\treturn true, nil\n}", "func (params Params) Validate() error {\n\tif err := ValidateNicknameParams(params.Nickname); err != nil {\n\t\treturn err\n\t}\n\n\tif err := ValidateDTagParams(params.DTag); err != nil {\n\t\treturn err\n\t}\n\n\tif err := ValidateBioParams(params.Bio); err != nil {\n\t\treturn err\n\t}\n\n\treturn ValidateOracleParams(params.Oracle)\n}", "func isValidParam(data Data) (result bool, err error) {\n\t// check length of param From\n\tif len(data.From) > 3 || len(data.From) < 3 {\n\t\tresult = false\n\t\terr = ErrInvalidParamFrom\n\t\treturn\n\t}\n\n\t// check length of param To\n\tif len(data.To) > 3 || len(data.To) < 3 {\n\t\tresult = false\n\t\terr = ErrInvalidParamTo\n\t\treturn\n\t}\n\n\tresult = true\n\treturn\n}", "func (p *Params) validateRequiredParameters() error {\n\tif p.Input == nil {\n\t\treturn errors.New(\"Input must not be nil\")\n\t}\n\tif p.Output == nil {\n\t\treturn errors.New(\"Output must not be nil\")\n\t}\n\treturn nil\n}", "func validateParams(params map[string][]string) error {\n\tfor param, values := range params {\n\t\tswitch param {\n\t\tcase timeRangeQS:\n\t\t\tvalue := values[len(values)-1]\n\t\t\tif !validTimeRange(value) {\n\t\t\t\treturn errors.New(\"invalid time_range query string param\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func validateParameters(task Task, parameters map[string]string) error {\n\tvalidParams := make(map[string]bool)\n\tvar missingParams []string\n\tfor _, reqParam := range task.RequiredParameters() {\n\t\tif _, ok := parameters[reqParam]; ok {\n\t\t\tvalidParams[reqParam] = true\n\t\t} else {\n\t\t\tmissingParams = append(missingParams, reqParam)\n\t\t}\n\t}\n\tif len(missingParams) > 0 {\n\t\treturn fmt.Errorf(\"required parameters are missing: %v\", missingParams)\n\t}\n\tfor _, optParam := range task.OptionalParameters() {\n\t\tvalidParams[optParam] = true\n\t}\n\tfor param := range parameters {\n\t\tif !validParams[param] {\n\t\t\treturn fmt.Errorf(\"parameter %v is not allowed. Allowed required parameters: %v optional parameters: %v\",\n\t\t\t\tparam, task.RequiredParameters(), task.OptionalParameters())\n\t\t}\n\t}\n\treturn nil\n}", "func ValidateParameters(r *Request) {\n\tif r.ParamsFilled() {\n\t\tv := validator{errors: []string{}}\n\t\tv.validateAny(reflect.ValueOf(r.Params), \"\")\n\n\t\tif count := len(v.errors); count > 0 {\n\t\t\tformat := \"%d validation errors:\\n- %s\"\n\t\t\tmsg := fmt.Sprintf(format, count, strings.Join(v.errors, \"\\n- \"))\n\t\t\tr.Error = apierr.New(\"InvalidParameter\", msg, nil)\n\t\t}\n\t}\n}", "func (m *MongoStore) validateParams(args ...interface{}) bool {\n\tfor _, v := range args {\n\t\tval, ok := v.(string)\n\t\tif ok {\n\t\t\tif val == \"\" {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\tif v == nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "func (p Params) Validate() error {\n\tif err := validateActiveParam(p.Active); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateDelegatorParams(p.DelegatorDistributionSchedules); err != nil {\n\t\treturn err\n\t}\n\n\treturn validateLPParams(p.LiquidityProviderSchedules)\n}", "func (p Params) Validate() error {\n\tif err := validateActiveParam(p.Active); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateDelegatorParams(p.DelegatorDistributionSchedules); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateLPParams(p.LiquidityProviderSchedules); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateMoneyMarketParams(p.MoneyMarkets); err != nil {\n\t\treturn err\n\t}\n\n\treturn validateCheckLtvIndexCount(p.CheckLtvIndexCount)\n}", "func (p Params) Validate() error {\n\tif err := validateTokenCourse(p.TokenCourse); err != nil {\n\t\treturn err\n\t}\n\tif err := validateSubscriptionPrice(p.SubscriptionPrice); err != nil {\n\t\treturn err\n\t}\n\tif err := validateVPNGBPrice(p.VPNGBPrice); err != nil {\n\t\treturn err\n\t}\n\tif err := validateStorageGBPrice(p.StorageGBPrice); err != nil {\n\t\treturn err\n\t}\n\tif err := validateBaseVPNGb(p.BaseVPNGb); err != nil {\n\t\treturn err\n\t}\n\tif err := validateBaseStorageGb(p.BaseStorageGb); err != nil {\n\t\treturn err\n\t}\n\tif err := validateCourseChangeSigners(p.CourseChangeSigners); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *Parameter) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateParamDef(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 ValidateParams(paramSpec []GeneratorParam, params map[string]interface{}) error {\n\tallErrs := []error{}\n\tfor ix := range paramSpec {\n\t\tif paramSpec[ix].Required {\n\t\t\tvalue, found := params[paramSpec[ix].Name]\n\t\t\tif !found || IsZero(value) {\n\t\t\t\tallErrs = append(allErrs, fmt.Errorf(\"Parameter: %s is required\", paramSpec[ix].Name))\n\t\t\t}\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(allErrs)\n}", "func (params Params) Validate() error {\n\tif params.NoteID == \"\" {\n\t\treturn errEmptyNoteID\n\t}\n\n\treturn params.Params.Validate()\n}", "func (params Params) Validate() error {\n\tif params.BasePool.IsNegative() {\n\t\treturn fmt.Errorf(\"base pool should be positive or zero, is %s\", params.BasePool)\n\t}\n\tif params.PoolRecoveryPeriod <= 0 {\n\t\treturn fmt.Errorf(\"pool recovery period should be positive, is %d\", params.PoolRecoveryPeriod)\n\t}\n\tif params.MinStabilitySpread.IsNegative() || params.MinStabilitySpread.GT(sdk.OneDec()) {\n\t\treturn fmt.Errorf(\"market minimum stability spead should be a value between [0,1], is %s\", params.MinStabilitySpread)\n\t}\n\n\treturn nil\n}", "func (param TOParameter) Validate() error {\n\t// Test\n\t// - Secure Flag is always set to either 1/0\n\t// - Admin rights only\n\t// - Do not allow duplicate parameters by name+config_file+value\n\terrs := validation.Errors{\n\t\tNameQueryParam: validation.Validate(param.Name, validation.Required),\n\t\tConfigFileQueryParam: validation.Validate(param.ConfigFile, validation.Required),\n\t\tValueQueryParam: validation.Validate(param.Value, validation.Required),\n\t}\n\n\treturn util.JoinErrs(tovalidate.ToErrors(errs))\n}", "func validateServiceParameters(parameters []*Service_Parameter, data *types.Struct) error {\n\tvar errs xerrors.Errors\n\n\tfor _, p := range parameters {\n\t\tvar value *types.Value\n\t\tif data != nil && data.Fields != nil {\n\t\t\tvalue = data.Fields[p.Key]\n\t\t}\n\t\tif err := p.Validate(value); err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\treturn errs.ErrorOrNil()\n}", "func (m *EventChannelParameters) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBatch(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSMTPSecurity(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 (p *Params) Validate() (valid bool, warnings []string) {\n\treturn len(warnings) == 0, warnings\n}", "func (s *SelectSampleSearch) ValidateParameters() {\n\ts.common.ValidateParameters()\n\tif len(s.mutInfoFile) == 0 {\n\t\tlog.Panic(\"Mutual information file missing\")\n\t}\n\ts.mutInfo = scr.ReadMutInf(s.mutInfoFile)\n}", "func (m *ParameterDefinition) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateGenerator(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\t// prop\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 ValidateParams(k, m uint8) (*Params, error) {\n\tif k < 1 {\n\t\treturn nil, errors.New(\"k cannot be zero\")\n\t}\n\n\tif m < 1 {\n\t\treturn nil, errors.New(\"m cannot be zero\")\n\t}\n\n\tif k+m > 255 {\n\t\treturn nil, errors.New(\"(k + m) cannot be bigger than Galois field GF(2^8) - 1\")\n\t}\n\n\treturn &Params{\n\t\tK: k,\n\t\tM: m,\n\t}, nil\n}", "func (m *WasmParams) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (p Params) Validate() error {\n\tif err := validateCreateWhoisPrice(p.CreateWhoisPrice); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateUpdateWhoisPrice(p.UpdateWhoisPrice); err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateDeleteWhoisPrice(p.DeleteWhoisPrice); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func validateTriggerParameter(parameter *v1alpha1.TriggerParameter) error {\n\tif parameter.Src == nil {\n\t\treturn errors.Errorf(\"parameter source can't be empty\")\n\t}\n\tif parameter.Src.DependencyName == \"\" {\n\t\treturn errors.Errorf(\"parameter dependency name can't be empty\")\n\t}\n\tif parameter.Dest == \"\" {\n\t\treturn errors.Errorf(\"parameter destination can't be empty\")\n\t}\n\n\tswitch op := parameter.Operation; op {\n\tcase v1alpha1.TriggerParameterOpAppend:\n\tcase v1alpha1.TriggerParameterOpOverwrite:\n\tcase v1alpha1.TriggerParameterOpPrepend:\n\tcase v1alpha1.TriggerParameterOpNone:\n\tdefault:\n\t\treturn errors.Errorf(\"parameter operation %+v is invalid\", op)\n\t}\n\n\treturn nil\n}", "func checkSetParameter(param interface{}) bool {\n\tswitch param.(type) {\n\tcase string:\n\t\tif param.(string) == \"\" {\n\t\t\treturn false\n\t\t}\n\tcase int:\n\t\tif param.(int) == 0 {\n\t\t\treturn false\n\t\t}\n\tcase uint:\n\t\tif param.(uint) == 0 {\n\t\t\treturn false\n\t\t}\n\tcase float64:\n\t\tif param.(float64) == 0 {\n\t\t\treturn false\n\t\t}\n\tcase []Namespace:\n\t\tif param.([]Namespace) == nil {\n\t\t\treturn false\n\t\t}\n\tdefault:\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *Options) validate(args []string) error {\n\tif len(args) != 0 {\n\t\treturn errors.New(\"arguments are not supported\")\n\t}\n\treturn nil\n}", "func (_WyvernExchange *WyvernExchangeCaller) ValidateOrderParameters(opts *bind.CallOpts, addrs [7]common.Address, uints [9]*big.Int, feeMethod uint8, side uint8, saleKind uint8, howToCall uint8, calldata []byte, replacementPattern []byte, staticExtradata []byte) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _WyvernExchange.contract.Call(opts, out, \"validateOrderParameters_\", addrs, uints, feeMethod, side, saleKind, howToCall, calldata, replacementPattern, staticExtradata)\n\treturn *ret0, err\n}", "func validateQueryParameter(field *surface_v1.Field) {\n\t_, isScalar := protoBufScalarTypes[field.NativeType]\n\tif !(field.Kind == surface_v1.FieldKind_SCALAR ||\n\t\t(field.Kind == surface_v1.FieldKind_ARRAY && isScalar) ||\n\t\t(field.Kind == surface_v1.FieldKind_REFERENCE)) {\n\t\tlog.Println(\"The query parameter with the Name \" + field.Name + \" is invalid. \" +\n\t\t\t\"Note that fields which are mapped to URL query parameters must have a primitive type or\" +\n\t\t\t\" a repeated primitive type or a non-repeated message type. \" +\n\t\t\t\"See: https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L118 for more information.\")\n\t}\n\n}", "func ValidateOracleParams(i interface{}) error {\n\tparams, isOracleParams := i.(OracleParams)\n\tif !isOracleParams {\n\t\treturn fmt.Errorf(\"invalid parameters type: %s\", i)\n\t}\n\n\tif params.AskCount < params.MinCount {\n\t\treturn fmt.Errorf(\"invalid ask count: %d, min count: %d\", params.AskCount, params.MinCount)\n\t}\n\n\tif params.MinCount <= 0 {\n\t\treturn fmt.Errorf(\"invalid min count: %d\", params.MinCount)\n\t}\n\n\tif params.PrepareGas <= 0 {\n\t\treturn fmt.Errorf(\"invalid prepare gas: %d\", params.PrepareGas)\n\t}\n\n\tif params.ExecuteGas <= 0 {\n\t\treturn fmt.Errorf(\"invalid execute gas: %d\", params.ExecuteGas)\n\t}\n\n\terr := params.FeeAmount.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (a *Arguments) Validate() error {\n\tif a.Person == nil && a.Employee == nil {\n\t\treturn server.EmptyArgumentsHTTPError\n\t}\n\n\tif a.Person != nil && a.Employee.PersonID != nil {\n\t\treturn server.NewHTTPError(http.StatusBadRequest, \"person_id and person can not be specified together\")\n\t}\n\n\tif a.Person != nil {\n\t\tif err := a.Person.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif a.Employee != nil {\n\t\tif err := a.Employee.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (p *Params) Check() error {\n\t// Validate Memory\n\tif p.Memory < minMemoryValue {\n\t\treturn ErrInvalidParams\n\t}\n\n\t// Validate Iterations\n\tif p.Iterations < 1 {\n\t\treturn ErrInvalidParams\n\t}\n\n\t// Validate Parallelism\n\tif p.Parallelism < 1 {\n\t\treturn ErrInvalidParams\n\t}\n\n\t// Validate salt length\n\tif p.SaltLength < minSaltLength {\n\t\treturn ErrInvalidParams\n\t}\n\n\t// Validate key length\n\tif p.KeyLength < minKeyLength {\n\t\treturn ErrInvalidParams\n\t}\n\n\treturn nil\n}", "func (a *PersonArguments) Validate() error {\n\treturn nil\n}", "func (a *WorkArguments) Validate() error {\n\tif a.DepartmentName == \"\" || a.AppointmentName == \"\" {\n\t\treturn server.EmptyArgumentsHTTPError\n\t}\n\n\treturn nil\n}", "func (v *requiredArgValidator) Validate(val interface{}) error {\n\tswitch tv := val.(type) {\n\t// don't care\n\tcase bool:\n\t\treturn nil\n\tcase *bool:\n\t\treturn nil\n\n\t// number cannot be zero\n\tcase int, float64:\n\t\tif tv != 0 {\n\t\t\treturn nil\n\t\t}\n\tcase *int:\n\t\tif *tv != 0 {\n\t\t\treturn nil\n\t\t}\n\tcase *float64:\n\t\tif *tv != 0 {\n\t\t\treturn nil\n\t\t}\n\n\t// string cannot be empty\n\tcase string:\n\t\tif tv != \"\" {\n\t\t\treturn nil\n\t\t}\n\tcase *string:\n\t\tif *tv != \"\" {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn errors.New(\"val is required\")\n}", "func (p *Service_Parameter) Validate(value *types.Value) error {\n\t_, isNull := value.GetKind().(*types.Value_NullValue)\n\tif value == nil || isNull {\n\t\tif p.Optional {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"value of %q is required\", p.Key)\n\t}\n\n\tif p.Repeated {\n\t\tarray := value.GetListValue()\n\t\tif array == nil {\n\t\t\treturn fmt.Errorf(\"value of %q is not an array\", p.Key)\n\t\t}\n\n\t\tfor _, value := range array.Values {\n\t\t\tif err := p.validateType(value); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn p.validateType(value)\n}", "func parseAndCheckParameters(params ...Parameter) (*parameters, error) {\n\tparameters := parameters{\n\t\tlogLevel: zerolog.GlobalLevel(),\n\t}\n\tfor _, p := range params {\n\t\tif params != nil {\n\t\t\tp.apply(&parameters)\n\t\t}\n\t}\n\n\tif parameters.monitor == nil {\n\t\t// Use no-op monitor.\n\t\tparameters.monitor = &noopMonitor{}\n\t}\n\tif parameters.signer == nil {\n\t\treturn nil, errors.New(\"no signer specified\")\n\t}\n\tif parameters.lister == nil {\n\t\treturn nil, errors.New(\"no lister specified\")\n\t}\n\tif parameters.process == nil {\n\t\treturn nil, errors.New(\"no process specified\")\n\t}\n\tif parameters.walletManager == nil {\n\t\treturn nil, errors.New(\"no wallet manager specified\")\n\t}\n\tif parameters.accountManager == nil {\n\t\treturn nil, errors.New(\"no account manager specified\")\n\t}\n\tif parameters.peers == nil {\n\t\treturn nil, errors.New(\"no peers specified\")\n\t}\n\tif parameters.name == \"\" {\n\t\treturn nil, errors.New(\"no name specified\")\n\t}\n\tif parameters.id == 0 {\n\t\treturn nil, errors.New(\"no ID specified\")\n\t}\n\tif parameters.listenAddress == \"\" {\n\t\treturn nil, errors.New(\"no listen address specified\")\n\t}\n\tif len(parameters.serverCert) == 0 {\n\t\treturn nil, errors.New(\"no server certificate specified\")\n\t}\n\tif len(parameters.serverKey) == 0 {\n\t\treturn nil, errors.New(\"no server key specified\")\n\t}\n\n\treturn &parameters, nil\n}", "func TestValidParams(t *testing.T) {\n\tvalidator, err := openrtb_ext.NewBidderParamsValidator(\"../../static/bidder-params\")\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to fetch the json-schemas. %v\", err)\n\t}\n\n\tfor _, validParam := range validParams {\n\t\tif err := validator.Validate(openrtb_ext.BidderSmartAdserver, json.RawMessage(validParam)); err != nil {\n\t\t\tt.Errorf(\"Schema rejected smartadserver params: %s \\n Error: %s\", validParam, err)\n\t\t}\n\t}\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 (_WyvernExchange *WyvernExchangeSession) ValidateOrderParameters(addrs [7]common.Address, uints [9]*big.Int, feeMethod uint8, side uint8, saleKind uint8, howToCall uint8, calldata []byte, replacementPattern []byte, staticExtradata []byte) (bool, error) {\n\treturn _WyvernExchange.Contract.ValidateOrderParameters(&_WyvernExchange.CallOpts, addrs, uints, feeMethod, side, saleKind, howToCall, calldata, replacementPattern, staticExtradata)\n}", "func (c MethodParams) ValidateParams(params url.Values) error {\n\tfor _, p := range c {\n\t\tif err := p.ValidateValue(params.Get(p.Name)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *ParameterDeleteOptions) Validate(args []string) error {\n\tif err := validateParameterName(args); err != nil {\n\t\treturn err\n\t}\n\to.Name = args[0]\n\treturn nil\n}", "func (ts *CPUCmd) ValidateParameters(ctx xcontext.Context, params test.TestStepParameters) error {\n\tctx.Debugf(\"Params %+v\", params)\n\treturn ts.validateAndPopulate(params)\n}", "func (m *MaxofRanparameters) Validate() error {\n\treturn m.validate(false)\n}", "func (m *OpenStackInstanceGroupV4Parameters) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (p Params) Validate() error {\n\tif err := validateSpotMarketInstantListingFee(p.SpotMarketInstantListingFee); err != nil {\n\t\treturn err\n\t}\n\tif err := validateDerivativeMarketInstantListingFee(p.DerivativeMarketInstantListingFee); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateMakerFee(p.DefaultSpotMakerFeeRate); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateFee(p.DefaultSpotTakerFeeRate); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateFee(p.DefaultDerivativeMakerFeeRate); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateFee(p.DefaultDerivativeTakerFeeRate); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateMarginRatio(p.DefaultInitialMarginRatio); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateMarginRatio(p.DefaultMaintenanceMarginRatio); err != nil {\n\t\treturn err\n\t}\n\tif err := validateFundingInterval(p.DefaultFundingInterval); err != nil {\n\t\treturn err\n\t}\n\tif err := validateFundingMultiple(p.FundingMultiple); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateFee(p.RelayerFeeShareRate); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateFee(p.DefaultHourlyFundingRateCap); err != nil {\n\t\treturn err\n\t}\n\tif err := ValidateFee(p.DefaultHourlyInterestRate); err != nil {\n\t\treturn err\n\t}\n\tif err := validateDerivativeOrderSideCount(p.MaxDerivativeOrderSideCount); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func validateAdditionalParameters(bucketName string, namespace string, spec nbv1.BucketClassSpec, isCLI bool) error {\n\tplacementPolicy := spec.PlacementPolicy\n\tif err := validations.ValidatePlacementPolicy(placementPolicy, namespace); err != nil {\n\t\treturn util.ValidationError{\n\t\t\tMsg: fmt.Sprintf(\"cosi bucket claim %q validation error: invalid placementPolicy %v, %v\", bucketName, placementPolicy, err),\n\t\t}\n\t}\n\n\tnamespacePolicy := spec.NamespacePolicy\n\tif err := validations.ValidateNamespacePolicy(namespacePolicy, namespace); err != nil {\n\t\treturn util.ValidationError{\n\t\t\tMsg: fmt.Sprintf(\"cosi bucket claim %q validation error: invalid namespacePolicy %v, %v\", bucketName, namespacePolicy, err),\n\t\t}\n\t}\n\n\treplicationPolicy := spec.ReplicationPolicy\n\tif err := validations.ValidateReplicationPolicy(bucketName, replicationPolicy, false, isCLI); err != nil {\n\t\treturn util.ValidationError{\n\t\t\tMsg: fmt.Sprintf(\"cosi bucket claim %q validation error: invalid replicationPolicy %v, %v\", bucketName, replicationPolicy, err),\n\t\t}\n\t}\n\n\tquota := spec.Quota\n\tif err := validations.ValidateQuotaConfig(bucketName, quota); err != nil {\n\t\treturn util.ValidationError{\n\t\t\tMsg: fmt.Sprintf(\"cosi bucket claim %q validation error: invalid quota %v, %v\", bucketName, quota, err),\n\t\t}\n\t}\n\treturn nil\n}", "func (_receiver_ *CreateDataPointRequest) Validate() *Error {\n\tif _receiver_.Name == nil {\n\t\treturn ErrBadRequestParametersMissing(\"Name is mandatory\")\n\t}\n\tif _receiver_.Time == nil {\n\t\treturn ErrBadRequestParametersMissing(\"Time is mandatory\")\n\t}\n\tif _receiver_.Value == nil {\n\t\treturn ErrBadRequestParametersMissing(\"Value is mandatory\")\n\t}\n\tif _receiver_.Request != nil {\n\t\tif typ, ok := interface{}(_receiver_.Request).(Validator); ok {\n\t\t\tif err := typ.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif _receiver_.Time != nil {\n\t\tif _time_, ok := interface{}(_receiver_.Time).(Validator); ok {\n\t\t\tif err := _time_.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (eo *AddEnvParameters) Validate() error {\n\treturn nil\n}", "func CheckParams(params Setting, passwordType string) bool {\n\n\tminLen := params.MinLength\n\tminSpecials := params.MinSpecialCharacters\n\tminDigits := params.MinDigits\n\tminLowers := params.MinLowercase\n\tminUppers := params.MinUppercase\n\n\tif minLen < AbsoluteMinLen ||\n\t\tminDigits < config[passwordType].MinDigits ||\n\t\tminLowers < config[passwordType].MinLowercase ||\n\t\tminUppers < config[passwordType].MinUppercase ||\n\t\tminSpecials < config[passwordType].MinSpecialCharacters {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (m *UnbindParameters) 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 (o *ParameterShowOptions) Validate(args []string) error {\n\tif err := validateParameterName(args); err != nil {\n\t\treturn err\n\t}\n\to.Name = args[0]\n\treturn o.ParseFormat()\n}", "func (_WyvernExchange *WyvernExchangeCallerSession) ValidateOrderParameters(addrs [7]common.Address, uints [9]*big.Int, feeMethod uint8, side uint8, saleKind uint8, howToCall uint8, calldata []byte, replacementPattern []byte, staticExtradata []byte) (bool, error) {\n\treturn _WyvernExchange.Contract.ValidateOrderParameters(&_WyvernExchange.CallOpts, addrs, uints, feeMethod, side, saleKind, howToCall, calldata, replacementPattern, staticExtradata)\n}", "func (pr *Params) Validate() error {\n\tnames := []string{}\n\tfor nm := range pr.Objects {\n\t\tnames = append(names, nm)\n\t}\n\treturn pr.Params.ValidateSheets(names)\n}", "func (checker *Checker) checkEventParameters(\n\tparameterList *ast.ParameterList,\n\tparameters []Parameter,\n) {\n\n\tparameterTypeValidationResults := map[*Member]bool{}\n\n\tfor i, parameter := range parameterList.Parameters {\n\t\tparameterType := parameters[i].TypeAnnotation.Type\n\n\t\tif !parameterType.IsInvalidType() &&\n\t\t\t!IsValidEventParameterType(parameterType, parameterTypeValidationResults) {\n\n\t\t\tchecker.report(\n\t\t\t\t&InvalidEventParameterTypeError{\n\t\t\t\t\tType: parameterType,\n\t\t\t\t\tRange: ast.NewRange(\n\t\t\t\t\t\tchecker.memoryGauge,\n\t\t\t\t\t\tparameter.StartPos,\n\t\t\t\t\t\tparameter.TypeAnnotation.EndPosition(checker.memoryGauge),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\t}\n}", "func (p Params) Validate() error {\n\tif len(p.SendEnabled) > 0 {\n\t\treturn errors.New(\"use of send_enabled in params is no longer supported\")\n\t}\n\treturn validateIsBool(p.DefaultSendEnabled)\n}", "func validateArguments(args ...string) error {\n\tif args == nil {\n\t\treturn errors.New(\"No command line args were specified\")\n\t}\n\tfor _, arg := range args {\n\t\tif arg == \"\" {\n\t\t\treturn errors.New(\"Unspecified required command line args\")\n\t\t}\n\t}\n\treturn nil\n}", "func (p *ProfileParameterByNamePost) Validate(tx *sql.Tx) []error {\n\treturn validateProfileParamPostFields(p.ConfigFile, p.Name, p.Value, p.Secure)\n}", "func (params UpdateParams) Validate() error {\n\tif params.Message == \"\" {\n\t\treturn errEmptyNoteMessage\n\t}\n\n\tif params.UserID == \"\" {\n\t\treturn errEmptyUserID\n\t}\n\n\tif params.Params.NoteID == \"\" {\n\t\treturn errEmptyNoteID\n\t}\n\n\treturn params.Params.Validate()\n}", "func (o *UIParameter) Validate() error {\n\n\terrors := elemental.Errors{}\n\trequiredErrors := elemental.Errors{}\n\n\tif err := elemental.ValidateRequiredString(\"key\", o.Key); err != nil {\n\t\trequiredErrors = requiredErrors.Append(err)\n\t}\n\n\tif err := elemental.ValidateRequiredString(\"type\", string(o.Type)); err != nil {\n\t\trequiredErrors = requiredErrors.Append(err)\n\t}\n\n\tif err := elemental.ValidateStringInList(\"type\", string(o.Type), []string{\"Boolean\", \"Checkbox\", \"CVSSThreshold\", \"DangerMessage\", \"Duration\", \"Enum\", \"Endpoint\", \"FileDrop\", \"Float\", \"FloatSlice\", \"InfoMessage\", \"Integer\", \"IntegerSlice\", \"JSON\", \"List\", \"Message\", \"Namespace\", \"Password\", \"String\", \"StringSlice\", \"Switch\", \"TagsExpression\", \"Title\", \"WarningMessage\"}, false); err != nil {\n\t\terrors = errors.Append(err)\n\t}\n\n\t// Custom object validation.\n\tif err := ValidateUIParameters(o); err != nil {\n\t\terrors = errors.Append(err)\n\t}\n\n\tif len(requiredErrors) > 0 {\n\t\treturn requiredErrors\n\t}\n\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\n\treturn nil\n}", "func (c *Config) ValidateParams() error {\n\tif c.GithubToken == \"\" {\n\t\treturn fmt.Errorf(\"Github token is required. Ensure providing it with the -githubToken=TOKEN flag\")\n\t}\n\tif c.GithubGistID == \"\" {\n\t\treturn fmt.Errorf(\"Github gist id is required. Ensure providing it with the -githubGistID=ID flag\")\n\t}\n\tif c.GithubGistFileName == \"\" {\n\t\treturn fmt.Errorf(\"Github gist file name is required. Ensure providing it with the -githubGistFileName=FILENAME flag\")\n\t}\n\treturn nil\n}", "func (v *PublicParamsManager) Validate() error {\n\tpp := v.PublicParams()\n\tif pp == nil {\n\t\treturn errors.New(\"public parameters not set\")\n\t}\n\treturn pp.Validate()\n}", "func (v *nullArgValidator) Validate(val interface{}) error {\n\t// Always pass\n\treturn nil\n}", "func (m *RanparameterName) Validate() error {\n\treturn m.validate(false)\n}", "func TestInvalidParams(t *testing.T) {\n\tvalidator, err := openrtb_ext.NewBidderParamsValidator(\"../../static/bidder-params\")\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to fetch the json-schemas. %v\", err)\n\t}\n\n\tfor _, invalidParam := range invalidParams {\n\t\tif err := validator.Validate(openrtb_ext.BidderSmartAdserver, json.RawMessage(invalidParam)); err == nil {\n\t\t\tt.Errorf(\"Schema allowed unexpected params: %s\", invalidParam)\n\t\t}\n\t}\n}", "func validatePathParameter(field *surface_v1.Field) {\n\tif field.Kind != surface_v1.FieldKind_SCALAR {\n\t\tlog.Println(\"The path parameter with the Name \" + field.Name + \" is invalid. \" +\n\t\t\t\"The path template may refer to one or more fields in the gRPC request message, as\" +\n\t\t\t\" long as each field is a non-repeated field with a primitive (non-message) type. \" +\n\t\t\t\"See: https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L62 for more information.\")\n\t}\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 (s Spec) Validate() error {\n\tif s.Name == \"\" {\n\t\treturn fmt.Errorf(\"invalid %s command spec: missing name\", s.Type())\n\t} else if err := s.Parameters.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func IsValidParameterPresent(vars map[string]string, sp []string) error {\n\n\tfor i := range sp {\n\t\tv := vars[sp[i]]\n\t\tif v == \"\" {\n\t\t\terrMessage := fmt.Sprintf(\"Missing %v in GET request\", sp[i])\n\t\t\treturn fmt.Errorf(errMessage)\n\t\t}\n\n\t}\n\treturn nil\n\n}", "func (o *ParameterEditOptions) Validate(args []string) error {\n\tif err := validateParameterName(args); err != nil {\n\t\treturn err\n\t}\n\to.Name = args[0]\n\treturn nil\n}", "func ParamValueValidate(pspec *ParamSpec, value *Value) bool {\n\tc_pspec := (*C.GParamSpec)(C.NULL)\n\tif pspec != nil {\n\t\tc_pspec = (*C.GParamSpec)(pspec.ToC())\n\t}\n\n\tc_value := (*C.GValue)(C.NULL)\n\tif value != nil {\n\t\tc_value = (*C.GValue)(value.ToC())\n\t}\n\n\tretC := C.g_param_value_validate(c_pspec, c_value)\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "func (parameter *Parameter) IsValid() *u.AppError {\n\n\tif len(parameter.Local) == 0 || len(parameter.Local) > localMaxSize {\n\t\treturn u.NewLocAppError(\"Parameter.IsValid\", \"model.parameter.is_valid.parameter_local.app_error\", nil, \"\")\n\t}\n\n\tif len(parameter.TimeZone) == 0 || len(parameter.TimeZone) > timeZoneMaxSize {\n\t\treturn u.NewLocAppError(\"Parameter.IsValid\", \"model.parameter.is_valid.parameter_timezone.app_error\", nil, \"\")\n\t}\n\n\tif parameter.SleepStart < 0 || parameter.SleepStart > maxTime {\n\t\treturn u.NewLocAppError(\"Parameter.IsValid\", \"model.parameter.is_valid.parameter_sleep_start.app_error\", nil, \"\")\n\t}\n\n\tif parameter.SleepEnd < 0 || parameter.SleepEnd > maxTime {\n\t\treturn u.NewLocAppError(\"Parameter.IsValid\", \"model.parameter.is_valid.parameter_sleep_end.app_error\", nil, \"\")\n\t}\n\n\treturn nil\n}", "func ValidateTimeParameters(params url.Values) error {\n\tnow := time.Now()\n\n\tissuedMS, err := strconv.ParseInt(params.Get(QueryIssued), 10, 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid issued timestamp: %w\", err)\n\t}\n\tissued := time.UnixMilli(issuedMS)\n\n\tif now.Add(DefaultLeeway).Before(issued) {\n\t\treturn ErrIssuedInTheFuture\n\t}\n\n\texpiryMS, err := strconv.ParseInt(params.Get(QueryExpiry), 10, 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid expiry timestamp: %w\", err)\n\t}\n\texpiry := time.UnixMilli(expiryMS)\n\n\tif now.Add(-DefaultLeeway).After(expiry) {\n\t\treturn ErrExpired\n\t}\n\n\treturn nil\n}", "func (ServiceConnectArgs) validate() error {\n\treturn nil\n}", "func ValidateAndRegisterParams(mapName string, params []provider.QueryParameter) error {\n\tif len(params) == 0 {\n\t\treturn nil\n\t}\n\n\tusedNames := make(map[string]struct{})\n\tusedTokens := make(map[string]struct{})\n\n\tfor _, param := range params {\n\t\tif _, ok := provider.ParamTypeDecoders[param.Type]; !ok {\n\t\t\treturn ErrParamUnknownType{\n\t\t\t\tMapName: string(mapName),\n\t\t\t\tParameter: param,\n\t\t\t}\n\t\t}\n\n\t\tif len(param.DefaultSQL) > 0 && len(param.DefaultValue) > 0 {\n\t\t\treturn ErrParamTwoDefaults{\n\t\t\t\tMapName: string(mapName),\n\t\t\t\tParameter: param,\n\t\t\t}\n\t\t}\n\n\t\tif len(param.DefaultValue) > 0 {\n\t\t\tdecoderFn := provider.ParamTypeDecoders[param.Type]\n\t\t\tif _, err := decoderFn(param.DefaultValue); err != nil {\n\t\t\t\treturn ErrParamInvalidDefault{\n\t\t\t\t\tMapName: string(mapName),\n\t\t\t\t\tParameter: param,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif _, ok := ReservedTokens[param.Token]; ok {\n\t\t\treturn ErrParamTokenReserved{\n\t\t\t\tMapName: string(mapName),\n\t\t\t\tParameter: param,\n\t\t\t}\n\t\t}\n\n\t\tif !provider.ParameterTokenRegexp.MatchString(param.Token) {\n\t\t\treturn ErrParamBadTokenName{\n\t\t\t\tMapName: string(mapName),\n\t\t\t\tParameter: param,\n\t\t\t}\n\t\t}\n\n\t\tif _, ok := usedNames[param.Name]; ok {\n\t\t\treturn ErrParamDuplicateName{\n\t\t\t\tMapName: string(mapName),\n\t\t\t\tParameter: param,\n\t\t\t}\n\t\t}\n\n\t\tif _, ok := usedTokens[param.Token]; ok {\n\t\t\treturn ErrParamDuplicateToken{\n\t\t\t\tMapName: string(mapName),\n\t\t\t\tParameter: param,\n\t\t\t}\n\t\t}\n\n\t\tusedNames[param.Name] = struct{}{}\n\t\tusedTokens[param.Token] = struct{}{}\n\t}\n\n\t// Mark all used tokens as reserved\n\tfor token := range usedTokens {\n\t\tReservedTokens[token] = struct{}{}\n\t}\n\n\treturn nil\n}", "func (r Describe) validation(cmd *cobra.Command, args []string) error {\n\tif err := require.MaxArgs(args, 3); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (p *Service_Parameter) validateType(value *types.Value) error {\n\tswitch p.Type {\n\tcase \"String\":\n\t\tif _, ok := value.GetKind().(*types.Value_StringValue); !ok {\n\t\t\treturn fmt.Errorf(\"value of %q is not a string\", p.Key)\n\t\t}\n\tcase \"Number\":\n\t\tif _, ok := value.GetKind().(*types.Value_NumberValue); !ok {\n\t\t\treturn fmt.Errorf(\"value of %q is not a number\", p.Key)\n\t\t}\n\tcase \"Boolean\":\n\t\tif _, ok := value.GetKind().(*types.Value_BoolValue); !ok {\n\t\t\treturn fmt.Errorf(\"value of %q is not a boolean\", p.Key)\n\t\t}\n\tcase \"Object\":\n\t\tobj, ok := value.GetKind().(*types.Value_StructValue)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"value of %q is not an object\", p.Key)\n\t\t}\n\t\treturn validateServiceParameters(p.Object, obj.StructValue)\n\tcase \"Any\":\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"value of %q has an invalid type \", p.Key)\n\t}\n\n\treturn nil\n}", "func (this validate) stringParam(\n\trawValue *model.Data,\n\tparam *model.StringParam,\n) (errs []error) {\n\terrs = []error{}\n\n\t// handle no value passed\n\tif nil == rawValue {\n\t\terrs = append(errs, errors.New(\"String required\"))\n\t\treturn\n\t}\n\n\tvalue := rawValue.String\n\tif \"\" == value && \"\" != param.Default {\n\t\t// apply default if value not set\n\t\tvalue = param.Default\n\t}\n\n\t// guard no constraints\n\tif paramConstraints := param.Constraints; nil != paramConstraints {\n\n\t\t// perform validations supported by gojsonschema\n\t\tconstraintsJsonBytes, err := format.NewJsonFormat().From(paramConstraints)\n\t\tif err != nil {\n\t\t\t// handle syntax errors specially\n\t\t\terrs = append(errs, fmt.Errorf(\"Error interpreting constraints; the op likely has a syntax error.\\n Details: %v\", err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tvalueJsonBytes, err := format.NewJsonFormat().From(value)\n\t\tif err != nil {\n\t\t\t// handle syntax errors specially\n\t\t\terrs = append(errs, fmt.Errorf(\"Error validating parameter.\\n Details: %v\", err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tresult, err := gojsonschema.Validate(\n\t\t\tgojsonschema.NewBytesLoader(constraintsJsonBytes),\n\t\t\tgojsonschema.NewBytesLoader(valueJsonBytes),\n\t\t)\n\t\tif err != nil {\n\t\t\t// handle syntax errors specially\n\t\t\terrs = append(errs, fmt.Errorf(\"Error interpreting constraints; the op likely has a syntax error.\\n Details: %v\", err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tfor _, errString := range result.Errors() {\n\t\t\t// enum validation errors include `(root) ` prefix we don't want\n\t\t\terrs = append(errs, errors.New(strings.TrimPrefix(errString.Description(), \"(root) \")))\n\t\t}\n\n\t}\n\n\treturn\n}", "func typeCheckParameter(obj interface{}, expected string, name string) error {\n\t// Make sure there is an object.\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\t// Check the type is as expected.\n\tif reflect.TypeOf(obj).String() != expected {\n\t\treturn fmt.Errorf(\"Expected %s to be of type %s but received %s.\", name, expected, reflect.TypeOf(obj).String())\n\t}\n\treturn nil\n}", "func typeCheckParameter(obj interface{}, expected string, name string) error {\n\t// Make sure there is an object.\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\t// Check the type is as expected.\n\tif reflect.TypeOf(obj).String() != expected {\n\t\treturn fmt.Errorf(\"Expected %s to be of type %s but received %s.\", name, expected, reflect.TypeOf(obj).String())\n\t}\n\treturn nil\n}", "func typeCheckParameter(obj interface{}, expected string, name string) error {\n\t// Make sure there is an object.\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\t// Check the type is as expected.\n\tif reflect.TypeOf(obj).String() != expected {\n\t\treturn fmt.Errorf(\"Expected %s to be of type %s but received %s.\", name, expected, reflect.TypeOf(obj).String())\n\t}\n\treturn nil\n}", "func typeCheckParameter(obj interface{}, expected string, name string) error {\n\t// Make sure there is an object.\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\t// Check the type is as expected.\n\tif reflect.TypeOf(obj).String() != expected {\n\t\treturn fmt.Errorf(\"Expected %s to be of type %s but received %s.\", name, expected, reflect.TypeOf(obj).String())\n\t}\n\treturn nil\n}", "func (c *modAccountRun) validate(args []string) error {\n\tif len(args) < 2 {\n\t\treturn errors.New(\"not enough arguments\")\n\t}\n\n\tif len(args) > 2 {\n\t\treturn errors.New(\"too many arguments\")\n\t}\n\n\treturn nil\n}", "func (m *PorositySimulationParameters) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBeamDiameter(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGeometryHeight(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGeometryLength(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGeometryWidth(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateHatchSpacingValues(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateHeaterTemperature(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLaserWattageValues(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLayerRotationAngle(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLayerThicknessValues(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMeshLayersPerLayer(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateScanSpeedValues(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSlicingStripeWidthValues(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStartingLayerAngle(formats); err != nil {\n\t\t// prop\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 typeCheckParameter(obj interface{}, expected string, name string) error {\n\t// Make sure there is an object.\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\t// Check the type is as expected.\n\tif reflect.TypeOf(obj).String() != expected {\n\t\treturn fmt.Errorf(\"expected %s to be of type %s but received %s\", name, expected, reflect.TypeOf(obj).String())\n\t}\n\treturn nil\n}", "func (a *AuditSrv) validateSearchParams(searchParms *globalUtils.AuditSearchParams) ([]string, error) {\n\tvar FailureDesc []string\n\tif searchParms.ObjectName == \"\" {\n\t\tFailureDesc = append(FailureDesc, glErr.MissingField(\"Object name\"))\n\t}\n\tif searchParms.ObjectId == \"\" {\n\t\tFailureDesc = append(FailureDesc, glErr.MissingField(\"Object id\"))\n\t}\n\tif searchParms.ActionTimeStart.IsZero() {\n\t\tFailureDesc = append(FailureDesc, glErr.MissingField(\"Action time Start\"))\n\t}\n\tif searchParms.ActionTimeEnd.IsZero() {\n\t\tFailureDesc = append(FailureDesc, glErr.MissingField(\"Action time End\"))\n\t}\n\tif searchParms.ActionTimeStart.After(searchParms.ActionTimeEnd) || searchParms.ActionTimeStart.Equal(searchParms.ActionTimeEnd) {\n\t\tFailureDesc = append(FailureDesc, glErr.DtInvalidValidityDates(searchParms.ActionTimeStart, searchParms.ActionTimeEnd))\n\t}\n\tif len(FailureDesc) > 0 {\n\t\treturn FailureDesc, &globalerrors.ValidationError{Source: \"validateSearchParams\", FailureDesc: FailureDesc}\n\t}\n\treturn FailureDesc, nil\n}", "func (m *RanparameterId) Validate() error {\n\treturn m.validate(false)\n}", "func ValidateVolumeParameters(volParam map[string]map[string]string) {\n\tvar err error\n\tfor vol, params := range volParam {\n\t\tif Inst().ConfigMap != \"\" {\n\t\t\tparams[authTokenParam], err = Inst().S.GetTokenFromConfigMap(Inst().ConfigMap)\n\t\t\texpect(err).NotTo(haveOccurred())\n\t\t}\n\t\tStep(fmt.Sprintf(\"get volume: %s inspected by the volume driver\", vol), func() {\n\t\t\terr = Inst().V.ValidateCreateVolume(vol, params)\n\t\t\texpect(err).NotTo(haveOccurred())\n\t\t})\n\t}\n}", "func validateArgs() {\n\tif *optionsEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *inputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *outputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n}", "func (p *Parameters) CheckParameters() {\n\terrorMsg := \"\"\n\thasError := false\n\tvar foundFile bool\n\n\tfoundFile = checkFile(p.GlobalFile)\n\thasError = foundFile && hasError\n\tif foundFile == false {\n\t\terrorMsg = fmt.Sprintf(\"Global file %s not found\\n\", p.GlobalFile)\n\t}\n\n\tfoundFile = checkFile(p.WFile)\n\thasError = foundFile && hasError\n\tif foundFile == true {\n\t\terrorMsg = fmt.Sprintf(\"%sWorld file %s not found\\n\", errorMsg, p.WFile)\n\t}\n\n\tfoundFile = checkFile(p.SFile)\n\thasError = foundFile && hasError\n\tif foundFile == true {\n\t\terrorMsg = fmt.Sprintf(\"%sSensor file %s not found\\n\", errorMsg, p.SFile)\n\t}\n\n\tfoundFile = checkFile(p.AFile)\n\thasError = foundFile && hasError\n\tif foundFile == true {\n\t\terrorMsg = fmt.Sprintf(\"%sActuator file %s not found\\n\", errorMsg, p.AFile)\n\t}\n\n\tif hasError == true {\n\t\tfmt.Println(errorMsg)\n\t\tos.Exit(-1)\n\t}\n}", "func validateEqualArgs(expected, actual interface{}) error {\n\tif expected == nil && actual == nil {\n\t\treturn nil\n\t}\n\n\t// NOTE: in iam policy expression, we guarantee the value will not be Function!\n\t// if isFunction(expected) || isFunction(actual) {\n\t// \treturn errors.New(\"cannot take func type as argument\")\n\t// }\n\treturn nil\n}", "func (m *PaymentServiceItemParam) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateKey(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrigin(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePaymentServiceItemID(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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (m *InputReportParameter) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateIdentifier(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateParamValue(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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (flags *Flags) Validate(args []string) error {\n\treturn nil\n}", "func (p *Params) ValidateRequiredProperties() (bool, []error, []string) {\n\n\terrors := []error{}\n\twarnings := []string{}\n\n\t// validate app params\n\tif p.App == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Application name is required; either define an app label or use app property on this stage\"))\n\t}\n\tif p.Namespace == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Namespace is required; either use credentials with a defaultNamespace or set it via namespace property on this stage\"))\n\t}\n\n\tif p.Action == \"rollback-canary\" {\n\t\t// the above properties are all you need for a rollback\n\t\treturn len(errors) == 0, errors, warnings\n\t}\n\n\t// validate container params\n\tif p.Container.ImageRepository == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Image repository is required; set it via container.repository property on this stage\"))\n\t}\n\tif p.Container.ImageName == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Image name is required; set it via container.name property on this stage\"))\n\t}\n\tif p.Container.ImageTag == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Image tag is required; set it via container.tag property on this stage\"))\n\t}\n\n\t// validate cpu params\n\tif p.Container.CPU.Request == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Cpu request is required; set it via container.cpu.request property on this stage\"))\n\t}\n\tif p.Container.CPU.Limit == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Cpu limit is required; set it via container.cpu.limit property on this stage\"))\n\t}\n\n\t// validate memory params\n\tif p.Container.Memory.Request == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Memory request is required; set it via container.memory.request property on this stage\"))\n\t}\n\tif p.Container.Memory.Limit == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Memory limit is required; set it via container.memory.limit property on this stage\"))\n\t}\n\n\t// defaults for rollingupdate\n\tif p.RollingUpdate.MaxSurge == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Rollingupdate max surge is required; set it via rollingupdate.maxsurge property on this stage\"))\n\t}\n\tif p.RollingUpdate.MaxUnavailable == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Rollingupdate max unavailable is required; set it via rollingupdate.maxunavailable property on this stage\"))\n\t}\n\n\tif p.Kind == \"job\" || p.Kind == \"cronjob\" {\n\t\tif p.Kind == \"cronjob\" {\n\t\t\tif p.Schedule == \"\" {\n\t\t\t\terrors = append(errors, fmt.Errorf(\"Schedule is required for a cronjob; set it via schedule property on this stage\"))\n\t\t\t}\n\n\t\t\tif p.ConcurrencyPolicy != \"Allow\" && p.ConcurrencyPolicy != \"Forbid\" && p.ConcurrencyPolicy != \"Replace\" {\n\t\t\t\terrors = append(errors, fmt.Errorf(\"ConcurrencyPolicy is invalid; allowed values are Allow, Forbid or Replace\"))\n\t\t\t}\n\t\t}\n\n\t\t// the above properties are all you need for a worker\n\t\treturn len(errors) == 0, errors, warnings\n\t}\n\n\t// validate params with respect to incoming requests\n\tif p.Visibility == \"\" || (p.Visibility != \"private\" && p.Visibility != \"public\" && p.Visibility != \"iap\" && p.Visibility != \"public-whitelist\") {\n\t\terrors = append(errors, fmt.Errorf(\"Visibility property is required; set it via visibility property on this stage; allowed values are private, iap, public-whitelist or public\"))\n\t}\n\tif p.Visibility == \"iap\" && p.IapOauthCredentialsClientID == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"With visibility 'iap' property iapOauthClientID is required; set it via iapOauthClientID property on this stage\"))\n\t}\n\tif p.Visibility == \"iap\" && p.IapOauthCredentialsClientSecret == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"With visibility 'iap' property iapOauthClientSecret is required; set it via iapOauthClientSecret property on this stage\"))\n\t}\n\n\tif len(p.Hosts) == 0 {\n\t\terrors = append(errors, fmt.Errorf(\"At least one host is required; set it via hosts array property on this stage\"))\n\t}\n\tfor _, host := range p.Hosts {\n\t\tif len(host) > 253 {\n\t\t\terrors = append(errors, fmt.Errorf(\"Host %v is longer than the allowed 253 characters, which is invalid for DNS; please shorten your host\", host))\n\t\t\tbreak\n\t\t}\n\n\t\tmatchesInvalidChars, _ := regexp.MatchString(\"[^a-zA-Z0-9-.]\", host)\n\t\tif matchesInvalidChars {\n\t\t\terrors = append(errors, fmt.Errorf(\"Host %v has invalid characters; only a-z, 0-9, - and . are allowed; please fix your host\", host))\n\t\t}\n\n\t\thostLabels := strings.Split(host, \".\")\n\t\tfor _, label := range hostLabels {\n\t\t\tif len(label) > 63 {\n\t\t\t\terrors = append(errors, fmt.Errorf(\"Host %v has label %v - the parts between dots - that is longer than the allowed 63 characters, which is invalid for DNS; please shorten your host label\", host, label))\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, host := range p.InternalHosts {\n\t\tif len(host) > 253 {\n\t\t\terrors = append(errors, fmt.Errorf(\"Internal host %v is longer than the allowed 253 characters, which is invalid for DNS; please shorten your host\", host))\n\t\t\tbreak\n\t\t}\n\n\t\tmatchesInvalidChars, _ := regexp.MatchString(\"[^a-zA-Z0-9-.]\", host)\n\t\tif matchesInvalidChars {\n\t\t\terrors = append(errors, fmt.Errorf(\"Internal host %v has invalid characters; only a-z, 0-9, - and . are allowed; please fix your host\", host))\n\t\t}\n\n\t\thostLabels := strings.Split(host, \".\")\n\t\tfor _, label := range hostLabels {\n\t\t\tif len(label) > 63 {\n\t\t\t\terrors = append(errors, fmt.Errorf(\"Internal host %v has label %v - the parts between dots - that is longer than the allowed 63 characters, which is invalid for DNS; please shorten your host label\", host, label))\n\t\t\t}\n\t\t}\n\t}\n\n\tif p.Basepath == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Basepath property is required; set it via basepath property on this stage\"))\n\t}\n\tif p.Container.Port <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Container port must be larger than zero; set it via container.port property on this stage\"))\n\t}\n\n\t// validate autoscale params\n\tif p.Autoscale.MinReplicas <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Autoscaling min replicas must be larger than zero; set it via autoscale.min property on this stage\"))\n\t}\n\tif p.Autoscale.MaxReplicas <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Autoscaling max replicas must be larger than zero; set it via autoscale.max property on this stage\"))\n\t}\n\tif p.Autoscale.CPUPercentage <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Autoscaling cpu percentage must be larger than zero; set it via autoscale.cpu property on this stage\"))\n\t}\n\n\t// validate liveness params\n\tif p.Container.LivenessProbe.Path == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Liveness path is required; set it via container.liveness.path property on this stage\"))\n\t}\n\tif p.Container.LivenessProbe.Port <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Liveness port must be larger than zero; set it via container.liveness.port property on this stage\"))\n\t}\n\tif p.Container.LivenessProbe.InitialDelaySeconds <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Liveness initial delay must be larger than zero; set it via container.liveness.delay property on this stage\"))\n\t}\n\tif p.Container.LivenessProbe.TimeoutSeconds <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Liveness timeout must be larger than zero; set it via container.liveness.timeout property on this stage\"))\n\t}\n\n\t// validate readiness params\n\tif p.Container.ReadinessProbe.Path == \"\" {\n\t\terrors = append(errors, fmt.Errorf(\"Readiness path is required; set it via container.readiness.path property on this stage\"))\n\t}\n\tif p.Container.ReadinessProbe.Port <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Readiness port must be larger than zero; set it via container.readiness.port property on this stage\"))\n\t}\n\tif p.Container.ReadinessProbe.TimeoutSeconds <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"Readiness timeout must be larger than zero; set it via container.readiness.timeout property on this stage\"))\n\t}\n\n\t// validate metrics params\n\tif p.Container.Metrics.Scrape == nil {\n\t\terrors = append(errors, fmt.Errorf(\"Metrics scrape is required; set it via container.metrics.scrape property on this stage; allowed values are true or false\"))\n\t}\n\tif p.Container.Metrics.Scrape != nil && *p.Container.Metrics.Scrape {\n\t\tif p.Container.Metrics.Path == \"\" {\n\t\t\terrors = append(errors, fmt.Errorf(\"Metrics path is required; set it via container.metrics.path property on this stage\"))\n\t\t}\n\t\tif p.Container.Metrics.Port <= 0 {\n\t\t\terrors = append(errors, fmt.Errorf(\"Metrics port must be larger than zero; set it via container.metrics.port property on this stage\"))\n\t\t}\n\t}\n\n\t// The \"sidecar\" field is deprecated, so it can be empty. But if it's specified, then we validate it.\n\tif p.Sidecar.Type != \"\" && p.Sidecar.Type != \"none\" {\n\t\terrors = p.validateSidecar(&p.Sidecar, errors)\n\t\twarnings = append(warnings, \"The sidecar field is deprecated, the sidecars list should be used instead.\")\n\t}\n\n\t// validate sidecars params\n\tfor _, sidecar := range p.Sidecars {\n\t\terrors = p.validateSidecar(sidecar, errors)\n\t}\n\n\treturn len(errors) == 0, errors, warnings\n}", "func (params *Params) Validate() error {\n\tvar merr = multierror.NewPrefixed(\"deployment resource\")\n\tif params.API == nil {\n\t\tmerr = merr.Append(apierror.ErrMissingAPI)\n\t}\n\n\tif len(params.DeploymentID) != 32 {\n\t\tmerr = merr.Append(deputil.NewInvalidDeploymentIDError(params.DeploymentID))\n\t}\n\n\tif params.Kind == \"\" {\n\t\tmerr = merr.Append(errors.New(\"resource kind cannot be empty\"))\n\t}\n\n\t// Ensures that RefID is either populated when the RefID isn't specified or\n\t// returns an error when it fails obtaining the ref ID.\n\tif err := params.fillDefaults(); err != nil {\n\t\tmerr = merr.Append(multierror.NewPrefixed(\n\t\t\t\"failed auto-discovering the resource ref id\", err,\n\t\t))\n\t}\n\n\treturn merr.ErrorOrNil()\n}", "func CheckParameters(r *rest.Request, needed_fields []string) (bool, map[string]string) {\n\tvar result map[string]string\n\tresult = make(map[string]string)\n\tfor _, field := range needed_fields {\n\t\tvalues, _ := r.URL.Query()[field]\n\t\tif len(values) < 1 {\n\t\t\treturn false, result\n\t\t}\n\t\tresult[field] = values[0]\n\t}\n\treturn true, result\n}" ]
[ "0.76747197", "0.76292884", "0.75551236", "0.7502768", "0.74260867", "0.74234974", "0.7338424", "0.7256845", "0.71697897", "0.71468896", "0.70932436", "0.708344", "0.7079252", "0.703499", "0.6956334", "0.6926156", "0.6903584", "0.6844796", "0.6821966", "0.68136436", "0.6708661", "0.6704323", "0.66968215", "0.66630477", "0.66550976", "0.66509724", "0.6618738", "0.6596437", "0.65629995", "0.65536594", "0.6521293", "0.64934176", "0.6482412", "0.64810085", "0.6460613", "0.6444911", "0.64197093", "0.6393285", "0.6390686", "0.63891804", "0.63863385", "0.63381344", "0.63381064", "0.63334197", "0.6317958", "0.6309409", "0.6303285", "0.6287008", "0.6283535", "0.62662727", "0.6262996", "0.6262466", "0.6258292", "0.6249174", "0.6245312", "0.62451804", "0.6242444", "0.6238452", "0.6236706", "0.6233265", "0.62209755", "0.6213094", "0.6210398", "0.6198957", "0.6197117", "0.61952823", "0.61892265", "0.6182706", "0.615617", "0.61434996", "0.6127188", "0.61195767", "0.61193806", "0.6117088", "0.6101523", "0.60964394", "0.6092094", "0.60768867", "0.6074591", "0.60699034", "0.6068979", "0.60663337", "0.60663337", "0.60663337", "0.60663337", "0.6063297", "0.6063068", "0.60625714", "0.60589373", "0.6054158", "0.60541195", "0.6048117", "0.6045474", "0.6041702", "0.6041314", "0.6039096", "0.6002175", "0.5997705", "0.59877443", "0.59799653" ]
0.70064795
14
////////////////////////////////////////////////////////////////////////////////// // ToQuery convert params to URL query
func (p EmptyParameters) ToQuery() string { return "" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func (opts DeleteOpts) ToDeleteQuery() (string, error) {\n\tq, err := golangsdk.BuildQueryString(opts)\n\treturn q.String(), err\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (opts ListOpts) ToListQuery() (string, error) {\n\tq, err := golangsdk.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), err\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (opts ListOpts) ToListOptsQuery() (string, error) {\n\tq, err := golangsdk.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), err\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (opts ListOpts) ToReceiverListQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\treturn q.String(), err\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\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 (cq *changesQuery) GetQuery() (url.Values, error) {\n\tvals := url.Values{}\n\tif cq.Conflicts {\n\t\tvals.Set(\"conflicts\", \"true\")\n\t}\n\tif cq.Descending {\n\t\tvals.Set(\"descending\", \"true\")\n\t}\n\tif len(cq.DocIDs) > 0 {\n\t\tdata, err := json.Marshal(cq.DocIDs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvals.Set(\"doc_ids\", string(data[:]))\n\t}\n\tif cq.IncludeDocs {\n\t\tvals.Set(\"include_docs\", \"true\")\n\t}\n\tif cq.Feed != \"\" {\n\t\tvals.Set(\"feed\", cq.Feed)\n\t}\n\tif cq.Filter != \"\" {\n\t\tvals.Set(\"filter\", cq.Filter)\n\t}\n\tif cq.Heartbeat > 0 {\n\t\tvals.Set(\"heartbeat\", strconv.Itoa(cq.Heartbeat))\n\t}\n\tif cq.Limit > 0 {\n\t\tvals.Set(\"limit\", strconv.Itoa(cq.Limit))\n\t}\n\tif cq.SeqInterval > 0 {\n\t\tvals.Set(\"seq_interval\", strconv.Itoa(cq.SeqInterval))\n\t}\n\tif cq.Style != \"\" {\n\t\tvals.Set(\"style\", cq.Style)\n\t}\n\tif cq.Since != \"\" {\n\t\tvals.Set(\"since\", cq.Since)\n\t}\n\tif cq.Timeout > 0 {\n\t\tvals.Set(\"timeout\", strconv.Itoa(cq.Timeout))\n\t}\n\treturn vals, nil\n}", "func ToBase64Query(s *string) *string {\n\treturn String(base64.StdEncoding.EncodeToString([]byte(StringValue(s))))\n}", "func (o *CreateOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (p *Param) QueryTo() (sqlbuilder.Iterator, error) {\n\treturn p.T().QueryTo(p)\n}", "func FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func (opts ListOpts) ToListenerListQuery() (string, error) {\n\tq, err := golangsdk.BuildQueryString(opts)\n\treturn q.String(), err\n}", "func (r *IntervalFilterInput) MakeQueryString(command string, measurement string) string {\n\tvar b bytes.Buffer\n\tb.WriteString(command)\n\tb.WriteString(\" FROM \")\n\tb.WriteString(measurement)\n\n\tcheck_empty := r == &IntervalFilterInput{}\n\tif check_empty {\n\t\treturn b.String()\n\t}\n\n\tflag := true\n\tb, flag = query.HandleTagFieldQuery(b, \"unique_meter_seqid\", r.UniqueMeterSeqid, flag)\n\tb, flag = query.HandleDateQuery(b, r.ExactTime, \"=\", flag)\n\tb, flag = query.HandleDateQuery(b, r.StartDate, \">=\", flag)\n\tb, _ = query.HandleDateQuery(b, r.EndDate, \"<\", flag)\n\n\treturn b.String()\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func (a *API) ParseQuery(ctx *fasthttp.RequestCtx) map[string]string {\n\tqs, _ := url.ParseQuery(string(ctx.URI().QueryString()))\n\tvalues := make(map[string]string)\n\tfor key, val := range qs {\n\t\tvalues[key] = val[0]\n\t}\n\n\treturn values\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}", "func (opts ListOpts) ToOrderListQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\treturn q.String(), err\n}", "func (opts ListOpts) ToLoadbalancerListQuery() (string, error) {\n\tq, err := golangsdk.BuildQueryString(opts)\n\treturn q.String(), err\n}", "func (opts ListOpts) ToContainerListQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\treturn q.String(), err\n}" ]
[ "0.69802153", "0.6851066", "0.6832986", "0.6753629", "0.6604387", "0.6578298", "0.6562738", "0.6556346", "0.6538245", "0.65255356", "0.6513276", "0.64893854", "0.6467349", "0.6452583", "0.6342201", "0.6269828", "0.62599957", "0.62418145", "0.6221602", "0.6195083", "0.61360025", "0.61112094", "0.60338074", "0.6023206", "0.5974216", "0.595622", "0.5949569", "0.5943651", "0.5932842", "0.5909867", "0.5876612", "0.58669704", "0.58448964", "0.5797", "0.5785356", "0.577764", "0.57753056", "0.57401246", "0.57149583", "0.56836605", "0.56485665", "0.5642096", "0.5639103", "0.5608062", "0.5592163", "0.55833274", "0.55753624", "0.55748856", "0.55523556", "0.5545998", "0.55432856", "0.5541885", "0.5537972", "0.5533365", "0.5524178", "0.55114925", "0.5500432", "0.5492192", "0.5463167", "0.5457923", "0.5393528", "0.5377508", "0.5372571", "0.53668475", "0.5356194", "0.53561276", "0.53471804", "0.5346122", "0.5341406", "0.5312741", "0.5306431", "0.530168", "0.5296583", "0.5286547", "0.52836853", "0.5277579", "0.5272561", "0.5257947", "0.52571064", "0.52516514", "0.5243876", "0.52352166", "0.52341026", "0.5231373", "0.5230528", "0.5228895", "0.52287734", "0.5228082", "0.5227604", "0.52156365", "0.5200451", "0.5196737", "0.5195561", "0.51769686", "0.5169097", "0.51662457", "0.51576966", "0.5152596", "0.51525253", "0.5148263" ]
0.6406001
14
ToQuery convert params to URL query
func (p ExpandParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.62643653
11
ToQuery convert params to URL query
func (p CollectionParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}" ]
[ "0.6831997", "0.6596019", "0.65677404", "0.6476657", "0.6465981", "0.64611274", "0.6440736", "0.6438274", "0.6336055", "0.6318419", "0.6303012", "0.6266506", "0.6254942", "0.62466896", "0.61847407", "0.6174108", "0.61501485", "0.6149749", "0.61430305", "0.61313033", "0.61309415", "0.6123018", "0.60939544", "0.6064903", "0.6058506", "0.6043484", "0.60021657", "0.59671724", "0.5960803", "0.5959084", "0.5952848", "0.5936705", "0.5882318", "0.5880043", "0.58763707", "0.58613706", "0.5852316", "0.58390176", "0.58136505", "0.58009285", "0.5791262", "0.5778837", "0.57418555", "0.57179207", "0.5713036", "0.5692613", "0.56849885", "0.5683099", "0.56711316", "0.56686", "0.5666536", "0.5660664", "0.566053", "0.56511587", "0.5632304", "0.5632276", "0.5631082", "0.56269825", "0.5619896", "0.56125534", "0.561004", "0.5608083", "0.56073284", "0.55918354", "0.55788124", "0.55529577", "0.55435604", "0.5533547", "0.55267924", "0.5524045", "0.5522935", "0.5522185", "0.5520482", "0.5513079", "0.5502729", "0.55002034", "0.54970086", "0.54875064", "0.54825944", "0.5482308", "0.5479345", "0.5475709", "0.5466874", "0.545944", "0.5456897", "0.5456347", "0.54530025", "0.54194033", "0.5412722", "0.5408235", "0.53998816", "0.53934705", "0.5386538", "0.5380098", "0.5370156", "0.53684753", "0.53681856", "0.53582233", "0.5346209", "0.5345492" ]
0.58379525
38
ToQuery convert params to URL query
func (p AuditParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.6121026
21
ToQuery convert params to URL query
func (p AuditSinceParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.6129387
20
ToQuery convert params to URL query
func (p ContentParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.61825085
14
ToQuery convert params to URL query
func (p ContentIDParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}" ]
[ "0.6831997", "0.6596019", "0.65677404", "0.6476657", "0.6465981", "0.64611274", "0.6440736", "0.6438274", "0.6336055", "0.6318419", "0.6303012", "0.6266506", "0.6254942", "0.62466896", "0.61847407", "0.61501485", "0.6149749", "0.61430305", "0.61313033", "0.61309415", "0.6123018", "0.60939544", "0.6064903", "0.6058506", "0.6043484", "0.60021657", "0.59671724", "0.5960803", "0.5959084", "0.5952848", "0.5936705", "0.5882318", "0.5880043", "0.58763707", "0.58613706", "0.5852316", "0.58390176", "0.58379525", "0.58136505", "0.58009285", "0.5791262", "0.5778837", "0.57418555", "0.57179207", "0.5713036", "0.5692613", "0.56849885", "0.5683099", "0.56711316", "0.56686", "0.5666536", "0.5660664", "0.566053", "0.56511587", "0.5632304", "0.5632276", "0.5631082", "0.56269825", "0.5619896", "0.56125534", "0.561004", "0.5608083", "0.56073284", "0.55918354", "0.55788124", "0.55529577", "0.55435604", "0.5533547", "0.55267924", "0.5524045", "0.5522935", "0.5522185", "0.5520482", "0.5513079", "0.5502729", "0.55002034", "0.54970086", "0.54875064", "0.54825944", "0.5482308", "0.5479345", "0.5475709", "0.5466874", "0.545944", "0.5456897", "0.5456347", "0.54530025", "0.54194033", "0.5412722", "0.5408235", "0.53998816", "0.53934705", "0.5386538", "0.5380098", "0.5370156", "0.53684753", "0.53681856", "0.53582233", "0.5346209", "0.5345492" ]
0.6174108
15
ToQuery convert params to URL query
func (p ContentSearchParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.6316479
9
ToQuery convert params to URL query
func (p ChildrenParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.5836777
37
ToQuery convert params to URL query
func (p AttachmentParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6121026", "0.6094124", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.6062588
23
ToQuery convert params to URL query
func (p LabelParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}" ]
[ "0.6831997", "0.6596019", "0.65677404", "0.6476657", "0.6465981", "0.64611274", "0.6440736", "0.6438274", "0.6336055", "0.6318419", "0.6303012", "0.6266506", "0.6254942", "0.62466896", "0.61847407", "0.6174108", "0.61501485", "0.6149749", "0.61430305", "0.61313033", "0.61309415", "0.6123018", "0.60939544", "0.6064903", "0.6058506", "0.6043484", "0.60021657", "0.59671724", "0.5960803", "0.5959084", "0.5952848", "0.5936705", "0.5882318", "0.5880043", "0.58763707", "0.58613706", "0.58390176", "0.58379525", "0.58136505", "0.58009285", "0.5791262", "0.5778837", "0.57418555", "0.57179207", "0.5713036", "0.5692613", "0.56849885", "0.5683099", "0.56711316", "0.56686", "0.5666536", "0.5660664", "0.566053", "0.56511587", "0.5632304", "0.5632276", "0.5631082", "0.56269825", "0.5619896", "0.56125534", "0.561004", "0.5608083", "0.56073284", "0.55918354", "0.55788124", "0.55529577", "0.55435604", "0.5533547", "0.55267924", "0.5524045", "0.5522935", "0.5522185", "0.5520482", "0.5513079", "0.5502729", "0.55002034", "0.54970086", "0.54875064", "0.54825944", "0.5482308", "0.5479345", "0.5475709", "0.5466874", "0.545944", "0.5456897", "0.5456347", "0.54530025", "0.54194033", "0.5412722", "0.5408235", "0.53998816", "0.53934705", "0.5386538", "0.5380098", "0.5370156", "0.53684753", "0.53681856", "0.53582233", "0.5346209", "0.5345492" ]
0.5852316
36
ToQuery convert params to URL query
func (p SearchParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.6594184
1
ToQuery convert params to URL query
func (p SpaceParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.6438409
6
ToQuery convert params to URL query
func (p UserParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.61299556", "0.6129387", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.647473
3
ToQuery convert params to URL query
func (p WatchParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p ListWatchersParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}" ]
[ "0.6831997", "0.6596019", "0.65677404", "0.6476657", "0.6465981", "0.6440736", "0.6438274", "0.6336055", "0.6318419", "0.6303012", "0.6266506", "0.6254942", "0.62466896", "0.61847407", "0.6174108", "0.61501485", "0.6149749", "0.61430305", "0.61313033", "0.61309415", "0.6123018", "0.60939544", "0.6064903", "0.6058506", "0.6043484", "0.60021657", "0.59671724", "0.5960803", "0.5959084", "0.5952848", "0.5936705", "0.5882318", "0.5880043", "0.58763707", "0.58613706", "0.5852316", "0.58390176", "0.58379525", "0.58136505", "0.58009285", "0.5791262", "0.5778837", "0.57418555", "0.57179207", "0.5713036", "0.5692613", "0.56849885", "0.5683099", "0.56711316", "0.56686", "0.5666536", "0.5660664", "0.566053", "0.56511587", "0.5632304", "0.5632276", "0.5631082", "0.56269825", "0.5619896", "0.56125534", "0.561004", "0.5608083", "0.56073284", "0.55918354", "0.55788124", "0.55529577", "0.55435604", "0.5533547", "0.55267924", "0.5524045", "0.5522935", "0.5522185", "0.5520482", "0.5513079", "0.5502729", "0.55002034", "0.54970086", "0.54875064", "0.54825944", "0.5482308", "0.5479345", "0.5475709", "0.5466874", "0.545944", "0.5456897", "0.5456347", "0.54530025", "0.54194033", "0.5412722", "0.5408235", "0.53998816", "0.53934705", "0.5386538", "0.5380098", "0.5370156", "0.53684753", "0.53681856", "0.53582233", "0.5346209", "0.5345492" ]
0.64611274
5
ToQuery convert params to URL query
func (p ListWatchersParameters) ToQuery() string { return paramsToQuery(p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func makeQueryStringFromParam(params map[string][]string) string {\n\tif params == nil {\n\t\treturn \"\"\n\t}\n\tresult := \"\"\n\tfor key, array := range params {\n\t\tfor _, value := range array {\n\t\t\tkeyVal := fmt.Sprintf(\"%s-%s\", key, value)\n\t\t\tif result == \"\" {\n\t\t\t\tresult = \"?\" + keyVal\n\t\t\t} else {\n\t\t\t\tresult = result + \"&\" + keyVal\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (p SearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *Params) EncodeToQuery() string {\n\treturn \"\"\n}", "func (p UserParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p *GetAllParams) QueryString() string {\n\turlValues := &url.Values{}\n\n\turlvalues.AddStringSliceToURLValues(urlValues, p.Statuses, \"statuses\")\n\tif p.Limit > 0 {\n\t\turlValues.Add(\"limit\", strconv.Itoa(p.Limit))\n\t}\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedAfter, \"created_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.CreatedBefore, \"created_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidAfter, \"paid_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.PaidBefore, \"paid_before\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredAfter, \"expired_after\")\n\turlvalues.AddTimeToURLValues(urlValues, p.ExpiredBefore, \"expired_before\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.ClientTypes, \"client_types\")\n\turlvalues.AddStringSliceToURLValues(urlValues, p.PaymentChannels, \"payment_channels\")\n\tif p.OnDemandLink != \"\" {\n\t\turlValues.Add(\"on_demand\", p.OnDemandLink)\n\t}\n\tif p.RecurringPaymentID != \"\" {\n\t\turlValues.Add(\"recurring_payment_id\", p.RecurringPaymentID)\n\t}\n\n\treturn urlValues.Encode()\n}", "func (p WatchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p SpaceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQueryParamUrl(reqURL *url.URL, queryStructs []interface{}, queryParams map[string]string) error {\n\turlValues, err := url.ParseQuery(reqURL.RawQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// encodes query structs into a url.Values map and merges maps\n\tfor _, queryStruct := range queryStructs {\n\t\tqueryValues, err := goquery.Values(queryStruct)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor key, values := range queryValues {\n\t\t\tfor _, value := range values {\n\t\t\t\turlValues.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tfor k, v := range queryParams {\n\t\turlValues.Add(k, v)\n\t}\n\t// url.Values format to a sorted \"url encoded\" string, e.g. \"key=val&foo=bar\"\n\treqURL.RawQuery = urlValues.Encode()\n\treturn nil\n}", "func (args ForecastArgs) QueryParams() url.Values {\n\tq := make(url.Values)\n\tif args.Location != nil {\n\t\tfor k, v := range args.Location.LocationQueryParams() {\n\t\t\tq[k] = v\n\t\t}\n\t}\n\n\tif !args.Start.IsZero() {\n\t\tq.Add(\"start_time\", args.Start.Format(time.RFC3339))\n\t}\n\tif !args.End.IsZero() {\n\t\tq.Add(\"end_time\", args.End.Format(time.RFC3339))\n\t}\n\tif args.Timestep > 0 {\n\t\tq.Add(\"timestep\", strconv.Itoa(args.Timestep))\n\t}\n\tif args.UnitSystem != \"\" {\n\t\tq.Add(\"unit_system\", args.UnitSystem)\n\t}\n\tif len(args.Fields) > 0 {\n\t\tq.Add(\"fields\", strings.Join(args.Fields, \",\"))\n\t}\n\treturn q\n}", "func (p ContentSearchParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (p ExpandParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (r AnnounceRequest) ToQuery() (vs url.Values) {\n\tvs = make(url.Values, 9)\n\tvs.Set(\"info_hash\", r.InfoHash.BytesString())\n\tvs.Set(\"peer_id\", r.PeerID.BytesString())\n\tvs.Set(\"uploaded\", strconv.FormatInt(r.Uploaded, 10))\n\tvs.Set(\"downloaded\", strconv.FormatInt(r.Downloaded, 10))\n\tvs.Set(\"left\", strconv.FormatInt(r.Left, 10))\n\n\tif r.IP != \"\" {\n\t\tvs.Set(\"ip\", r.IP)\n\t}\n\tif r.Event > 0 {\n\t\tvs.Set(\"event\", strconv.FormatInt(int64(r.Event), 10))\n\t}\n\tif r.Port > 0 {\n\t\tvs.Set(\"port\", strconv.FormatUint(uint64(r.Port), 10))\n\t}\n\tif r.NumWant != 0 {\n\t\tvs.Set(\"numwant\", strconv.FormatUint(uint64(r.NumWant), 10))\n\t}\n\tif r.Key != 0 {\n\t\tvs.Set(\"key\", strconv.FormatInt(int64(r.Key), 10))\n\t}\n\n\t// BEP 23\n\tif r.Compact {\n\t\tvs.Set(\"compact\", \"1\")\n\t} else {\n\t\tvs.Set(\"compact\", \"0\")\n\t}\n\n\treturn\n}", "func (w *Wrapper) paramToQuery(data interface{}, parentheses ...bool) (param string) {\n\tswitch v := data.(type) {\n\tcase *Wrapper:\n\t\tif len(parentheses) > 0 {\n\t\t\tif parentheses[0] == false {\n\t\t\t\tparam = fmt.Sprintf(\"%s\", v.query)\n\t\t\t}\n\t\t} else {\n\t\t\tparam = fmt.Sprintf(\"(%s)\", v.query)\n\t\t}\n\tcase function:\n\t\tparam = v.query\n\tcase nil:\n\t\tparam = \"NULL\"\n\tdefault:\n\t\tparam = \"?\"\n\t}\n\treturn\n}", "func (p ContentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ContentIDParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func buildQuery (req *http.Request, args map[string]string) (*http.Request) {\n\tq := req.URL.Query()\n\t// build query from map\n\tfor key, _ := range args {\n\t\tif key == \"q\" {\n\t\t\tparts := strings.Split(args[key],\" \")\n\t\t\tq.Add(\"q\", strings.Join(parts, \"+\"))\n\t\t} else {\n\t\t\tq.Add(key, args[key])\n\t\t}\n\t}\n\treq.URL.RawQuery = q.Encode()\n\treturn req\n}", "func (p EmptyParameters) ToQuery() string {\n\treturn \"\"\n}", "func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error) {\n\treturn query.Values(o)\n}", "func (p AuditSinceParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p AuditParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func query_param(query_data map[string][]string) *pagination.QueryParam {\n\tqp := new(pagination.QueryParam)\n\tif len(query_data[\"page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"per_page\"]) > 0 {\n\t\tpage, err := strconv.Atoi(query_data[\"per_page\"][0])\n\t\tif err == nil {\n\t\t\tqp.Per_page = page\n\t\t}\n\t}\n\n\tif len(query_data[\"value\"]) > 0 {\n\t\tqp.Value = query_data[\"value\"][0]\n\t}\n\n\tif len(query_data[\"filter\"]) > 0 {\n\t\tqp.Filter, _ = strconv.ParseBool(query_data[\"filter\"][0])\n\t}\n\n\treturn qp\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (o *Aliyun) makeURLQuery(_url string) string {\n\tquery, _ := url.Parse(_url)\n\tparam := query.Query()\n\tquerys, arr := o.makeDictionarySort(param)\n\tstr := \"\"\n\tfor _, k := range querys {\n\t\tstr += k + \"=\" + o.percentEncode(arr[k][0]) + \"&\"\n\t}\n\treturn str[:len(str)-1]\n}", "func (r InboundRequest) QueryParams() map[string][]string {\n return r.URL.Query()\n}", "func (ctx *SimpleContext) QueryParams(typ interface{}) error {\n\tq := ctx.request.URL.Query()\n\terr := query.Unmarshal(q, typ)\n\tif nil != err {\n\t\treturn err\n\t}\n\treturn ctx.validate(typ)\n}", "func StructToQueryString(st interface{}) (qs string, err error) {\n\tjsonBytes, err := json.Marshal(st)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconvert := map[string]interface{}{}\n\terr = json.Unmarshal(jsonBytes, &convert)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tqsParams := make([]string, len(convert))\n\ti := 0\n\tfor key, val := range convert {\n\t\tqsParams[i] = fmt.Sprintf(\"%s=%v\", key, val)\n\t\ti++\n\t}\n\n\tqs = strings.Join(qsParams, \"&\")\n\treturn\n}", "func GetRequestQueryString(query string) map[string]string {\n\tpairs := strings.Split(query, \"&\")\n\tparams := make(map[string]string, len(pairs))\n\n\tif len(query) < 1 {\n\t\treturn params\n\t}\n\n\tfor i := 0; i < len(pairs); i++ {\n\t\tketValuePair := strings.Split(pairs[i], \"=\")\n\t\tparams[ketValuePair[0]] = ketValuePair[1]\n\t}\n\n\treturn params\n}", "func (u *URL) QueryParams() map[string][]string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn map[string][]string(u.query)\n}", "func (r *Request) QueryParams(params map[string]string) *Request {\n\tfor k, v := range params {\n\t\tr.query[k] = append(r.query[k], v)\n\t}\n\treturn r\n}", "func (z RequestData) ParamQuery() string {\n\tl := esl.Default()\n\tif z.q == nil {\n\t\treturn \"\"\n\t}\n\tq, err := query.Values(z.q)\n\tif err != nil {\n\t\tl.Debug(\"unable to make query\", esl.Error(err), esl.Any(\"q\", z.q))\n\t\treturn \"\"\n\t} else {\n\t\treturn \"?\" + q.Encode()\n\t}\n}", "func GetQueryParams(request interface{}) (urlEncoded string, err error) {\n\tjsonStr, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar result map[string]interface{}\n\tif err = json.Unmarshal(jsonStr, &result); err != nil {\n\t\treturn\n\t}\n\n\turlEncoder := url.Values{}\n\tfor key, value := range result {\n\t\tstr := fmt.Sprint(value)\n\t\tif str != \"\" {\n\t\t\turlEncoder.Add(key, str)\n\t\t}\n\t}\n\turlEncoded = urlEncoder.Encode()\n\treturn\n}", "func getQueryParams(v interface{}, vals url.Values) error {\n\t// normalize all query string key/values\n\targs := make(map[string]string)\n\n\tfor k, v := range vals {\n\t\tif len(v) > 0 {\n\t\t\targs[k] = v[0]\n\t\t}\n\t}\n\n\tb, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(b, v)\n}", "func (f FilterParameter) ToURLParams() string {\n\tflat := make([]string, 0)\n\ttemplate := \"filters[%s][][%s]=%s\"\n\n\tfor key, values := range f.filters {\n\t\tfor _, value := range values {\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"type\", value.Type))\n\t\t\tflat = append(flat, fmt.Sprintf(template, key, \"value\", value.Value))\n\t\t}\n\t}\n\n\treturn strings.Join(flat, \"&\")\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func (p LabelParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p ChildrenParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (p CollectionParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func setQueryParams(req *http.Request, params map[string]interface{}) {\n\tquery := req.URL.Query()\n\tfor key, value := range params {\n\t\tquery.Add(key, fmt.Sprintf(\"%v\", value))\n\t}\n\treq.URL.RawQuery = query.Encode()\n}", "func BuildQuery(baseURL string, queryParams ...[]string) string {\n\tbase, err := url.Parse(baseURL)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn \"\"\n\t}\n\tparams := url.Values{}\n\tfor _, queryParam := range queryParams {\n\t\tparams.Add(queryParam[0], queryParam[1])\n\t}\n\tbase.RawQuery = params.Encode()\n\treturn base.String()\n}", "func ParseQueryString(param string, request *http.Request, params imageserver.Params) {\n\ts := request.URL.Query().Get(param)\n\tif s != \"\" {\n\t\tparams.Set(param, s)\n\t}\n}", "func (b *addPushNotificationsOnChannelsBuilder) QueryParam(queryParam map[string]string) *addPushNotificationsOnChannelsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func QueryParameters(val interface{}) string {\n\tif val == nil || (reflect.ValueOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil()) {\n\t\treturn \"\"\n\t}\n\n\tvar query []string\n\n\ts := structs.New(val)\n\tm := s.Map()\n\n\tfor k, v := range m {\n\t\tf := s.Field(k)\n\t\tt := f.Tag(\"query\")\n\n\t\tif !f.IsZero() {\n\t\t\tquery = append(query, fmt.Sprintf(\"%v=%v\", t, v))\n\t\t}\n\t}\n\n\tif len(query) == 0 {\n\t\treturn \"\"\n\t}\n\n\treturn \"?\" + strings.Join(query, \"&\")\n}", "func queryForParams(params SearchParams) string {\n\tif len(params.RawQuery) > 0 {\n\t\treturn params.RawQuery\n\t}\n\n\tbuilder := jiraquery.AndBuilder()\n\n\tif len(params.Project) > 0 {\n\t\tbuilder.Project(params.Project)\n\t}\n\n\tif len(params.IssueType) > 0 {\n\t\tbuilder.IssueType(params.IssueType)\n\t}\n\n\tif len(params.Status) > 0 {\n\t\tbuilder.Eq(jiraquery.Word(\"status\"), jiraquery.Word(params.Status))\n\t}\n\n\tif len(params.StatusCategory) > 0 {\n\t\tbuilder.Eq(\n\t\t\tjiraquery.Word(\"statusCategory\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.StatusCategory)))\n\t}\n\n\tif len(params.Labels) > 0 {\n\t\tif len(params.Labels) == 1 {\n\t\t\tbuilder.Eq(jiraquery.Word(\"labels\"), jiraquery.Word(params.Labels[0]))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"labels\"), jiraquery.List(params.Labels...))\n\t\t}\n\t}\n\n\tif len(params.Components) > 0 {\n\t\tif len(params.Components) == 1 {\n\t\t\tbuilder.Eq(\n\t\t\t\tjiraquery.Word(\"component\"),\n\t\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.Components[0])))\n\t\t} else {\n\t\t\tbuilder.In(jiraquery.Word(\"component\"), jiraquery.List(params.Components...))\n\t\t}\n\t}\n\n\tif params.CreatedAfter != nil {\n\t\tbuilder.GreaterThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedAfter.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\tif params.CreatedBefore != nil {\n\t\tbuilder.LessThan(\n\t\t\tjiraquery.Word(\"created\"),\n\t\t\tjiraquery.Word(fmt.Sprintf(\"%q\", params.CreatedBefore.Format(\"2006-1-2 04:05\"))))\n\t}\n\n\treturn builder.Value().String()\n}", "func urlQueryToString(options interface{}) (string, error) {\n\tv, err := query.Values(options)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn v.Encode(), nil\n}", "func createGetQuery(data map[string]any, msg *models.Message) (string, error) {\n\tu := url.Values{}\n\n\tfor k, v := range data {\n\t\tsubv, err := utils.Substitute(v.(string), msg.Vars)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tu.Add(k, subv)\n\t}\n\n\tencoded := u.Encode() // uses QueryEscape\n\tencoded = strings.ReplaceAll(encoded, \"+\", \"%20\") // replacing + with more reliable %20\n\n\treturn encoded, nil\n}", "func addQuery(u *url.URL, q map[string]string) url.URL {\n\tquery := u.Query()\n\tif q == nil {\n\t\treturn *u\n\t}\n\n\tfor key, value := range q {\n\t\tquery.Add(key, value)\n\t}\n\tu.RawQuery = query.Encode()\n\treturn *u\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (icbc *IcbcClientUi) buildUrlQueryParams(params map[string]interface{} , urlQueryParams *map[string]interface{}, urlBodyParams *map[string]interface{}) {\n\tapiParamNames := make(map[string]bool)\n\tapiParamNames[SIGN] = true\n\tapiParamNames[APP_ID] = true\n\tapiParamNames[SIGN_TYPE] = true\n\tapiParamNames[CHARSET] = true\n\tapiParamNames[FORMAT] = true\n\tapiParamNames[ENCRYPT_TYPE] = true\n\tapiParamNames[TIMESTAMP] = true\n\tapiParamNames[MSG_ID] = true\n\tfor k,v := range params {\n\t\tif _,ok := apiParamNames[k];ok {\n\t\t\t(*urlQueryParams)[k] = v\n\t\t} else {\n\t\t\t(*urlBodyParams)[k] = v\n\t\t}\n\t}\n}", "func NewQueryParams(q, p, pp, sort, filter string) QueryParam {\n\tvar qp QueryParam\n\n\tif q != \"\" {\n\t\tqp.Query = q\n\t}\n\n\tpage, err := strconv.Atoi(p)\n\tif err != nil {\n\t\tpage = pageDef\n\t}\n\tqp.Page = page\n\n\tperPage, err := strconv.Atoi(pp)\n\tif err != nil {\n\t\tperPage = perPageDef\n\t}\n\tqp.PerPage = perPage\n\n\tif sortVals := strings.Split(sort, sortFltrSeparator); len(sortVals) == 2 {\n\t\tqp.Sort = map[string]string{sortVals[0]: sortVals[1]}\n\t}\n\n\tif ftrVal := strings.Split(filter, fltrSeparator); len(ftrVal) >= 1 {\n\t\tfilters := make(map[string]string, len(ftrVal))\n\t\tfor _, fltr := range ftrVal {\n\t\t\tif f := strings.Split(fltr, sortFltrSeparator); len(f) == 2 {\n\t\t\t\tfilters[f[0]] = f[1]\n\t\t\t}\n\t\t}\n\t\tqp.Filter = filters\n\t}\n\n\treturn qp\n}", "func httpBuildQuery(params map[string]string) string {\n\tlist := make([]string, 0, len(params))\n\tbuffer := make([]string, 0, len(params))\n\tfor key := range params {\n\t\tlist = append(list, key)\n\t}\n\tsort.Strings(list)\n\tfor _, key := range list {\n\t\tvalue := params[key]\n\t\tbuffer = append(buffer, key)\n\t\tbuffer = append(buffer, \"=\")\n\t\tbuffer = append(buffer, value)\n\t\tbuffer = append(buffer, \"&\")\n\t}\n\tbuffer = buffer[:len(buffer)-1]\n\treturn strings.Join(buffer, \"\")\n}", "func (ctx *Context) QueryParams() url.Values {\n\tif ctx.queryParams == nil {\n\t\tctx.queryParams = ctx.Request.URL.Query()\n\t}\n\treturn ctx.queryParams\n}", "func (b *removeMessageActionsBuilder) QueryParam(queryParam map[string]string) *removeMessageActionsBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func AppendQuery(queryParams url.Values) URIOption {\n\treturn func(buildURI string) string {\n\t\tif queryParams != nil {\n\t\t\tbuildURI = buildURI + \"?\" + queryParams.Encode()\n\t\t}\n\t\treturn buildURI\n\t}\n}", "func createUrlQuery(testHistoryParameters model.TestHistoryParameters) string {\n\tqueryString := fmt.Sprintf(\"testStatuses=%s&taskStatuses=%s\",\n\t\tstrings.Join(testHistoryParameters.TestStatuses, \",\"),\n\t\tstrings.Join(testHistoryParameters.TaskStatuses, \",\"),\n\t)\n\n\tif testHistoryParameters.TaskRequestType != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&buildType=%s\", testHistoryParameters.TaskRequestType)\n\t}\n\n\tif len(testHistoryParameters.TaskNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tasks=%v\", strings.Join(testHistoryParameters.TaskNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.TestNames) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&tests=%v\", strings.Join(testHistoryParameters.TestNames, \",\"))\n\t}\n\n\tif len(testHistoryParameters.BuildVariants) > 0 {\n\t\tqueryString += fmt.Sprintf(\"&variants=%v\", strings.Join(testHistoryParameters.BuildVariants, \",\"))\n\t}\n\n\tif testHistoryParameters.BeforeRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&beforeRevision=%v\", testHistoryParameters.BeforeRevision)\n\t}\n\n\tif testHistoryParameters.AfterRevision != \"\" {\n\t\tqueryString += fmt.Sprintf(\"&afterRevision=%v\", testHistoryParameters.AfterRevision)\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.BeforeDate) {\n\t\tqueryString += fmt.Sprintf(\"&beforeDate=%v\", testHistoryParameters.BeforeDate.Format(time.RFC3339))\n\t}\n\tif !util.IsZeroTime(testHistoryParameters.AfterDate) {\n\t\tqueryString += fmt.Sprintf(\"&afterDate=%v\", testHistoryParameters.AfterDate.Format(time.RFC3339))\n\t}\n\n\tif testHistoryParameters.Limit != 0 {\n\t\tqueryString += fmt.Sprintf(\"&limit=%v\", testHistoryParameters.Limit)\n\t}\n\n\treturn queryString\n}", "func getAllURLParameters(u *url.URL) map[string][]string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn v\n}", "func QueryStringParam(r *http.Request, param, defaultValue string) string {\n\tvalue := r.URL.Query().Get(param)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (r *InboundRequest) QueryParam(key string) (string, bool) {\n values, ok := r.URL.Query()[key]\n\n if !ok || len(values) == 0 {\n return \"\", false\n }\n\n return values[0], true\n}", "func (params *GetParams) ToRequestParameters() communicator.RequestParams {\n\treqParams := communicator.RequestParams{}\n\n\tcommunicator.AddRequestParameter(&reqParams, \"countryCode\", params.CountryCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"currencyCode\", params.CurrencyCode)\n\tcommunicator.AddRequestParameter(&reqParams, \"locale\", params.Locale)\n\tcommunicator.AddRequestParameter(&reqParams, \"amount\", params.Amount)\n\tcommunicator.AddRequestParameter(&reqParams, \"isRecurring\", params.IsRecurring)\n\tcommunicator.AddRequestParameter(&reqParams, \"hide\", params.Hide)\n\n\treturn reqParams\n}", "func marshalQuery(q url.Values) map[string]string {\n\t// flatten url.Values by dropping others but the first one\n\tvalues := make(map[string]string, len(q))\n\tfor k, arr := range q {\n\t\tvalues[k] = arr[0]\n\t}\n\treturn values\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 QueryToJSON(queryString string) ([]byte, error) {\r\n\r\n\tparsedQuery, err := url.ParseQuery(queryString)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tjsonString, err := json.Marshal(parsedQuery)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\treturn jsonString, nil\r\n}", "func ToQueryMap(req Common) (map[string]string, error) {\n\treturn EncodeForm(req)\n}", "func URLQueryParam(in string) string {\n\tvar out = &bytes.Buffer{}\n\tvar c byte\n\tfor i := 0; i < len(in); i++ {\n\t\tc = in[i]\n\t\tif (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c == 45 || c == 46 || c == 126 || c == 95 {\n\t\t\t// a-zA-Z0-9-._~\n\t\t\tout.WriteByte(c)\n\t\t} else {\n\t\t\t// UTF-8\n\t\t\tfmt.Fprintf(out, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn out.String()\n}", "func QueryStringParam(request *http.Request, paramName string, defaultValue string) string {\n\tvalue := request.URL.Query().Get(paramName)\n\tif value == \"\" {\n\t\tvalue = defaultValue\n\t}\n\treturn value\n}", "func (o *QueryDirectoryParams) 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.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); 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.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); 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 := swag.FormatBool(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.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); 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.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 encodeQuery(url *neturl.URL, sql string) {\n\tquery := url.Query()\n\tquery.Set(chQueryUrlParam, sql)\n\turl.RawQuery = query.Encode()\n}", "func (r *BasicRequest) QueryArgs() (url.Values, error) {\n\treturn url.ParseQuery(r.Query)\n}", "func (r *Request) GetQuery(p string) string {\n\treturn r.natReqObj.QueryStringParameters[p]\n}", "func ExtractQueryParams(r *events.APIGatewayProxyRequest) map[string]string {\n\treturn map[string]string{\n\t\tconfigs.TimeTypeQueryParam: r.QueryStringParameters[configs.TimeTypeQueryParam],\n\t\tconfigs.OffsetUnitsQueryParam: r.QueryStringParameters[configs.OffsetUnitsQueryParam],\n\t\tconfigs.OffsetValueQueryParam: r.QueryStringParameters[configs.OffsetValueQueryParam],\n\t\tconfigs.StartTimeQueryParam: r.QueryStringParameters[configs.StartTimeQueryParam],\n\t\tconfigs.EndTimeQueryParam: r.QueryStringParameters[configs.EndTimeQueryParam],\n\t\tconfigs.ProductNumberQueryParam: r.QueryStringParameters[configs.ProductNumberQueryParam],\n\t\tconfigs.SerialNumberQueryParam: r.QueryStringParameters[configs.SerialNumberQueryParam],\n\t}\n}", "func (b *addChannelToChannelGroupBuilder) QueryParam(queryParam map[string]string) *addChannelToChannelGroupBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func MarshalQueryString(v interface{}) (string, error) {\n\tvalues, err := query.Values(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn values.Encode(), nil\n}", "func (opts ShowOpts) ToShowQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func (options PaginationOption) MakeQueryString() string {\n\tvalues := make(url.Values)\n\tif options.order != PaginationOrderDesc {\n\t\tvalues.Set(\"order\", string(options.order))\n\t}\n\tif options.limit != 25 {\n\t\tvalues.Set(\"limit\", string(options.limit))\n\t}\n\tif options.startingAfter != \"\" {\n\t\tvalues.Set(\"starting_after\", options.startingAfter)\n\t}\n\tif options.endingBefore != \"\" {\n\t\tvalues.Set(\"ending_before\", options.endingBefore)\n\t}\n\treturn values.Encode()\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 (opts GetOpts) ToObjectGetQuery() (string, error) {\n\tq, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn q.String(), nil\n}", "func addQueryParams(s string, queryParams interface{}) (string, error) {\n\tv := reflect.ValueOf(queryParams)\n\tif v.Kind() == reflect.Ptr && v.IsNil() {\n\t\treturn s, nil\n\t}\n\n\tu, err := url.Parse(s)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tqs, err := query.Values(queryParams)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tu.RawQuery = qs.Encode()\n\treturn u.String(), nil\n}", "func QueryParamAsString(name string, r *http.Request) string {\n\treturn r.URL.Query().Get(name)\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (c *Ctx) QueryParam(s string) string {\n\treturn c.Req.URL.Query().Get(s)\n}", "func ExtractPaginationQueryString(qry url.Values) map[string]interface{} {\n\n\tpg := map[string]interface{}{\n\t\t\"Page\": 1,\n\t\t\"PerPage\": 15,\n\t\t\"Filter\": \"\",\n\t\t\"Order\": \"created_at\",\n\t\t\"OrderType\": \"desc\",\n\t\t\"NoPagination\": false,\n\t}\n\n\t// Extract noPagination from query\n\tparamNoPagination := qry.Get(\"noPagination\")\n\tif paramNoPagination == \"0\" || paramNoPagination == \"\" {\n\t\tpg[\"NoPagination\"] = false\n\t} else {\n\t\tpg[\"NoPagination\"] = true\n\t}\n\n\t// Extract Page from query\n\tif paramPage, err := strconv.Atoi(qry.Get(\"page\")); err == nil {\n\t\tpg[\"Page\"] = paramPage\n\t}\n\n\t// Extract item per page\n\tif paramPerPage, err := strconv.Atoi(qry.Get(\"perPage\")); err == nil {\n\t\tpg[\"PerPage\"] = paramPerPage\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"filter\") != \"\" {\n\t\tpg[\"Filter\"] = qry.Get(\"filter\")\n\t}\n\n\t// Extract needed filter\n\tif qry.Get(\"IsPaginate\") == \"\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else if qry.Get(\"IsPaginate\") == \"false\" {\n\t\tpg[\"IsPaginate\"] = false\n\t} else {\n\t\tpg[\"IsPaginate\"] = false\n\t}\n\n\t// Extract order by direction\n\tif qry.Get(\"order\") != \"\" {\n\t\tpg[\"Order\"] = qry.Get(\"order\")\n\t\tswitch qry.Get(\"orderType\") {\n\t\tcase \"asc\":\n\t\t\tpg[\"OrderType\"] = \"asc\"\n\t\tcase \"desc\":\n\t\t\tpg[\"OrderType\"] = \"desc\"\n\t\t}\n\t}\n\n\treturn pg\n}", "func (u *URL) QueryParam(name string) string {\n\tif u.query == nil {\n\t\tu.query = u.Query()\n\t}\n\treturn u.query.Get(name)\n}", "func buildQueryURL(prefix, prop string, titles []string, cont string) string {\n\tvalues := url.Values{}\n\tvalues.Add(\"format\", \"json\")\n\tvalues.Add(\"action\", \"query\")\n\tvalues.Add(\"titles\", strings.Join(titles, \"|\"))\n\tvalues.Add(\"prop\", prop)\n\tvalues.Add(fmt.Sprintf(\"%snamespace\", prefix), namespace)\n\tvalues.Add(fmt.Sprintf(\"%slimit\", prefix), \"max\")\n\tif len(cont) > 0 {\n\t\tvalues.Add(fmt.Sprintf(\"%scontinue\", prefix), cont)\n\t}\n\treturn fmt.Sprintf(\"%s?%s\", apiEndpoint, values.Encode())\n}", "func getQuery(request *http.Request, c context.Context) (string, error) {\n\tresult := request.URL.Query().Get(queryParam)\n\n\tif result == \"\" {\n\t\treturn \"\", errors.New(\"No query specified.\")\n\t}\n\tlog.Infof(c, \"Recived query parameter: %v\", result)\n\treturn result, nil\n}", "func ReparseQuery(r *http.Request) {\n\tif !strings.ContainsRune(r.URL.Path, '?') {\n\t\treturn\n\t}\n\tq := r.URL.Query()\n\ttmpURL, err := url.Parse(r.URL.Path)\n\tdebug.AssertNoErr(err)\n\tfor k, v := range tmpURL.Query() {\n\t\tq.Add(k, strings.Join(v, \",\"))\n\t}\n\tr.URL.Path = tmpURL.Path\n\tr.URL.RawQuery = q.Encode()\n}", "func QueryParamString(request *http.Request, name string) (string, IResponse) {\n\tvalue := request.URL.Query().Get(name)\n\tif value == \"\" {\n\t\treturn \"\", BadRequest(request, \"Empty query param %s\", name)\n\t}\n\n\treturn value, nil\n}", "func ReplacePositionalParamsInQuery(query string, params ...interface{}) string {\n\t// TODO: This is a naive method for replacement. A better implementation can be added as required. (-_-) zzz\n\tfor _, param := range params {\n\t\tquery = strings.Replace(query, \"?\", getValueAsString(param), 1)\n\t}\n\treturn query\n}", "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func ParseQueryString(values map[string][]string) *NgGrid {\n\tg := &NgGrid{}\n\tif value := values[QS_SORT_DIRECTION]; len(value) != 0 {\n\t\tg.SortDirection = value[0]\n\t}\n\tif value := values[QS_SORT_FIELD]; len(value) != 0 {\n\t\tg.SortField = value[0]\n\t}\n\tif value := values[QS_QUERY]; len(value) != 0 {\n\t\tg.Query = value[0]\n\t}\n\tif value := values[QS_PAGE_NUMBER]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageNumber = int64(pn)\n\t\t}\n\t}\n\tif value := values[QS_PAGE_SIZE]; len(value) != 0 {\n\t\tpn, err := strconv.Atoi(value[0])\n\t\tif err == nil {\n\t\t\tg.PageSize = int64(pn)\n\t\t}\n\t}\n\n\tif g.PageNumber < 1 {\n\t\tg.PageNumber = 1\n\t}\n\n\treturn g\n}", "func getURLParameters(u *url.URL, key string) []string {\n\tv, err := url.ParseQuery(u.RawQuery)\n\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\n\treturn v[key]\n}", "func buildQueryValues(namespace string, query url.Values) url.Values {\n\tv := url.Values{}\n\tif query != nil {\n\t\tfor key, values := range query {\n\t\t\tfor _, value := range values {\n\t\t\t\tv.Add(key, value)\n\t\t\t}\n\t\t}\n\t}\n\tif len(namespace) > 0 {\n\t\tif testapi.Version() == \"v1beta1\" || testapi.Version() == \"v1beta2\" {\n\t\t\tv.Set(\"namespace\", namespace)\n\t\t}\n\t}\n\treturn v\n}", "func (ig *Instagram) BuildQuery(u *url.URL, qs *url.Values) string {\n\t//Combine the query strings\n\tuQueryString := u.Query()\n\tfor k, v := range uQueryString {\n\t\tfor _, realVal := range v {\n\t\t\tqs.Add(k, realVal)\n\t\t}\n\t}\n\t//TODO(james) toggle based on whether or not user has logged in\n\tqs.Set(\"client_id\", ig.OauthConfig.ClientId)\n\n\treturn u.Scheme + `://` + u.Host + u.Path + `?` + qs.Encode()\n}", "func (b *timeBuilder) QueryParam(queryParam map[string]string) *timeBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "func (f *Filter) ToQuery() string {\n\treturn fmt.Sprintf(\"last_knowledge_of_server=%d\", f.LastKnowledgeOfServer)\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 FilterQuery(fq string) func(url.Values) {\n\treturn func(p url.Values) {\n\t\tp[\"fq\"] = append(p[\"fq\"], fq)\n\t}\n}", "func ParseQueryString(q string) (map[string]interface{}, error) {\n\tuv, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmp := map[string]interface{}{}\n\tfor k, v := range uv {\n\t\tmp[k] = v[0]\n\t}\n\treturn mp, err\n}", "func (o *CommitOptions) ToParams() (url.Values, error) {\n\treturn util.ToParams(o)\n}", "func queryToMap(query url.Values, m map[string]interface{}) map[string]interface{} {\n\t// no-op if query is empty, do not create the key m[\"query\"]\n\tif len(query) == 0 {\n\t\treturn m\n\t}\n\n\t/* 'parameter' will represent url.Values\n\tmap[string]interface{}{\n\t\t\"parameter-a\": []interface{}{\n\t\t\t\"a\",\n\t\t\t\"b\",\n\t\t},\n\t\t\"parameter-b\": []interface{}{\n\t\t\t\"x\",\n\t\t\t\"y\",\n\t\t},\n\t}\n\t*/\n\tparameters := map[string]interface{}{}\n\tfor param, values := range query {\n\t\tparameters[param] = queryParamValuesToMap(values)\n\t}\n\tm[\"query\"] = parameters\n\treturn m\n}", "func (req JourneyRequest) toURL() (url.Values, error) {\n\tparams := url.Values{}\n\n\t// Define a few useful functions\n\taddUint := func(key string, amount uint64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatUint(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddInt := func(key string, amount int64) {\n\t\tif amount != 0 {\n\t\t\tstr := strconv.FormatInt(amount, 10)\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddString := func(key string, str string) {\n\t\tif str != \"\" {\n\t\t\tparams.Add(key, str)\n\t\t}\n\t}\n\taddIDSlice := func(key string, ids []types.ID) {\n\t\tif len(ids) != 0 {\n\t\t\tfor _, id := range ids {\n\t\t\t\tparams.Add(key, string(id))\n\t\t\t}\n\t\t}\n\t}\n\taddModes := func(key string, modes []string) {\n\t\tif len(modes) != 0 {\n\t\t\tfor _, mode := range modes {\n\t\t\t\tparams.Add(key, mode)\n\t\t\t}\n\t\t}\n\t}\n\taddFloat := func(key string, amount float64) {\n\t\tif amount != 0 {\n\t\t\tspeedStr := strconv.FormatFloat(amount, 'f', 3, 64)\n\t\t\tparams.Add(key, speedStr)\n\t\t}\n\t}\n\n\t// Encode the from and to\n\tif from := req.From; from != \"\" {\n\t\tparams.Add(\"from\", string(from))\n\t}\n\tif to := req.To; to != \"\" {\n\t\tparams.Add(\"to\", string(to))\n\t}\n\n\tif datetime := req.Date; !datetime.IsZero() {\n\t\tstr := datetime.Format(types.DateTimeFormat)\n\t\tparams.Add(\"datetime\", str)\n\t\tif req.DateIsArrival {\n\t\t\tparams.Add(\"datetime_represents\", \"arrival\")\n\t\t}\n\t}\n\n\taddString(\"traveler_type\", string(req.Traveler))\n\n\taddString(\"data_freshness\", string(req.Freshness))\n\n\taddIDSlice(\"forbidden_uris[]\", req.Forbidden)\n\n\taddIDSlice(\"allowed_id[]\", req.Allowed)\n\n\taddModes(\"first_section_mode[]\", req.FirstSectionModes)\n\n\taddModes(\"last_section_mode[]\", req.LastSectionModes)\n\n\t// max_duration_to_pt\n\taddInt(\"max_duration_to_pt\", int64(req.MaxDurationToPT/time.Second))\n\n\t// walking_speed, bike_speed, bss_speed & car_speed\n\taddFloat(\"walking_speed\", req.WalkingSpeed)\n\taddFloat(\"bike_speed\", req.BikeSpeed)\n\taddFloat(\"bss_speed\", req.BikeShareSpeed)\n\taddFloat(\"car_speed\", req.CarSpeed)\n\n\t// If count is defined don't bother with the minimimal and maximum amount of items to return\n\tif count := req.Count; count != 0 {\n\t\taddUint(\"count\", uint64(count))\n\t} else {\n\t\taddUint(\"min_nb_journeys\", uint64(req.MinJourneys))\n\t\taddUint(\"max_nb_journeys\", uint64(req.MaxJourneys))\n\t}\n\n\t// max_nb_transfers\n\taddUint(\"max_nb_transfers\", uint64(req.MaxTransfers))\n\n\t// max_duration\n\taddInt(\"max_duration\", int64(req.MaxDuration/time.Second))\n\n\t// wheelchair\n\tif req.Wheelchair {\n\t\tparams.Add(\"wheelchair\", \"true\")\n\t}\n\n\treturn params, nil\n}" ]
[ "0.6832333", "0.6594184", "0.6566136", "0.647473", "0.6467218", "0.645976", "0.6438409", "0.6438392", "0.6338079", "0.6316479", "0.6304608", "0.62643653", "0.6253197", "0.6245381", "0.61825085", "0.6172136", "0.61507785", "0.6148716", "0.61405796", "0.6129387", "0.6121026", "0.6094124", "0.6062588", "0.60582536", "0.6044131", "0.6004791", "0.59651953", "0.59609026", "0.5960431", "0.59554154", "0.5939299", "0.58830655", "0.5881145", "0.58752126", "0.5863285", "0.5849596", "0.5836777", "0.58354485", "0.5814614", "0.5802494", "0.57915384", "0.57793695", "0.574401", "0.5719182", "0.57116175", "0.56922835", "0.56841224", "0.5683906", "0.56714314", "0.56707245", "0.5667749", "0.5662713", "0.5660969", "0.5652281", "0.5632931", "0.56327033", "0.5631482", "0.5627487", "0.56177664", "0.56111234", "0.56094664", "0.560465", "0.56041723", "0.5592569", "0.55792487", "0.55523664", "0.5542844", "0.5534669", "0.5527573", "0.5524765", "0.5522237", "0.5521809", "0.55198175", "0.5512686", "0.5502554", "0.54992044", "0.549747", "0.5487749", "0.54841083", "0.5483614", "0.5478712", "0.54767394", "0.5468235", "0.5459186", "0.5457778", "0.54571277", "0.5454631", "0.5419449", "0.5413132", "0.5408296", "0.53998816", "0.5394755", "0.53867877", "0.537684", "0.53695893", "0.5368271", "0.536812", "0.53577185", "0.53450036", "0.534332" ]
0.61299556
19
Deprecated: Use Empty.ProtoReflect.Descriptor instead.
func (*Empty) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*UnusedEmptyMessage) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{33}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_pkg_sinks_plugin_proto_metrics_proto_rawDescGZIP(), []int{3}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_testproto_proto_rawDescGZIP(), []int{6}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_chat_proto_rawDescGZIP(), []int{3}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_pkg_apis_tra_v1alpha1_tra_proto_rawDescGZIP(), []int{0}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{13}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_example_go_services_04_grpc_proto_book_proto_rawDescGZIP(), []int{0}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*EmptyRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_todolist_proto_rawDescGZIP(), []int{2}\n}", "func (*All) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{9}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{1}\n}", "func (*EmptyMessage) Descriptor() ([]byte, []int) {\n\treturn file_survey_proto_rawDescGZIP(), []int{4}\n}", "func (*Undefined) Descriptor() ([]byte, []int) {\n\treturn file_rpc_rpc_proto_rawDescGZIP(), []int{3}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (*Primitive) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{15}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{0}\n}", "func (*NonFinites) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{1}\n}", "func (*Dummy) Descriptor() ([]byte, []int) {\n\treturn file_protolib_proto_rawDescGZIP(), []int{2}\n}", "func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{11}\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_thoughts_proto_rawDescGZIP(), []int{7}\n}", "func (*EmptyRequest) Descriptor() ([]byte, []int) {\n\treturn file_examplepb_example_proto_rawDescGZIP(), []int{5}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DummyInner) Descriptor() ([]byte, []int) {\n\treturn file_protolib_proto_rawDescGZIP(), []int{1}\n}", "func (*NotAllReachable) Descriptor() ([]byte, []int) {\n\treturn file_internal_tool_grpctool_test_test_proto_rawDescGZIP(), []int{6}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*MsgWithRequired) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{9}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{3}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*Simple) Descriptor() ([]byte, []int) {\n\treturn file_testproto_proto_rawDescGZIP(), []int{7}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{2}\n}", "func (*NoRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_proto_proto_rawDescGZIP(), []int{1}\n}", "func (*DirectiveUndelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{10}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{3}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*EmptyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_calendarfy_service_proto_rawDescGZIP(), []int{0}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{0}\n}", "func (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{8}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_msgType_proto_rawDescGZIP(), []int{0}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{8}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*WithWellKnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_testing_proto_rawDescGZIP(), []int{1}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{0}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*Hello) Descriptor() ([]byte, []int) {\n\treturn file_proto_laptopService_proto_rawDescGZIP(), []int{3}\n}", "func (*Metrics) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{0}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{0}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*EvictWritersResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{11}\n}", "func (*Ping) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{0}\n}", "func ProtoFromMessageDescriptor(d protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\ttype canProto interface {\n\t\tMessageDescriptorProto() *descriptorpb.DescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MessageDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.DescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToDescriptorProto(d)\n}", "func (*NoParams) Descriptor() ([]byte, []int) {\n\treturn file_basic_proto_rawDescGZIP(), []int{0}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_services_proto_rawDescGZIP(), []int{2}\n}", "func (*UnFreeze) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{11}\n}", "func (*AnyMessage) Descriptor() ([]byte, []int) {\n\treturn file_demo_proto_rawDescGZIP(), []int{0}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_grpcoin_proto_rawDescGZIP(), []int{10}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_test_proto_rawDescGZIP(), []int{0}\n}", "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*Simple) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{0}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_bench_proto_rawDescGZIP(), []int{0}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_protomessage_proto_rawDescGZIP(), []int{0}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_crypto_proto_rawDescGZIP(), []int{3}\n}", "func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\tp := &descriptorpb.FieldDescriptorProto{\n\t\tName: proto.String(string(field.Name())),\n\t\tNumber: proto.Int32(int32(field.Number())),\n\t\tLabel: descriptorpb.FieldDescriptorProto_Label(field.Cardinality()).Enum(),\n\t\tOptions: proto.Clone(field.Options()).(*descriptorpb.FieldOptions),\n\t}\n\tif field.IsExtension() {\n\t\tp.Extendee = fullNameOf(field.ContainingMessage())\n\t}\n\tif field.Kind().IsValid() {\n\t\tp.Type = descriptorpb.FieldDescriptorProto_Type(field.Kind()).Enum()\n\t}\n\tif field.Enum() != nil {\n\t\tp.TypeName = fullNameOf(field.Enum())\n\t}\n\tif field.Message() != nil {\n\t\tp.TypeName = fullNameOf(field.Message())\n\t}\n\tif field.HasJSONName() {\n\t\t// A bug in older versions of protoc would always populate the\n\t\t// \"json_name\" option for extensions when it is meaningless.\n\t\t// When it did so, it would always use the camel-cased field name.\n\t\tif field.IsExtension() {\n\t\t\tp.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))\n\t\t} else {\n\t\t\tp.JsonName = proto.String(field.JSONName())\n\t\t}\n\t}\n\tif field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {\n\t\tp.Proto3Optional = proto.Bool(true)\n\t}\n\tif field.HasDefault() {\n\t\tdef, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)\n\t\tif err != nil && field.DefaultEnumValue() != nil {\n\t\t\tdef = string(field.DefaultEnumValue().Name()) // occurs for unresolved enum values\n\t\t} else if err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%v: %v\", field.FullName(), err))\n\t\t}\n\t\tp.DefaultValue = proto.String(def)\n\t}\n\tif oneof := field.ContainingOneof(); oneof != nil {\n\t\tp.OneofIndex = proto.Int32(int32(oneof.Index()))\n\t}\n\treturn p\n}", "func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{10}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*Message5907) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{32}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_ghost_proto_rawDescGZIP(), []int{0}\n}", "func (*WithEnum) Descriptor() ([]byte, []int) {\n\treturn file_testproto_proto_rawDescGZIP(), []int{5}\n}", "func (*EvictWritersRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{10}\n}", "func (*WithOptional) Descriptor() ([]byte, []int) {\n\treturn file_testproto_proto_rawDescGZIP(), []int{1}\n}", "func (*Message12774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{0}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_common_proto_rawDescGZIP(), []int{0}\n}", "func (*WithOneOf) Descriptor() ([]byte, []int) {\n\treturn file_testproto_proto_rawDescGZIP(), []int{2}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*EmptyMessage) Descriptor() ([]byte, []int) {\n\treturn file_task_proto_rawDescGZIP(), []int{2}\n}", "func (*DefaultMessage) Descriptor() ([]byte, []int) {\n\treturn file_default_proto_rawDescGZIP(), []int{0}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*Ping) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_example_example_proto_rawDescGZIP(), []int{5}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_l3_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.70006037", "0.69941497", "0.68269813", "0.681359", "0.67958504", "0.6715465", "0.66984934", "0.66754323", "0.6671088", "0.66236264", "0.6619724", "0.6597582", "0.65604174", "0.6558394", "0.6557662", "0.65570986", "0.65459114", "0.65429693", "0.65423435", "0.6534779", "0.6523496", "0.6514215", "0.6512413", "0.6502692", "0.6490485", "0.64866644", "0.6484786", "0.64836067", "0.6480402", "0.647295", "0.64669377", "0.6464277", "0.6455599", "0.64513844", "0.64428145", "0.64416087", "0.6441402", "0.64396936", "0.64376104", "0.6436228", "0.6433807", "0.6430203", "0.6426366", "0.6425844", "0.64245737", "0.6417228", "0.64160186", "0.6414119", "0.64079773", "0.640777", "0.64049226", "0.640399", "0.6399755", "0.6398388", "0.6396242", "0.6396089", "0.63958824", "0.6393311", "0.639275", "0.6386295", "0.6382536", "0.63819677", "0.6379165", "0.6375047", "0.6370673", "0.6366477", "0.63663846", "0.63648427", "0.6364504", "0.63627917", "0.6356286", "0.63543195", "0.6354228", "0.63503176", "0.634647", "0.634429", "0.63440233", "0.6342352", "0.6341241", "0.633979", "0.63396573", "0.6337931", "0.63353825", "0.6334458", "0.63336354", "0.633281", "0.6332283", "0.6332261", "0.6329921", "0.63294363", "0.632921", "0.6328833", "0.63273746", "0.63253015", "0.6324482", "0.63213843", "0.63207245", "0.6320439", "0.63186604", "0.6317887", "0.6315449" ]
0.0
-1
Deprecated: Use Repository.ProtoReflect.Descriptor instead.
func (*Repository) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*SemanticTokensDelta) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{223}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*Ref) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{13}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{7}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*GetTeamById) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{8}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*InstanceMetadata) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{20}\n}", "func (*Trickle) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{4}\n}", "func (*SemanticTokensDeltaParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{222}\n}", "func (*DetachMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{22}\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (*MetadataProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{7}\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{4}\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*ExternalGrpcNode) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (*GetTeamByName) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{2}\n}", "func (*InstallSnapshotRequestProto_NotificationProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{19, 1}\n}", "func (*StaleReadRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{24}\n}", "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{0}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Repository) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{9}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateEntityRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{1}\n}", "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{18}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (*APILevel) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{4}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*Real) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{6}\n}", "func (*CredentialsProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{2}\n}", "func (*PasswordComplexityPolicyUpdate) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{38}\n}", "func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}", "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*ValidatorUpdates) Descriptor() ([]byte, []int) {\n\treturn file_core_abci_v1alpha1_abci_proto_rawDescGZIP(), []int{6}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{25}\n}", "func (*MetadataUpdateEventProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{7}\n}", "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{8}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*Changes) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{3}\n}", "func (*Changes) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{3}\n}", "func (*Dependency) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdateTeam) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{6}\n}", "func (*RelationTupleDelta) Descriptor() ([]byte, []int) {\n\treturn file_ory_keto_acl_v1alpha1_write_service_proto_rawDescGZIP(), []int{1}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*EvictWritersResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{11}\n}", "func (*Note) Descriptor() ([]byte, []int) {\n\treturn file_determined_project_v1_project_proto_rawDescGZIP(), []int{1}\n}", "func (*Undefined) Descriptor() ([]byte, []int) {\n\treturn file_rpc_rpc_proto_rawDescGZIP(), []int{3}\n}", "func (*RenewDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{6}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*ComputeRepositoryDiffRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22}\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*DeleteTeam) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{1}\n}", "func (*DirectiveUndelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{10}\n}", "func (*Code) Descriptor() ([]byte, []int) {\n\treturn file_internal_pkg_pb_ports_proto_rawDescGZIP(), []int{2}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (*Change) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*ApiListener) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v2_api_listener_proto_rawDescGZIP(), []int{0}\n}", "func (*DescribeInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{28}\n}", "func (*GrpcJsonTranscoder) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_grpc_json_grpc_json_proto_rawDescGZIP(), []int{0}\n}", "func (*LuaDescriptor) Descriptor() ([]byte, []int) {\n\treturn file_model_proto_rawDescGZIP(), []int{6}\n}", "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_protomessage_proto_rawDescGZIP(), []int{0}\n}", "func (*Api) Descriptor() ([]byte, []int) {\n\treturn file_metadata_metadata_proto_rawDescGZIP(), []int{7}\n}", "func (*ServerRpcProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{38}\n}", "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (*RoleInfoProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{42}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*PluginReference) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{2}\n}", "func (*ListMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{23}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}" ]
[ "0.68783855", "0.6843687", "0.68375736", "0.6735068", "0.6714124", "0.67126113", "0.67100394", "0.67075354", "0.6700952", "0.66977274", "0.6691201", "0.66736233", "0.6665403", "0.66508365", "0.6647841", "0.6630565", "0.66266453", "0.66193706", "0.6612832", "0.65966034", "0.6582172", "0.6582129", "0.6579082", "0.65752214", "0.65701854", "0.6566656", "0.65658325", "0.6562155", "0.65525067", "0.6549842", "0.6546123", "0.65455866", "0.65443337", "0.6543525", "0.65419847", "0.65417933", "0.65411335", "0.6539323", "0.6539119", "0.65366834", "0.6532481", "0.6526353", "0.65237063", "0.6522462", "0.6515023", "0.6511909", "0.6510741", "0.6509118", "0.65044236", "0.6503043", "0.65022403", "0.65015423", "0.6501175", "0.65001065", "0.6499116", "0.64989686", "0.64846295", "0.6484518", "0.64835733", "0.64807844", "0.64805", "0.64802176", "0.6476514", "0.64753485", "0.6475241", "0.6472831", "0.64702284", "0.64702284", "0.6468927", "0.6467618", "0.6467357", "0.6462744", "0.64627117", "0.6461826", "0.6461757", "0.64587176", "0.64567304", "0.6453738", "0.64519215", "0.64515764", "0.64471215", "0.6446277", "0.64425546", "0.6440895", "0.64393777", "0.64393777", "0.6438508", "0.6438017", "0.6436196", "0.64360917", "0.6432742", "0.64284486", "0.64258975", "0.6424889", "0.6424419", "0.64225835", "0.64224225", "0.642172", "0.64211375", "0.64200187", "0.6419668" ]
0.0
-1
Deprecated: Use RepositoryID.ProtoReflect.Descriptor instead.
func (*RepositoryID) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{2} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Ref) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{13}\n}", "func (*RepositoryNamedIdentification) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{10}\n}", "func (*Repository) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{9}\n}", "func (*RepositoryIdentification) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{11}\n}", "func (*InstanceMetadata) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{20}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{7}\n}", "func (*SetRepository) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{14}\n}", "func (*DetachMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{22}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*RepositoryDraft) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{2}\n}", "func (*ComputeRepositoryDiffRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*SemanticTokensDelta) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{223}\n}", "func (*Repository) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{0}\n}", "func (*GetTeamById) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1}\n}", "func (*GetRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{13}\n}", "func (*RepositoryVisibilityEnum) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{8}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (Repository_Format) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*DescribeRepositoryReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{13}\n}", "func (*DescribeInstanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{29}\n}", "func (*RegisterInstanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{8}\n}", "func (*DescribeInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{28}\n}", "func (*ResolveVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{25}\n}", "func (*GetRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{3}\n}", "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{0}\n}", "func (*ID) Descriptor() ([]byte, []int) {\n\treturn file_src_transport_grpc_proto_generics_proto_rawDescGZIP(), []int{0}\n}", "func (*Tag) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{17}\n}", "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_chat_proto_rawDescGZIP(), []int{1}\n}", "func (*FindRepositories) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{34}\n}", "func (RepositoryVisibilityEnum_RepositoryVisibility) EnumDescriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{8, 0}\n}", "func (*UpdateIpPermissionMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{14}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*RepoInfo) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{3}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*ListMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{23}\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*RenewDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{6}\n}", "func (*ListMetadataResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{24}\n}", "func (*Decl_IdentDecl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*SemanticTokensDeltaParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{222}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*AttachMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{21}\n}", "func (*DeleteRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{15}\n}", "func (*Repository) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{1}\n}", "func (*Driver) Descriptor() ([]byte, []int) {\n\treturn file_GrpcServices_auth_proto_rawDescGZIP(), []int{3}\n}", "func (*Metadata) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{18}\n}", "func (*DeleteRefRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{14}\n}", "func (*EvictWritersResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{11}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*FindRemoteRepositoryResponse) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{3}\n}", "func (*ID) Descriptor() ([]byte, []int) {\n\treturn file_proto_crud_crud_proto_rawDescGZIP(), []int{1}\n}", "func (*ProjectID) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{6}\n}", "func (*ProjectID) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{6}\n}", "func (*ComputeRepositoryDiffRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22, 0}\n}", "func (*SetRepository_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{14, 0}\n}", "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{1}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*GetTeamById_Response) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*SyncPinnedRepositoryResponse) Descriptor() ([]byte, []int) {\n\treturn file_pinnedRepository_pinnedRepository_proto_rawDescGZIP(), []int{2}\n}", "func (*FindRemoteRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{2}\n}", "func (*Dependency) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{16}\n}", "func (*RelationTupleDelta) Descriptor() ([]byte, []int) {\n\treturn file_ory_keto_acl_v1alpha1_write_service_proto_rawDescGZIP(), []int{1}\n}", "func (*CredentialsProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateRepoReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{5}\n}", "func (*InheritedPrefixMetadata) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{2}\n}", "func (*Trickle) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{4}\n}", "func (*PluginReference) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{2}\n}", "func (*GetRepositoryRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{13, 0}\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (*RepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{10}\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (*PinnedRepository) Descriptor() ([]byte, []int) {\n\treturn file_pinnedRepository_pinnedRepository_proto_rawDescGZIP(), []int{0}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*NewEpoch_RemoteEpochChange) Descriptor() ([]byte, []int) {\n\treturn file_msgs_msgs_proto_rawDescGZIP(), []int{25, 0}\n}", "func (*APILevel) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{4}\n}", "func (*PasswordComplexityPolicyUpdate) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{38}\n}", "func (*BlobDiff) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{7}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{4}\n}", "func (*RenameOptions) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{192}\n}", "func (*InstallSnapshotRequestProto_NotificationProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{19, 1}\n}", "func (*DescribeClientResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{31}\n}", "func (*Note) Descriptor() ([]byte, []int) {\n\treturn file_determined_project_v1_project_proto_rawDescGZIP(), []int{1}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*RenameRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{194}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*ProviderID) Descriptor() ([]byte, []int) {\n\treturn file_synerex_proto_rawDescGZIP(), []int{13}\n}", "func (*BySelectors) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{41}\n}", "func (*RevertRepositoryCommitsRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{33}\n}", "func (*DeleteRepositoryRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{15, 0}\n}", "func (*ExternalId) Descriptor() ([]byte, []int) {\n\treturn file_google_genomics_v1_annotations_proto_rawDescGZIP(), []int{4}\n}", "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{6}\n}", "func (*RawOp) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_quota_quotapb_update_accounts_proto_rawDescGZIP(), []int{1}\n}", "func (*ListRepositoryReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{3}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.68321776", "0.68248713", "0.67511714", "0.668972", "0.6668801", "0.66680187", "0.66493356", "0.66091496", "0.65678436", "0.6559239", "0.6551037", "0.6528242", "0.6506257", "0.6503224", "0.64981985", "0.6481601", "0.64746153", "0.64697844", "0.646644", "0.6431208", "0.64123875", "0.640457", "0.63918084", "0.6381052", "0.63794464", "0.63775194", "0.6372041", "0.63704044", "0.63661486", "0.6366005", "0.6365218", "0.63567144", "0.6354518", "0.6346562", "0.63459027", "0.6343524", "0.63375443", "0.63335186", "0.6328751", "0.63195527", "0.63170767", "0.63108593", "0.6308027", "0.6305663", "0.63039684", "0.6298324", "0.62983155", "0.6288452", "0.62873966", "0.6285973", "0.62784094", "0.62783325", "0.62770534", "0.6274196", "0.62702906", "0.62702906", "0.62645656", "0.62640387", "0.6261071", "0.6257543", "0.6254964", "0.62504274", "0.6250257", "0.62501174", "0.62485325", "0.623392", "0.6233118", "0.6231096", "0.62308675", "0.62297916", "0.6226134", "0.6225434", "0.6224652", "0.6221876", "0.6219863", "0.6217904", "0.62173975", "0.6215929", "0.6215395", "0.62135506", "0.6212154", "0.6211028", "0.621093", "0.62087846", "0.6205397", "0.6203223", "0.6201658", "0.6200698", "0.6197909", "0.61951345", "0.619447", "0.619378", "0.6190016", "0.6189099", "0.6188571", "0.6185839", "0.61844516", "0.61824024", "0.61799043", "0.6179833" ]
0.647775
16
Deprecated: Use ListRepositoryReq.ProtoReflect.Descriptor instead.
func (*ListRepositoryReq) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{3} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ListMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{23}\n}", "func (*ListRepositoriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{12}\n}", "func (*ListRefsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{15}\n}", "func (*ListRepositoriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{1}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{5}\n}", "func (*ListModelVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{88}\n}", "func (*ListNotificationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{63}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_accord_proto_rawDescGZIP(), []int{7}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{12}\n}", "func (*ListRepositoryRes) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{4}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateRepoReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{5}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{7}\n}", "func (*DescribeRepositoryReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{13}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{14}\n}", "func (*ListPodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{7}\n}", "func (*GetRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{13}\n}", "func (*ListIpPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{11}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{0}\n}", "func (*ListMetadataResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{24}\n}", "func (*IntegrationChangeHistoryListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{29}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*ComputeRepositoryDiffRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22}\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{0}\n}", "func (*RepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{10}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{1}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{10}\n}", "func (*ListModelTypesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{96}\n}", "func (*GetListRequest) Descriptor() ([]byte, []int) {\n\treturn file_parser_company_proto_rawDescGZIP(), []int{14}\n}", "func (*ListRefsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{16}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*FindRemoteRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{2}\n}", "func (*ListModelReferencesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{105}\n}", "func (*ListReleaseReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{13}\n}", "func (*ListCredentialsRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{22}\n}", "func (*ListVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{9}\n}", "func (*ListNodeSelectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{23}\n}", "func (*ReleaseNameListRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{21}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{2}\n}", "func (*ListStorageRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{11}\n}", "func (*ReleaseListRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{16}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRepositoriesRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{12, 0}\n}", "func (*ListWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{140}\n}", "func (*ListChannelMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{56}\n}", "func (*DeleteRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{15}\n}", "func (*GetRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{3}\n}", "func (*ListInstancesRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{9}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{6}\n}", "func (*ListPrefixRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{4}\n}", "func (*ListWeaveScopePodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_weavescope_services_proto_rawDescGZIP(), []int{1}\n}", "func (*GetListServersRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{18}\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{0}\n}", "func (*GetIosPlistRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{9}\n}", "func (*SimpleListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{6}\n}", "func (*ListRegistrationEntriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{46}\n}", "func (*ListSubscriptionRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_subscription_proto_rawDescGZIP(), []int{4}\n}", "func (*MemberLevelListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{47}\n}", "func (*SyncPinnedRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_pinnedRepository_pinnedRepository_proto_rawDescGZIP(), []int{1}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*ListNetworkOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_vpc_v1_network_service_proto_rawDescGZIP(), []int{15}\n}", "func (*ListNetworkTargetsRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{4}\n}", "func (*PeopleListRequest) Descriptor() ([]byte, []int) {\n\treturn file_sil_proto_rawDescGZIP(), []int{2}\n}", "func (*ListAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{2}\n}", "func (*ListReleaseNameRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{18}\n}", "func (*ListChartReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{27}\n}", "func (*ListPeopleRequest) Descriptor() ([]byte, []int) {\n\treturn file_people_proto_rawDescGZIP(), []int{3}\n}", "func (*GrowthChangeHistoryListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{20}\n}", "func (*WaitListsRequest) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{77}\n}", "func (*ProductsListRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_proto_productslist_products_list_proto_rawDescGZIP(), []int{0}\n}", "func (*ListCommitsRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{16}\n}", "func (*UserListRequest) Descriptor() ([]byte, []int) {\n\treturn file_presence_proto_rawDescGZIP(), []int{1}\n}", "func (*ListVariableReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{11}\n}", "func (*PollCredentialOffersRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{30}\n}", "func (*ListReportRequest) Descriptor() ([]byte, []int) {\n\treturn file_report_proto_rawDescGZIP(), []int{9}\n}", "func (*DetachMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{22}\n}", "func (*ResolveVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{25}\n}", "func (*MemberListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{2}\n}", "func (*ListNetworksRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{1}\n}", "func (*ListTagsRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{28}\n}", "func (*DeleteRefRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{14}\n}", "func (*ListLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{3}\n}", "func (*RevokeTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{17}\n}", "func (*SelectorVerificationsReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRevokedTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{13}\n}", "func (*ListControllerPlanningsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_plannings_services_proto_rawDescGZIP(), []int{8}\n}", "func (*ListTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{7}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ListConnectionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{20}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{4}\n}", "func (*ListDeviceRequest) Descriptor() ([]byte, []int) {\n\treturn file_device_proto_rawDescGZIP(), []int{0}\n}", "func (*GetWatchlistRequest) Descriptor() ([]byte, []int) {\n\treturn file_golang_pkg_proto_movies_movies_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateIpPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{10}\n}", "func (*ListGuildChannelsRequest) Descriptor() ([]byte, []int) {\n\treturn file_discord_v1_cache_proto_rawDescGZIP(), []int{2}\n}", "func (*GetClientListRequest) Descriptor() ([]byte, []int) {\n\treturn file_messaging_proto_rawDescGZIP(), []int{4}\n}" ]
[ "0.73137987", "0.72216994", "0.71340483", "0.71158785", "0.69697946", "0.6960516", "0.6959861", "0.6948829", "0.6934028", "0.6908448", "0.69048285", "0.690034", "0.68986243", "0.689512", "0.68887913", "0.68837196", "0.68708044", "0.68625325", "0.68586475", "0.6857217", "0.68469566", "0.68315244", "0.68184614", "0.6817829", "0.6816957", "0.68059987", "0.67956644", "0.67865884", "0.67798525", "0.67768294", "0.677461", "0.6766642", "0.6763213", "0.67548347", "0.6753135", "0.6748962", "0.67484576", "0.67477757", "0.6747773", "0.6746616", "0.67423314", "0.67410284", "0.67340887", "0.6729393", "0.6725142", "0.6724164", "0.6723736", "0.671546", "0.6714432", "0.67060906", "0.6702911", "0.6702277", "0.66980755", "0.6697367", "0.6684613", "0.66797566", "0.66759795", "0.667422", "0.6673895", "0.66738915", "0.66646856", "0.6664298", "0.6664133", "0.6658782", "0.6648001", "0.66479003", "0.6646913", "0.66453505", "0.6643581", "0.6643048", "0.66347784", "0.6632129", "0.66292876", "0.66215074", "0.66198397", "0.66181207", "0.6616842", "0.6611718", "0.6607748", "0.6603575", "0.65967786", "0.6595983", "0.6595492", "0.6594901", "0.65942943", "0.6590991", "0.6584193", "0.65840226", "0.6581837", "0.6581565", "0.65814227", "0.65801805", "0.65770453", "0.6573808", "0.6570653", "0.65698993", "0.6568904", "0.6568293", "0.6567575", "0.65675193" ]
0.75993085
0
Deprecated: Use ListRepositoryRes.ProtoReflect.Descriptor instead.
func (*ListRepositoryRes) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{4} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ListRepositoryReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{3}\n}", "func (*ListMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{23}\n}", "func (*ListMetadataResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{24}\n}", "func (*ListRefsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{16}\n}", "func (*ListRepositoriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{1}\n}", "func (*ListRepositoriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{12}\n}", "func (*ListRefsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{15}\n}", "func (*List) Descriptor() ([]byte, []int) {\n\treturn file_proto_ssql_proto_rawDescGZIP(), []int{11}\n}", "func (*ListRepositoriesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{2}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{4}\n}", "func (*ListRepositoriesRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{12, 0}\n}", "func (*FindRepositories) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{34}\n}", "func (*Repository) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{9}\n}", "func (RepositoryVisibilityEnum_RepositoryVisibility) EnumDescriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{8, 0}\n}", "func (*ListReleaseRes) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{14}\n}", "func (*Ref) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{13}\n}", "func (*FindRepositories_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{34, 0}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{15}\n}", "func (*RepositoryVisibilityEnum) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{8}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{13}\n}", "func (*ListVariableRes) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{12}\n}", "func (*FindRemoteRepositoryResponse) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{3}\n}", "func (*SetRepository) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{14}\n}", "func (*ListInstancesResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{10}\n}", "func (*IntegrationChangeHistoryListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{31}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*ListIpPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{11}\n}", "func (*ListOptions) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{11}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{1}\n}", "func (*SyncPinnedRepositoryResponse) Descriptor() ([]byte, []int) {\n\treturn file_pinnedRepository_pinnedRepository_proto_rawDescGZIP(), []int{2}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{7}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*RegistrationListRes) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{24}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*InstanceMetadata) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{20}\n}", "func (*ListNotification) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_notification_proto_rawDescGZIP(), []int{1}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{7}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{1}\n}", "func (*ListInstancesRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{9}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{6}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{1}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{3}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{17}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{3}\n}", "func (Repository_Format) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{4}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{8}\n}", "func (*FlagsListResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{22}\n}", "func (*RepositoryDraft) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_reference_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_accord_proto_rawDescGZIP(), []int{7}\n}", "func (*DescribeRepositoryReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{13}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{3}\n}", "func (*RegisterInstanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{8}\n}", "func (*GetListResponse) Descriptor() ([]byte, []int) {\n\treturn file_parser_company_proto_rawDescGZIP(), []int{15}\n}", "func (*ComputeRepositoryDiffRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22}\n}", "func (*ListArtifactStructType) Descriptor() ([]byte, []int) {\n\treturn file_ml_metadata_proto_metadata_store_proto_rawDescGZIP(), []int{16}\n}", "func (*ListNotificationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{63}\n}", "func (*GetRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{13}\n}", "func (*ListPodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{7}\n}", "func (*Repository) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{0}\n}", "func (*ListProjectsResponse) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{1}\n}", "func (*PortList) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{2}\n}", "func (*DescribeInstanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{29}\n}", "func (*ListModelReferencesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{105}\n}", "func (*ListPodsResponse) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{8}\n}", "func (*ListModelVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{88}\n}", "func (*ListNodeSelectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{23}\n}", "func (*SubscriptionList) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{12}\n}", "func (*ListResonse) Descriptor() ([]byte, []int) {\n\treturn file_cache_proto_rawDescGZIP(), []int{4}\n}", "func (*ListNodeSelectorsResponse) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{24}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{7}\n}", "func (*Type_ListType) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateIpPermissionMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{14}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{12}\n}", "func (*RunList) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{6}\n}", "func (*FindRemoteRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{2}\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{0}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*ReleaseListResponse) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{17}\n}", "func (*GetRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{3}\n}", "func (*SubscriptionList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{103}\n}", "func (*SetRepository_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{14, 0}\n}", "func (*Resource) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{4}\n}", "func (*RepositoryNamedIdentification) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{10}\n}", "func (*ListService) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{6}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{7}\n}", "func (*DetachMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{22}\n}", "func (*UserListByIdsRep) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_proto_rawDescGZIP(), []int{12}\n}", "func (*MemberLevelListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{49}\n}", "func (*ReadTensorboardUsageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{7}\n}", "func (*OperationsListResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{51}\n}", "func (*ListRegistrationEntriesResponse) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{47}\n}", "func (*LeaderboardList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{50}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{10}\n}", "func (*GetListServersRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{18}\n}" ]
[ "0.702423", "0.6973052", "0.69654864", "0.6897099", "0.68097436", "0.67948705", "0.6777074", "0.6746349", "0.67213786", "0.668595", "0.6660488", "0.66343534", "0.65886915", "0.65775126", "0.65540314", "0.65510374", "0.6541655", "0.651642", "0.6510909", "0.6510901", "0.650161", "0.6494593", "0.64935195", "0.64923024", "0.6469338", "0.64681154", "0.6467863", "0.64619243", "0.646142", "0.64480144", "0.644486", "0.6444526", "0.64363545", "0.64333355", "0.64314693", "0.6430751", "0.6430325", "0.6429717", "0.6428138", "0.6427618", "0.6427161", "0.64264375", "0.642475", "0.6423276", "0.6421993", "0.64219487", "0.64209074", "0.64196736", "0.64149845", "0.6411303", "0.64061755", "0.64050573", "0.640342", "0.6400732", "0.63982075", "0.6392678", "0.6389589", "0.63869905", "0.63855505", "0.6384645", "0.6381376", "0.6377445", "0.6374867", "0.63743293", "0.6367827", "0.6366193", "0.63604945", "0.63599765", "0.6358973", "0.6358797", "0.6351663", "0.63514686", "0.6348778", "0.6347781", "0.634558", "0.6344705", "0.63433456", "0.63409036", "0.633264", "0.6331624", "0.6330982", "0.63234377", "0.6322296", "0.6320312", "0.6318112", "0.6317079", "0.6316992", "0.631463", "0.6311785", "0.6308693", "0.6305048", "0.63047165", "0.63024676", "0.63024193", "0.6300963", "0.6300939", "0.6295663", "0.62945855", "0.6290005", "0.62890077" ]
0.734723
0
Deprecated: Use Job.ProtoReflect.Descriptor instead.
func (*Job) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{5} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{4}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{6}\n}", "func (*MutateBatchJobResult) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{3}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{2}\n}", "func (*MutateBatchJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{0}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*JobDetail) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{3}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*RunDisconnectedServicesJobReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{15}\n}", "func (*JobInfo) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{22}\n}", "func (*JobId) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{0}\n}", "func (*RejectedJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{18}\n}", "func (*BatchJobOperation) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{1}\n}", "func (*JobMessage) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{0}\n}", "func (*RunBatchJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{3}\n}", "func (*Notification_BenchmarkJobMessage) Descriptor() ([]byte, []int) {\n\treturn file_isuxportal_resources_notification_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*GetJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{5}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*JobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{1}\n}", "func (*BatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3}\n}", "func (*ListJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{3}\n}", "func (*RunDeleteDisconnectedServicesJobReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{19}\n}", "func (*MutateBatchJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{2}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*AddBatchJobOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{5}\n}", "func (*RunJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{0}\n}", "func (*AddJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{2}\n}", "func (*MessageWithComponents) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{61}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*Components) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{1}\n}", "func (*CancelJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{3}\n}", "func (*JobResources) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{3}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*DeleteJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{4}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*BatchJobResult) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{9}\n}", "func (*AddJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{1}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_job_proto_rawDescGZIP(), []int{0}\n}", "func (*CancelledJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{14}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*BatchPredictionJob) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_batch_prediction_job_proto_rawDescGZIP(), []int{0}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*Trigger) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{37}\n}", "func (*CreateJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{2}\n}", "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*RevokeJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{21}\n}", "func (*NetworkTrigger) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{16}\n}", "func (*ParDoPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{8}\n}", "func (*JobPubSub) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{20}\n}", "func (*DeleteJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{19}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*TimerFamilySpec) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{17}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*JobReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{1}\n}", "func (*PeriodicJobInfo) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{12}\n}", "func (*ListJobReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{7}\n}", "func (*JobFeatures) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{4}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*GetJobsReply) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{7}\n}", "func (*CancelJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{16}\n}", "func (*ReceiveBenchmarkJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_bench_receiving_proto_rawDescGZIP(), []int{0}\n}", "func (*ScheduleBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{6}\n}", "func (*ProposeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{16}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*TaskUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{2}\n}", "func (*BatchRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*StandardRunnerProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{55}\n}", "func (*ApprovedJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{8}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*EventBatchProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{1}\n}", "func (*GPULabelRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{10}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*NewJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{4}\n}", "func (*PlanChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*UpdateRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{11}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*PostConceptMappingJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{44}\n}", "func (*StandardCoders) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{29}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*ProcessPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{52}\n}", "func (*DownlinkQueueRequest) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{17}\n}", "func (*Schedule) Descriptor() ([]byte, []int) {\n\treturn file_src_grpc_pipeline_proto_rawDescGZIP(), []int{2}\n}", "func (*Checkpoint) Descriptor() ([]byte, []int) {\n\treturn file_msgs_msgs_proto_rawDescGZIP(), []int{19}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*ReadPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{19}\n}", "func (*NewJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{3}\n}", "func (JobChangeType) EnumDescriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{3}\n}", "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*TimestampTransform) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{38}\n}", "func (*JobTriggers) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{8}\n}" ]
[ "0.68730223", "0.68383205", "0.6805697", "0.6785015", "0.6751275", "0.6734359", "0.6731901", "0.67313254", "0.67201996", "0.67201066", "0.67061776", "0.6701944", "0.66931605", "0.668313", "0.6682389", "0.6678311", "0.6670112", "0.666552", "0.6661476", "0.6650469", "0.6648507", "0.664787", "0.6637468", "0.66345954", "0.6631058", "0.66299206", "0.66221756", "0.66193074", "0.66139656", "0.6612685", "0.6612377", "0.66097814", "0.660365", "0.66001874", "0.6592066", "0.6590102", "0.65868276", "0.6586813", "0.6583359", "0.658015", "0.6572869", "0.65641594", "0.65638113", "0.6558765", "0.6553462", "0.6547254", "0.6541562", "0.65330786", "0.65320253", "0.6529557", "0.652344", "0.6503362", "0.64968544", "0.6494766", "0.64933276", "0.6482299", "0.6479059", "0.64780617", "0.6470158", "0.6468457", "0.6465969", "0.6461925", "0.6460619", "0.6456096", "0.64510703", "0.6448234", "0.6447856", "0.6447044", "0.64452636", "0.64322793", "0.6430889", "0.6429609", "0.64249235", "0.6423418", "0.64213985", "0.64162886", "0.6415257", "0.64093953", "0.6408587", "0.6407019", "0.64016247", "0.64012814", "0.64003044", "0.6398577", "0.63962847", "0.6393537", "0.6392813", "0.6392172", "0.63839215", "0.6380962", "0.63800716", "0.6377598", "0.6375409", "0.6371658", "0.63711065", "0.63709664", "0.63697016", "0.63695955", "0.6366249", "0.6365508" ]
0.6516442
51
Deprecated: Use JobID.ProtoReflect.Descriptor instead.
func (*JobID) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{6} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*JobId) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{0}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{4}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{6}\n}", "func (*MutateBatchJobResult) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{3}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{2}\n}", "func (*JobDetail) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{3}\n}", "func (*JobInfo) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{22}\n}", "func (*RunDisconnectedServicesJobReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{15}\n}", "func (*MutateBatchJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{0}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*JobMessage) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{0}\n}", "func (*BatchJobOperation) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{1}\n}", "func (*RunDeleteDisconnectedServicesJobReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{19}\n}", "func (*MutateBatchJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{2}\n}", "func (*RunBatchJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Notification_BenchmarkJobMessage) Descriptor() ([]byte, []int) {\n\treturn file_isuxportal_resources_notification_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*ExecutableStagePayload_TimerFamilyId) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{62, 3}\n}", "func (*RejectedJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{12}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*DeleteJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{4}\n}", "func (*BatchJobResult) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{9}\n}", "func (*AddJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{2}\n}", "func (*JobResources) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{18}\n}", "func (*GetJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{5}\n}", "func (*RevokeJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{21}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_job_proto_rawDescGZIP(), []int{0}\n}", "func (*JobPubSub) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{20}\n}", "func (*AddBatchJobOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{5}\n}", "func (*CancelJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{3}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*ListJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{3}\n}", "func (*RunJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{0}\n}", "func (*BatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3}\n}", "func (*MessageWithComponents) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{61}\n}", "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_my_task_my_task_proto_rawDescGZIP(), []int{2}\n}", "func (*BatchPredictionJob) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_batch_prediction_job_proto_rawDescGZIP(), []int{0}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*Components) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{1}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{5}\n}", "func (*PeriodicJobInfo) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{12}\n}", "func (*JobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{19}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*Request_Workers_ID) Descriptor() ([]byte, []int) {\n\treturn file_proto_work_proto_rawDescGZIP(), []int{5}\n}", "func (*GetJobsReply) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{7}\n}", "func (*JobReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{1}\n}", "func (*JobFeatures) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{4}\n}", "func (*TimerFamilySpec) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{17}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*CreateJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{2}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*CancelledJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{14}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*CancelJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{16}\n}", "func (*AddJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{1}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*NewJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{4}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*Trigger) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{37}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*ParDoPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{8}\n}", "func (*TaskRequestID) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_tasklist_server_proto_rawDescGZIP(), []int{1}\n}", "func (*Message6054) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{23}\n}", "func (*JobReply) Descriptor() ([]byte, []int) {\n\treturn file_job_proto_rawDescGZIP(), []int{1}\n}", "func (*ListJobReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{7}\n}", "func (*AddBatchJobOperationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{6}\n}", "func (JobChangeType) EnumDescriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{3}\n}", "func (*ScheduleBuildRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{6}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*TimestampTransform) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{38}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*ApprovedJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{9}\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*JobFile) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{5}\n}", "func (*JobTriggers) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{8}\n}", "func (*Message12774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{0}\n}", "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*Message7919) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{21}\n}", "func (*StandardRunnerProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{55}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*EventBatchProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{1}\n}", "func (*NetworkTrigger) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{16}\n}", "func (*Primitive) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{15}\n}", "func (*StandardCoders) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{29}\n}", "func (*PlanChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*Message3850) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{14}\n}", "func (*ApprovedJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{8}\n}", "func (*Message7865) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{15}\n}", "func (*ListJobsResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{4}\n}", "func (*ProcessPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{52}\n}" ]
[ "0.6843426", "0.6759486", "0.6712549", "0.66921514", "0.66482294", "0.66406596", "0.66044396", "0.65817815", "0.6566834", "0.6542544", "0.653092", "0.65233004", "0.652208", "0.6515414", "0.65150124", "0.65135664", "0.65102345", "0.64974326", "0.6486138", "0.64722306", "0.64707357", "0.6461232", "0.6452168", "0.644776", "0.6436054", "0.64340734", "0.64334095", "0.64298624", "0.64290106", "0.64228046", "0.64211124", "0.64175165", "0.6412693", "0.6406984", "0.6398201", "0.6389918", "0.63804966", "0.63761985", "0.6374858", "0.636368", "0.63606477", "0.6359641", "0.63573796", "0.6356436", "0.635616", "0.63560885", "0.6354364", "0.63501745", "0.6346953", "0.6333657", "0.63224566", "0.63209236", "0.631826", "0.6316491", "0.63158655", "0.631298", "0.6308683", "0.63061607", "0.62972516", "0.62927467", "0.62920326", "0.6290926", "0.6282428", "0.6280157", "0.6276734", "0.6258622", "0.6240097", "0.6236404", "0.6236152", "0.62305045", "0.6229145", "0.62275106", "0.62247694", "0.62236947", "0.6219571", "0.6214434", "0.6212078", "0.62070924", "0.62005365", "0.6199288", "0.6196725", "0.61856383", "0.61839896", "0.6182533", "0.61811215", "0.61807144", "0.6180326", "0.6179585", "0.6178638", "0.61781186", "0.6178029", "0.6176072", "0.6175407", "0.61750895", "0.61739665", "0.6170745", "0.61698174", "0.61695826", "0.6168374", "0.6167819" ]
0.6656509
4
Deprecated: Use ListJobReq.ProtoReflect.Descriptor instead.
func (*ListJobReq) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{7} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ListJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{3}\n}", "func (*ListBatchJobResultsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{7}\n}", "func (*GetJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{5}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{5}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*ListScheduledWorkloadsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_protoc_api_list_scheduled_workloads_request_message_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*RunDisconnectedServicesJobReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{15}\n}", "func (*ListJobsResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{4}\n}", "func (*AddBatchJobOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{5}\n}", "func (*ListTimersRequest) Descriptor() ([]byte, []int) {\n\treturn file_list_timers_proto_rawDescGZIP(), []int{0}\n}", "func (*RejectedJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{12}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{14}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{6}\n}", "func (*ListProofRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{34}\n}", "func (*RunDeleteDisconnectedServicesJobReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{19}\n}", "func (*MutateBatchJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{0}\n}", "func (*WaitListsRequest) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{77}\n}", "func (*BatchRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*BatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{3}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*RunBatchJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ListJobRes) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{8}\n}", "func (*CancelJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{3}\n}", "func (*SimpleListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{6}\n}", "func (*WatchProvisioningApprovalRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{7}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_accord_proto_rawDescGZIP(), []int{7}\n}", "func (*ClientBatchListRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_client_batch_pb2_client_batch_proto_rawDescGZIP(), []int{0}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*ListProvisioningApprovalRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{3}\n}", "func (*ApprovedJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{18}\n}", "func (*ListThingsRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_service_proto_rawDescGZIP(), []int{4}\n}", "func (*CancelClusJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{12}\n}", "func (*ListTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{153}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*JobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{1}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*WaitListRequest) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{78}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{4}\n}", "func (*AddJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{1}\n}", "func (*PostConceptMappingJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{44}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{1}\n}", "func (*GetClientListRequest) Descriptor() ([]byte, []int) {\n\treturn file_messaging_proto_rawDescGZIP(), []int{4}\n}", "func (*ListModelVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{88}\n}", "func (*GetJobStateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{2}\n}", "func (*CancelledJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{14}\n}", "func (*GetListRequest) Descriptor() ([]byte, []int) {\n\treturn file_parser_company_proto_rawDescGZIP(), []int{14}\n}", "func (*ListModelReferencesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{105}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{3}\n}", "func (*ListConversationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{6}\n}", "func (*BatchUpdateReferencesRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_icas_icas_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{3}\n}", "func (*ListNotificationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{63}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{7}\n}", "func (*ListTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{0}\n}", "func (*RunJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{0}\n}", "func (*ListModelEvaluationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{19}\n}", "func (*ListPodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{7}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{0}\n}", "func (*GetJobsReply) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{7}\n}", "func (*GrowthChangeHistoryListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{20}\n}", "func (*ListChartReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{27}\n}", "func (*BatchGetProvisioningApprovalRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{1}\n}", "func (*GetMengerListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_menger_menger_proto_rawDescGZIP(), []int{13}\n}", "func (*WatchProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{5}\n}", "func (*MutateBatchJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{4}\n}", "func (*ScheduleWorkloadRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_protoc_api_schedule_workload_request_message_proto_rawDescGZIP(), []int{0}\n}", "func (*ListVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{9}\n}", "func (*BatchUpdateIngressRulesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{22}\n}", "func (*ProductsListRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_proto_productslist_products_list_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRulesRequest) Descriptor() ([]byte, []int) {\n\treturn file_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*RevokeJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{21}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*WatchLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{7}\n}", "func (*MutateBatchJobResult) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{3}\n}", "func (*ListLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{3}\n}", "func (*ListReportRequest) Descriptor() ([]byte, []int) {\n\treturn file_report_proto_rawDescGZIP(), []int{9}\n}", "func (*ListKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{70}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{10}\n}", "func (*MemberTaskListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{119}\n}", "func (*PluginListRequest) Descriptor() ([]byte, []int) {\n\treturn file_plugin_proto_rawDescGZIP(), []int{7}\n}", "func (*ListBatchJobResultsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{8}\n}", "func (*ListLeaderboardRecordsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{61}\n}", "func (*ListIngressRulesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{20}\n}", "func (*ListApikeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ListTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{7}\n}", "func (*CancelAllJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{4}\n}", "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*IntegrationChangeHistoryListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{29}\n}", "func (*GetJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{6}\n}", "func (*WatchLimitRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{5}\n}", "func (*GetListServersRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{18}\n}", "func (*TasksListRequest) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{2}\n}" ]
[ "0.7615721", "0.7097827", "0.7036084", "0.6987018", "0.6931635", "0.6919937", "0.69092584", "0.68779176", "0.6857533", "0.68378437", "0.6824317", "0.681413", "0.6808692", "0.68012184", "0.67888135", "0.678158", "0.6770477", "0.67660964", "0.67263854", "0.6692397", "0.6688013", "0.66863364", "0.6683824", "0.6682858", "0.6674408", "0.6661591", "0.66446936", "0.6623658", "0.66172194", "0.66162056", "0.6613643", "0.6595268", "0.6591197", "0.6584725", "0.6569804", "0.6569292", "0.6564783", "0.6556901", "0.655035", "0.65500337", "0.65488464", "0.65375876", "0.6532796", "0.65299845", "0.6525475", "0.6523994", "0.65227425", "0.6521638", "0.6521205", "0.6500985", "0.6495546", "0.64931995", "0.64905715", "0.64886767", "0.648388", "0.6483382", "0.6479993", "0.64771616", "0.6472035", "0.6471805", "0.64524364", "0.64484143", "0.64463687", "0.6444814", "0.6443936", "0.644214", "0.6439938", "0.64398116", "0.64354676", "0.64342487", "0.64278626", "0.64250606", "0.6424359", "0.6424018", "0.6415698", "0.64135796", "0.6412668", "0.6412542", "0.6410519", "0.64072984", "0.6404831", "0.64013255", "0.6398987", "0.63945204", "0.6391098", "0.63903326", "0.6388762", "0.6381386", "0.63803273", "0.63753235", "0.6373257", "0.63730216", "0.6371386", "0.6366825", "0.6366025", "0.6365325", "0.6364127", "0.63602644", "0.6357536", "0.6350838" ]
0.75819296
1
Deprecated: Use ListJobRes.ProtoReflect.Descriptor instead.
func (*ListJobRes) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{8} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ListJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{3}\n}", "func (*ListJobReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{7}\n}", "func (*ListJobsResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{4}\n}", "func (*ListBatchJobResultsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{7}\n}", "func (*MutateBatchJobResult) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{3}\n}", "func (*ListBatchJobResultsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{8}\n}", "func (*RevokeJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{21}\n}", "func (*GetJobsReply) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{7}\n}", "func (*BatchJobResult) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{9}\n}", "func (*JobResources) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{3}\n}", "func (*RunDisconnectedServicesJobReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{15}\n}", "func (*ListScheduledWorkloadsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_protoc_api_list_scheduled_workloads_request_message_proto_rawDescGZIP(), []int{0}\n}", "func (*MutateBatchJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{2}\n}", "func (*ListTimersRequest) Descriptor() ([]byte, []int) {\n\treturn file_list_timers_proto_rawDescGZIP(), []int{0}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{4}\n}", "func (*GetJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{5}\n}", "func (*RunDeleteDisconnectedServicesJobReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{19}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*RejectedJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{13}\n}", "func (*RejectedJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{12}\n}", "func (*AddJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{19}\n}", "func (*ListMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{15}\n}", "func (*AddBatchJobOperationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{6}\n}", "func (*BatchJobOperation) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{1}\n}", "func (*JobReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobmanager_proto_rawDescGZIP(), []int{1}\n}", "func (*ApprovedJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{9}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{6}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{4}\n}", "func (*AddBatchJobOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{5}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*JobDetail) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{3}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*RunDisconnectedServicesJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{16}\n}", "func (*BatchDedicatedResources) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1beta1_machine_resources_proto_rawDescGZIP(), []int{3}\n}", "func (*RunBatchJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*CancelledJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{15}\n}", "func (*Notification_BenchmarkJobMessage) Descriptor() ([]byte, []int) {\n\treturn file_isuxportal_resources_notification_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*PeriodicJobInfo) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{12}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{6}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{2}\n}", "func (*ListTimersResponse) Descriptor() ([]byte, []int) {\n\treturn file_list_timers_proto_rawDescGZIP(), []int{1}\n}", "func (*RunDeleteDisconnectedServicesJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{20}\n}", "func (*MutateBatchJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_services_batch_job_service_proto_rawDescGZIP(), []int{0}\n}", "func (*WaitListsRequest) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{77}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (TryJob_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{14}\n}", "func (*JobReply) Descriptor() ([]byte, []int) {\n\treturn file_job_proto_rawDescGZIP(), []int{1}\n}", "func (*ListTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{153}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{6}\n}", "func (*JobId) Descriptor() ([]byte, []int) {\n\treturn file_proto_jobproc_worker_proto_rawDescGZIP(), []int{0}\n}", "func (*List) Descriptor() ([]byte, []int) {\n\treturn file_proto_ssql_proto_rawDescGZIP(), []int{11}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{3}\n}", "func (*FinishedInvocationList) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_internal_db_proto_rawDescGZIP(), []int{1}\n}", "func (*GetJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{7}\n}", "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*FlagsListResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{22}\n}", "func (*PostConceptMappingJobsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{44}\n}", "func (*CreateJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{2}\n}", "func (*ProposeJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{17}\n}", "func (*JobMessage) Descriptor() ([]byte, []int) {\n\treturn file_pkg_manager_http_grpc_job_proto_rawDescGZIP(), []int{0}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_accord_proto_rawDescGZIP(), []int{7}\n}", "func (*GetListServersRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{18}\n}", "func (*JobInfo) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{22}\n}", "func (*ReceiveBenchmarkJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_bench_receiving_proto_rawDescGZIP(), []int{1}\n}", "func (*ListModelReferencesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{105}\n}", "func (*BatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{3}\n}", "func (*ListNotification) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_notification_proto_rawDescGZIP(), []int{1}\n}", "func (JobType) EnumDescriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{5}\n}", "func (*ListRulesRequest) Descriptor() ([]byte, []int) {\n\treturn file_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*ListTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{0}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (*ListLeaderboardRecordsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{61}\n}", "func (Retry_Conf_Grpc_RetryOn) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 3, 0}\n}", "func (*ChangeReport) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{6}\n}", "func (*ListMetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*MultiConceptMappingJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{47}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_job_proto_rawDescGZIP(), []int{0}\n}", "func (*WaitListResponse) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{79}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*TryJob) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{1}\n}", "func (*CancelClusJobsReply) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{13}\n}", "func (*BatchResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{4}\n}", "func (*JobFeatures) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_job_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{18}\n}", "func (*PluginListRequest) Descriptor() ([]byte, []int) {\n\treturn file_plugin_proto_rawDescGZIP(), []int{7}\n}", "func (*RegistrationListRes) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{24}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*NewJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{4}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{4}\n}", "func (*Job) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{5}\n}", "func (TryJob_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{1, 1}\n}" ]
[ "0.71542174", "0.7084673", "0.70369273", "0.6963372", "0.6837766", "0.67902213", "0.6754233", "0.67203486", "0.66875696", "0.66731966", "0.66695327", "0.66659844", "0.6660195", "0.66439104", "0.66189617", "0.66168547", "0.6597521", "0.6573736", "0.65519154", "0.6539392", "0.65354234", "0.6526745", "0.652067", "0.65187734", "0.6516527", "0.6502582", "0.6483641", "0.64575934", "0.6445682", "0.64313823", "0.64292455", "0.6424732", "0.6422292", "0.64098275", "0.6406528", "0.6393624", "0.6392143", "0.6387365", "0.6380746", "0.6376143", "0.6376087", "0.6373523", "0.63664836", "0.6362359", "0.63576347", "0.6356432", "0.6333596", "0.63301146", "0.63277704", "0.63277185", "0.6327642", "0.6318567", "0.6317996", "0.6313141", "0.6304122", "0.6303218", "0.62903035", "0.62896764", "0.6289289", "0.62891555", "0.6287979", "0.6282203", "0.6281544", "0.6280076", "0.6276984", "0.62714726", "0.6270108", "0.6270082", "0.62657535", "0.625994", "0.6252817", "0.6246291", "0.6238839", "0.6237658", "0.6233476", "0.6228247", "0.62274253", "0.622541", "0.6221088", "0.6219295", "0.62171584", "0.62131876", "0.62090135", "0.62088805", "0.6205791", "0.6205725", "0.62041235", "0.6204002", "0.6199773", "0.6194993", "0.6190925", "0.6189228", "0.61854905", "0.618235", "0.6181854", "0.61810565", "0.61803544", "0.6179427", "0.6178322", "0.6174971" ]
0.73013926
0
Deprecated: Use Variable.ProtoReflect.Descriptor instead.
func (*Variable) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{9} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{3}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_synthetics_proto_rawDescGZIP(), []int{2}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{7}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{7}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*DirectiveUndelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{10}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*DirectiveCreateValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{7}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{4}\n}", "func (*ListVariableReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{11}\n}", "func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\tp := &descriptorpb.FieldDescriptorProto{\n\t\tName: proto.String(string(field.Name())),\n\t\tNumber: proto.Int32(int32(field.Number())),\n\t\tLabel: descriptorpb.FieldDescriptorProto_Label(field.Cardinality()).Enum(),\n\t\tOptions: proto.Clone(field.Options()).(*descriptorpb.FieldOptions),\n\t}\n\tif field.IsExtension() {\n\t\tp.Extendee = fullNameOf(field.ContainingMessage())\n\t}\n\tif field.Kind().IsValid() {\n\t\tp.Type = descriptorpb.FieldDescriptorProto_Type(field.Kind()).Enum()\n\t}\n\tif field.Enum() != nil {\n\t\tp.TypeName = fullNameOf(field.Enum())\n\t}\n\tif field.Message() != nil {\n\t\tp.TypeName = fullNameOf(field.Message())\n\t}\n\tif field.HasJSONName() {\n\t\t// A bug in older versions of protoc would always populate the\n\t\t// \"json_name\" option for extensions when it is meaningless.\n\t\t// When it did so, it would always use the camel-cased field name.\n\t\tif field.IsExtension() {\n\t\t\tp.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))\n\t\t} else {\n\t\t\tp.JsonName = proto.String(field.JSONName())\n\t\t}\n\t}\n\tif field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {\n\t\tp.Proto3Optional = proto.Bool(true)\n\t}\n\tif field.HasDefault() {\n\t\tdef, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)\n\t\tif err != nil && field.DefaultEnumValue() != nil {\n\t\t\tdef = string(field.DefaultEnumValue().Name()) // occurs for unresolved enum values\n\t\t} else if err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%v: %v\", field.FullName(), err))\n\t\t}\n\t\tp.DefaultValue = proto.String(def)\n\t}\n\tif oneof := field.ContainingOneof(); oneof != nil {\n\t\tp.OneofIndex = proto.Int32(int32(oneof.Index()))\n\t}\n\treturn p\n}", "func (*DirectiveDelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{9}\n}", "func (*Primitive) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{15}\n}", "func (*VariableID) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{10}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{13}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*ApiListener) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v2_api_listener_proto_rawDescGZIP(), []int{0}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*DirectiveEditValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{8}\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*VectorClock) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_l3_proto_rawDescGZIP(), []int{3}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*Undefined) Descriptor() ([]byte, []int) {\n\treturn file_rpc_rpc_proto_rawDescGZIP(), []int{3}\n}", "func (*CLRMetric) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{1}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*SemanticTokensDelta) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{223}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*Vector) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*LanguageDetectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_language_proto_rawDescGZIP(), []int{1}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{25}\n}", "func (*Preferences) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{8}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{4, 0}\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*PedidoPyme) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{1}\n}", "func (*TriggerBlockReportResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{17}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*GenerateMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{1}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*Verdict) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_addressvalidation_v1_address_validation_service_proto_rawDescGZIP(), []int{5}\n}", "func (*TracingTagLiteral) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{4}\n}", "func (*TracingTagLiteral) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{4}\n}", "func (*Decl_IdentDecl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*Decl_FunctionDecl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*ParamType) Descriptor() ([]byte, []int) {\n\treturn file_keepsake_proto_rawDescGZIP(), []int{22}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*Message7865) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{15}\n}", "func (*Ref_Foo) Descriptor() ([]byte, []int) {\n\treturn file_constructs_input_proto_rawDescGZIP(), []int{11, 1}\n}", "func (*TalkVoice) Descriptor() ([]byte, []int) {\n\treturn file_msgdata_proto_rawDescGZIP(), []int{26}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*ListVariableRes) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{12}\n}", "func (*CancelDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{8}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}" ]
[ "0.7069272", "0.6949201", "0.6692112", "0.6672231", "0.6653387", "0.6618355", "0.6558401", "0.65531915", "0.6534766", "0.64856", "0.6484012", "0.64780563", "0.64625686", "0.64596546", "0.6448988", "0.6426956", "0.64212537", "0.6388587", "0.6385581", "0.6384995", "0.63774407", "0.6366416", "0.63608235", "0.6359899", "0.6350841", "0.63463557", "0.6344069", "0.6341418", "0.6339451", "0.6338568", "0.6328776", "0.63264024", "0.6314212", "0.6309859", "0.62980753", "0.62956965", "0.62882453", "0.6287262", "0.6283513", "0.62714064", "0.62700075", "0.6267106", "0.6264259", "0.62630755", "0.62600785", "0.6257993", "0.62568104", "0.62540793", "0.6247919", "0.6243163", "0.6242775", "0.6238776", "0.62358755", "0.6235318", "0.6227225", "0.6224972", "0.62164646", "0.6212124", "0.62106013", "0.6207968", "0.6204024", "0.6202516", "0.6201189", "0.620109", "0.61999154", "0.6187102", "0.61827284", "0.61826867", "0.6173291", "0.6172721", "0.617242", "0.61698866", "0.6168605", "0.6167656", "0.61666656", "0.6164982", "0.61599225", "0.61591244", "0.615635", "0.6155694", "0.61529523", "0.61488336", "0.6148674", "0.6148052", "0.61479765", "0.6145731", "0.6145731", "0.6143353", "0.6142251", "0.61383003", "0.6138296", "0.61351013", "0.6134888", "0.613448", "0.613353", "0.613111", "0.6130578", "0.61297756", "0.61280245", "0.6127422" ]
0.65379226
8
Deprecated: Use VariableID.ProtoReflect.Descriptor instead.
func (*VariableID) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{10} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{3}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_synthetics_proto_rawDescGZIP(), []int{2}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{7}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{9}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{7}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*DirectiveUndelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{10}\n}", "func (*Decl_IdentDecl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{4}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{4, 0}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ListVariableReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{11}\n}", "func (*DirectiveDelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{9}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*DirectiveCreateValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{7}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*VectorClock) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_l3_proto_rawDescGZIP(), []int{3}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*DirectiveEditValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{8}\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*GetTeamById) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*ListVariableRes) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{12}\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (*Primitive) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{15}\n}", "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_chat_proto_rawDescGZIP(), []int{1}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*ApiListener) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v2_api_listener_proto_rawDescGZIP(), []int{0}\n}", "func (*CLRMetric) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{1}\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*SemanticTokensDelta) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{223}\n}", "func (*TracingTagLiteral) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{4}\n}", "func (*TracingTagLiteral) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_v1_options_tracing_tracing_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{6}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*Message7865) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{15}\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*Preferences) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{8}\n}", "func (*ID) Descriptor() ([]byte, []int) {\n\treturn file_src_transport_grpc_proto_generics_proto_rawDescGZIP(), []int{0}\n}", "func (*PedidoPyme) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{1}\n}", "func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\tp := &descriptorpb.FieldDescriptorProto{\n\t\tName: proto.String(string(field.Name())),\n\t\tNumber: proto.Int32(int32(field.Number())),\n\t\tLabel: descriptorpb.FieldDescriptorProto_Label(field.Cardinality()).Enum(),\n\t\tOptions: proto.Clone(field.Options()).(*descriptorpb.FieldOptions),\n\t}\n\tif field.IsExtension() {\n\t\tp.Extendee = fullNameOf(field.ContainingMessage())\n\t}\n\tif field.Kind().IsValid() {\n\t\tp.Type = descriptorpb.FieldDescriptorProto_Type(field.Kind()).Enum()\n\t}\n\tif field.Enum() != nil {\n\t\tp.TypeName = fullNameOf(field.Enum())\n\t}\n\tif field.Message() != nil {\n\t\tp.TypeName = fullNameOf(field.Message())\n\t}\n\tif field.HasJSONName() {\n\t\t// A bug in older versions of protoc would always populate the\n\t\t// \"json_name\" option for extensions when it is meaningless.\n\t\t// When it did so, it would always use the camel-cased field name.\n\t\tif field.IsExtension() {\n\t\t\tp.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))\n\t\t} else {\n\t\t\tp.JsonName = proto.String(field.JSONName())\n\t\t}\n\t}\n\tif field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {\n\t\tp.Proto3Optional = proto.Bool(true)\n\t}\n\tif field.HasDefault() {\n\t\tdef, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)\n\t\tif err != nil && field.DefaultEnumValue() != nil {\n\t\t\tdef = string(field.DefaultEnumValue().Name()) // occurs for unresolved enum values\n\t\t} else if err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%v: %v\", field.FullName(), err))\n\t\t}\n\t\tp.DefaultValue = proto.String(def)\n\t}\n\tif oneof := field.ContainingOneof(); oneof != nil {\n\t\tp.OneofIndex = proto.Int32(int32(oneof.Index()))\n\t}\n\treturn p\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (*ParamType) Descriptor() ([]byte, []int) {\n\treturn file_keepsake_proto_rawDescGZIP(), []int{22}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*RaftGroupMemberIdProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{3}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*ClrGC) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{2}\n}", "func (*TypedValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{2}\n}", "func (*CSVCMsg_HltvReplay) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{51}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{25}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*Vector) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*ManualCpv) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_bidding_proto_rawDescGZIP(), []int{5}\n}", "func (*Message12774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{0}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*Message10319) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*CSVCMsg_HltvReplay) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{51}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*GenerateMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{1}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*AddInstanceInstruction) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{12}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}" ]
[ "0.7126352", "0.69455767", "0.66260874", "0.6588909", "0.65298015", "0.652896", "0.6456636", "0.64446527", "0.63759214", "0.63162845", "0.62901366", "0.6273029", "0.6255722", "0.6251889", "0.6215531", "0.61692864", "0.6162203", "0.61464596", "0.61338854", "0.61130613", "0.6111397", "0.6102339", "0.6100169", "0.6099948", "0.6090991", "0.60876703", "0.6073338", "0.60696286", "0.60670143", "0.60665643", "0.60648453", "0.60535187", "0.6047878", "0.6045404", "0.6044075", "0.6041799", "0.6032447", "0.60291564", "0.6028992", "0.6026867", "0.6025104", "0.60234964", "0.6022444", "0.60217273", "0.6020887", "0.6019664", "0.6015128", "0.60091877", "0.6000489", "0.5991519", "0.59914756", "0.5990978", "0.5990218", "0.5986327", "0.5979366", "0.5967418", "0.5967418", "0.5964132", "0.59640086", "0.59621966", "0.59588057", "0.59576607", "0.59560704", "0.59531033", "0.5946991", "0.59469825", "0.5940994", "0.5940478", "0.5937456", "0.59349996", "0.5934394", "0.59303296", "0.5927807", "0.5922858", "0.5922373", "0.5916502", "0.59154236", "0.59153366", "0.5915065", "0.5914636", "0.5912509", "0.5910087", "0.5909865", "0.59070534", "0.59035814", "0.59002113", "0.58986706", "0.5896622", "0.5896301", "0.5895715", "0.5893164", "0.58868116", "0.5885915", "0.58855563", "0.58853966", "0.58853334", "0.5884984", "0.5883843", "0.5883572", "0.5883068" ]
0.66086614
3
Deprecated: Use ListVariableReq.ProtoReflect.Descriptor instead.
func (*ListVariableReq) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{11} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ListVariableRes) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{12}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{5}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{14}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_accord_proto_rawDescGZIP(), []int{7}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{7}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_synthetics_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{6}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{10}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{7}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{1}\n}", "func (*MemberListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{12}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{7}\n}", "func (*ListModelReferencesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{105}\n}", "func (*ListNotificationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{63}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{3}\n}", "func (*ListConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{49}\n}", "func (*MemberTagListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{110}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberLevelListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{47}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{4}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberReceiveAddressListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{83}\n}", "func (*SimpleListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{6}\n}", "func (*ListDataAttributeBindingsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_data_taxonomy_proto_rawDescGZIP(), []int{18}\n}", "func (*ListTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{7}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{4, 0}\n}", "func (*FeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{10}\n}", "func (*PatchConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{50}\n}", "func (*ProductsListRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_proto_productslist_products_list_proto_rawDescGZIP(), []int{0}\n}", "func (*PeopleListRequest) Descriptor() ([]byte, []int) {\n\treturn file_sil_proto_rawDescGZIP(), []int{2}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*MemberRuleSettingListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{92}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{9}\n}", "func (*ListAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{2}\n}", "func (*UserListRequest) Descriptor() ([]byte, []int) {\n\treturn file_presence_proto_rawDescGZIP(), []int{1}\n}", "func (*WatchlistRequest) Descriptor() ([]byte, []int) {\n\treturn file_golang_pkg_proto_movies_movies_proto_rawDescGZIP(), []int{2}\n}", "func (*ListTimersRequest) Descriptor() ([]byte, []int) {\n\treturn file_list_timers_proto_rawDescGZIP(), []int{0}\n}", "func (*ListConversationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{6}\n}", "func (*BatchUpdateReferencesRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_icas_icas_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ListCredentialsRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{22}\n}", "func (*ListProofRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{34}\n}", "func (*Type_ListType) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ListChartReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{27}\n}", "func (*ListConceptsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{31}\n}", "func (*ListRefsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{15}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{4}\n}", "func (*ListChecksRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{0}\n}", "func (*ListIpPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{11}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*MemberStatisticsInfoListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{101}\n}", "func (*WaitListsRequest) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{77}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{4}\n}", "func (*ListDeviceRequest) Descriptor() ([]byte, []int) {\n\treturn file_device_proto_rawDescGZIP(), []int{0}\n}", "func (*GetWatchlistRequest) Descriptor() ([]byte, []int) {\n\treturn file_golang_pkg_proto_movies_movies_proto_rawDescGZIP(), []int{1}\n}", "func (*ListTeamsRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{18}\n}", "func (*ListModelTypesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{96}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*ListWeaveScopePodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_weavescope_services_proto_rawDescGZIP(), []int{1}\n}", "func (*ListLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{3}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "func (*MemberTaskListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{119}\n}", "func (*UserListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_hezzel_proto_rawDescGZIP(), []int{5}\n}", "func (*ListTagsRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{28}\n}", "func (*ListChannelMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{56}\n}", "func (*ListModelsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{78}\n}", "func (*ListPodsRequest) Descriptor() ([]byte, []int) {\n\treturn file_viz_proto_rawDescGZIP(), []int{7}\n}", "func (*ListTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{153}\n}", "func (*ListModelVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{88}\n}", "func (*ListUserFriendReq) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{6}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_threads_proto_rawDescGZIP(), []int{46}\n}", "func (*PatchConceptsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{34}\n}", "func (*GetClientListRequest) Descriptor() ([]byte, []int) {\n\treturn file_messaging_proto_rawDescGZIP(), []int{4}\n}", "func (*ListServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_manage_grpc_service_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ListNodeSelectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{23}\n}", "func (*WatchLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{7}\n}", "func (*ListValue) Descriptor() ([]byte, []int) {\n\treturn file_chameleon_api_http_data_proto_rawDescGZIP(), []int{0}\n}", "func (*ListThingsRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_service_proto_rawDescGZIP(), []int{4}\n}", "func (*GetListRequest) Descriptor() ([]byte, []int) {\n\treturn file_parser_company_proto_rawDescGZIP(), []int{14}\n}", "func (*ListNodePlanningsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_plannings_services_proto_rawDescGZIP(), []int{14}\n}", "func (*ListKnowledgeGraphsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{42}\n}", "func (*GetListServersRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{18}\n}", "func (*ListScopesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{108}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{2}\n}", "func (*ListCertificateV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_certificate_api_ocp_certificate_api_proto_rawDescGZIP(), []int{6}\n}", "func (*GetMengerListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_menger_menger_proto_rawDescGZIP(), []int{13}\n}", "func (*ListStorageRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{11}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}" ]
[ "0.7003119", "0.6571559", "0.65231967", "0.65141094", "0.6512945", "0.6493738", "0.6483414", "0.64811575", "0.64797944", "0.64721453", "0.6448194", "0.64414454", "0.64365965", "0.6429342", "0.64083", "0.63977855", "0.63758576", "0.63715404", "0.63642275", "0.6352802", "0.635117", "0.6336102", "0.632986", "0.62984383", "0.6291143", "0.62903583", "0.62833977", "0.6282236", "0.6275633", "0.62753654", "0.62699443", "0.6264017", "0.62538284", "0.62310135", "0.6225462", "0.62169725", "0.6216825", "0.62155837", "0.62101793", "0.62034404", "0.620161", "0.6186752", "0.6182777", "0.6181709", "0.618055", "0.617811", "0.61717963", "0.6170321", "0.6166951", "0.6161556", "0.6159441", "0.6158322", "0.6157138", "0.61512077", "0.61464804", "0.61425894", "0.61400104", "0.6138167", "0.6133802", "0.6133737", "0.61330277", "0.6121504", "0.6120058", "0.611995", "0.6116482", "0.6114691", "0.61141825", "0.611207", "0.6111583", "0.61106527", "0.61077636", "0.6105521", "0.6102609", "0.61025876", "0.609972", "0.60994554", "0.60975933", "0.609561", "0.6093459", "0.6089733", "0.60876995", "0.60871285", "0.60861725", "0.6083695", "0.6080672", "0.60792196", "0.60770977", "0.60726094", "0.6069936", "0.60695094", "0.60674155", "0.60644865", "0.6060987", "0.60590196", "0.60585874", "0.60571975", "0.6057014", "0.6056346", "0.6052754", "0.60525143" ]
0.76881313
0
Deprecated: Use ListVariableRes.ProtoReflect.Descriptor instead.
func (*ListVariableRes) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{12} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ListVariableReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{11}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{3}\n}", "func (*Type_ListType) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*List) Descriptor() ([]byte, []int) {\n\treturn file_proto_ssql_proto_rawDescGZIP(), []int{11}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_proto_v1_synthetics_proto_rawDescGZIP(), []int{2}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*ListValue) Descriptor() ([]byte, []int) {\n\treturn file_chameleon_api_http_data_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{7}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*ListValue) Descriptor() ([]byte, []int) {\n\treturn file_proto_value_value_proto_rawDescGZIP(), []int{4}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_accord_proto_rawDescGZIP(), []int{7}\n}", "func (*Variable) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{9}\n}", "func (*FlagsListResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{22}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{7}\n}", "func (x *fastReflection_EvidenceList) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_EvidenceList\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{3}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{14}\n}", "func (*CMsg_CVars) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{4}\n}", "func (*ListModelReferencesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{105}\n}", "func (*PortList) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{2}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{10}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_url_proto_rawDescGZIP(), []int{4}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*ListDeleted) Descriptor() ([]byte, []int) {\n\treturn file_lists_events_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{0}\n}", "func (*ListService) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{6}\n}", "func (*ListRefsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{15}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{6}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{15}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{6}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*Vector) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{1}\n}", "func (*ListOptions) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{11}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ListUserFriendRsp_List) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsg_CVars_CVar) Descriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{4, 0}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*VfList) Descriptor() ([]byte, []int) {\n\treturn file_config_devmodel_proto_rawDescGZIP(), []int{3}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{1}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_v1_proto_rawDescGZIP(), []int{1}\n}", "func (*RenewDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{6}\n}", "func (*PortList) Descriptor() ([]byte, []int) {\n\treturn file_portdomain_proto_rawDescGZIP(), []int{2}\n}", "func (*FlexibleRuleOperandInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_user_lists_proto_rawDescGZIP(), []int{8}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*ListConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{49}\n}", "func (*Vector) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{2}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*ListAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{12}\n}", "func (*ListChartReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{27}\n}", "func (*MemberListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{2}\n}", "func (*MemberListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{4}\n}", "func (*ListNotification) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_notification_proto_rawDescGZIP(), []int{1}\n}", "func (*ListIpPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{11}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{17}\n}", "func (*CMsgVector) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{0}\n}", "func (*VectorClock) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_l3_proto_rawDescGZIP(), []int{3}\n}", "func (*ListMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{15}\n}", "func (*UserListLogicalRuleInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_user_lists_proto_rawDescGZIP(), []int{12}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{7}\n}", "func (*EventsListProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{9}\n}", "func (*ListTimersRequest) Descriptor() ([]byte, []int) {\n\treturn file_list_timers_proto_rawDescGZIP(), []int{0}\n}", "func (*CancelDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{8}\n}", "func (*ListRefsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{16}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (*ListNodeSelectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{23}\n}", "func (*ListMetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*ListValue) Descriptor() ([]byte, []int) {\n\treturn file_ocis_messages_settings_v0_settings_proto_rawDescGZIP(), []int{14}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (*Vector) Descriptor() ([]byte, []int) {\n\treturn file_msgdata_proto_rawDescGZIP(), []int{5}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*VariableID) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{10}\n}", "func (*FriendList) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{38}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{5}\n}", "func (*ListMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{23}\n}", "func (*ListNotificationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{63}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_user_proto_rawDescGZIP(), []int{3}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{44, 1}\n}", "func (*SubscriptionList) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{12}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{44, 1}\n}", "func (*Preferences) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{8}\n}", "func (*List) Descriptor() ([]byte, []int) {\n\treturn file_google_actions_sdk_v2_conversation_prompt_content_list_proto_rawDescGZIP(), []int{0}\n}", "func (*ListTeamsRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{18}\n}", "func (*RefreshNamenodesResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{3}\n}", "func (*ListTeamsResponse_TeamListItem) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_audience_team_list_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*MemberRuleSettingListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{94}\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{7}\n}", "func (*ListRulesRequest) Descriptor() ([]byte, []int) {\n\treturn file_plugin_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.7172866", "0.66695154", "0.6534382", "0.650128", "0.6460396", "0.63638353", "0.6329906", "0.6309684", "0.6288664", "0.62838805", "0.6276277", "0.62503725", "0.62489116", "0.6238479", "0.62189096", "0.62014437", "0.62013793", "0.6194213", "0.6187662", "0.6171217", "0.61705434", "0.61689913", "0.6162572", "0.61600405", "0.61512583", "0.61435163", "0.6138212", "0.6131955", "0.6124012", "0.61189973", "0.61151296", "0.61108553", "0.6109564", "0.60937804", "0.60934526", "0.60930437", "0.6085666", "0.60823274", "0.60820955", "0.607129", "0.6068712", "0.6065399", "0.60629493", "0.6059853", "0.6058581", "0.60557574", "0.60543764", "0.6051109", "0.6049606", "0.6047818", "0.60445976", "0.6043466", "0.6043102", "0.60417366", "0.60409397", "0.6037396", "0.60239476", "0.6016687", "0.6013249", "0.6012516", "0.6008534", "0.6005499", "0.60042626", "0.59979004", "0.5997046", "0.59968936", "0.5996778", "0.5996466", "0.59953004", "0.5995163", "0.59950835", "0.59936404", "0.5992359", "0.59920996", "0.5989054", "0.59866107", "0.5979301", "0.59772193", "0.5974964", "0.59741604", "0.5972864", "0.5972625", "0.5964673", "0.5957267", "0.59531915", "0.5950476", "0.5948025", "0.5940354", "0.5938543", "0.5938112", "0.5936863", "0.5936408", "0.59361494", "0.5936116", "0.5934483", "0.59296674", "0.5927911", "0.59277153", "0.59270763", "0.59256524" ]
0.7408062
0
Deprecated: Use DescribeRepositoryReq.ProtoReflect.Descriptor instead.
func (*DescribeRepositoryReq) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{13} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*GetRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{3}\n}", "func (*ComputeRepositoryDiffRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22}\n}", "func (*GetRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{13}\n}", "func (*RepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{10}\n}", "func (*UpdateRepoReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{5}\n}", "func (*FindRemoteRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRepositoryReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{15}\n}", "func (*DescribeInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{28}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*DetachMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{22}\n}", "func (*ListMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{23}\n}", "func (*ResolveVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{25}\n}", "func (*DescribeClientRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{30}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*ListRepositoriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{1}\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*SyncPinnedRepositoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_pinnedRepository_pinnedRepository_proto_rawDescGZIP(), []int{1}\n}", "func (*GetRepositoryRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{13, 0}\n}", "func (*ListRepositoriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{12}\n}", "func (*ComputeRepositoryDiffRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{22, 0}\n}", "func (*DeleteRepositoryRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{15, 0}\n}", "func (*PackageRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateRegistryRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{5}\n}", "func (*AttachMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{21}\n}", "func (*RevertRepositoryCommitsRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{33}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRefRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{14}\n}", "func (*GetRegistryRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{0}\n}", "func (*FindRemoteRepositoryResponse) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateIpPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{10}\n}", "func (*StatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_google_cloudprober_servers_grpc_proto_grpcservice_proto_rawDescGZIP(), []int{1}\n}", "func (*Repository) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{9}\n}", "func (*ChangeUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_githubcard_proto_rawDescGZIP(), []int{23}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRegistryRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*DiffRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateNetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{8}\n}", "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "func (*GetChangesRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_pb_watcher_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateEntityRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{1}\n}", "func (*NewVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_versiontracker_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateRemoteMirrorRequest) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{0}\n}", "func (*DescribePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{6}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*SelectorVerificationReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{0}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*Repository) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_artifactregistry_v1_repository_proto_rawDescGZIP(), []int{0}\n}", "func (*ReadTensorboardUsageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{6}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{11}\n}", "func (*SetRepository) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{14}\n}", "func (*IssueCredentialRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{11}\n}", "func (*MergeRepositoryCommitsRequest) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{32}\n}", "func (*CodeLensRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{163}\n}", "func (*PatchAnnotationsStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{5}\n}", "func (*ProjectUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{70}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*SelectorVerificationsReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{2}\n}", "func (*CodeLensResolveRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{33}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ReportRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{2}\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (*PatchWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{143}\n}", "func (*DidChangeConfigurationRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{72}\n}", "func (*GetInstanceURLRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{26}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{2}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{2}\n}", "func (*VersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_provider_v1alpha1_service_proto_rawDescGZIP(), []int{0}\n}", "func (*RenameRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{194}\n}", "func (*ProjectUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{73}\n}", "func (*RefreshRuntimeTokenInternalRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{12}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_authorization_proto_rawDescGZIP(), []int{0}\n}", "func (*GetEntityRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{5}\n}", "func (*GetTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{1}\n}", "func (*SetRepository_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{14, 0}\n}", "func (*GrantedProjectSearchRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{114}\n}", "func (*GrantedProjectSearchRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{111}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*UpdateNetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_vpc_v1_network_service_proto_rawDescGZIP(), []int{5}\n}", "func (*QueryPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_permission_pb_request_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchModelVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{86}\n}", "func (*GetConceptLanguageRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{48}\n}", "func (*DefinitionRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{129}\n}", "func (*ContractQueryRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{22}\n}", "func (*DetachTagsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{19}\n}", "func (*SyncPinnedRepositoryResponse) Descriptor() ([]byte, []int) {\n\treturn file_pinnedRepository_pinnedRepository_proto_rawDescGZIP(), []int{2}\n}", "func (*RepositoryNamedIdentification) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{10}\n}", "func (*ListRepositoriesRequest_Response) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_VersioningService_proto_rawDescGZIP(), []int{12, 0}\n}", "func (*DescribeProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateArtifactRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_metadata_service_proto_rawDescGZIP(), []int{11}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{9}\n}", "func (*UpdateRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{11}\n}", "func (*DescribeInstanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{29}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.73243886", "0.72970176", "0.7288239", "0.71888715", "0.7183465", "0.7175035", "0.713901", "0.71179855", "0.69901067", "0.6977314", "0.6969404", "0.692119", "0.69194776", "0.6916009", "0.6915778", "0.6902419", "0.6895223", "0.6869635", "0.68641007", "0.6858219", "0.68566984", "0.6856575", "0.6831967", "0.6829509", "0.6825475", "0.681544", "0.6812004", "0.679574", "0.67941856", "0.67840755", "0.6764977", "0.676405", "0.6749076", "0.6737332", "0.67368275", "0.6731883", "0.6731832", "0.67251706", "0.6719052", "0.6712237", "0.67118704", "0.6709382", "0.67091745", "0.6707253", "0.66995454", "0.66977316", "0.66976875", "0.66796815", "0.66794395", "0.66773254", "0.6671631", "0.6670288", "0.6669743", "0.66694003", "0.6665093", "0.66612023", "0.6658953", "0.6658508", "0.6655267", "0.66539234", "0.665298", "0.6651917", "0.6647821", "0.6646552", "0.66443926", "0.6643315", "0.66413873", "0.66389126", "0.6638807", "0.66375387", "0.66372836", "0.66372836", "0.66364366", "0.66333765", "0.66331947", "0.6630622", "0.66305476", "0.6627455", "0.66265756", "0.66257346", "0.66244465", "0.66212463", "0.6620096", "0.6618237", "0.6610441", "0.6609914", "0.6607445", "0.6604237", "0.6603787", "0.66033703", "0.6601688", "0.65991336", "0.6598866", "0.6597676", "0.6595485", "0.6592487", "0.65923274", "0.65915793", "0.6591478", "0.6591014" ]
0.7458026
0
Deprecated: Use Playbook.ProtoReflect.Descriptor instead.
func (*Playbook) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{14} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func ProtoFromMethodDescriptor(d protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\ttype canProto interface {\n\t\tMethodDescriptorProto() *descriptorpb.MethodDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MethodDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif md, ok := res.AsProto().(*descriptorpb.MethodDescriptorProto); ok {\n\t\t\treturn md\n\t\t}\n\t}\n\treturn protodesc.ToMethodDescriptorProto(d)\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{8}\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Undefined) Descriptor() ([]byte, []int) {\n\treturn file_rpc_rpc_proto_rawDescGZIP(), []int{3}\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{25}\n}", "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{13}\n}", "func (x *fastReflection_Supply) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Supply\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*APILevel) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{4}\n}", "func (*ApiListener) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v2_api_listener_proto_rawDescGZIP(), []int{0}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (*DirectiveUndelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{10}\n}", "func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName: proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart: proto.Int32(int32(xrange[0])),\n\t\t\tEnd: proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd: proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Play) Descriptor() ([]byte, []int) {\n\treturn file_play_proto_rawDescGZIP(), []int{0}\n}", "func (*AddProducerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*Player) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{6}\n}", "func (*Friend) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{37}\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (x *fastReflection_RpcCommandOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RpcCommandOptions\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*Person) Descriptor() ([]byte, []int) {\n\treturn file_protomessage_proto_rawDescGZIP(), []int{0}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*TalkVoice) Descriptor() ([]byte, []int) {\n\treturn file_msgdata_proto_rawDescGZIP(), []int{26}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (x *fastReflection_EventReceive) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_EventReceive\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*DirectiveCreateValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{7}\n}", "func (*WithWellKnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_testing_proto_rawDescGZIP(), []int{1}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*ListenApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{22}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (x *fastReflection_SendEnabled) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_SendEnabled\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*AddInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_myshoes_proto_rawDescGZIP(), []int{0}\n}", "func (*Real) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{6}\n}", "func (*PlaysReq) Descriptor() ([]byte, []int) {\n\treturn file_sendPlaysNL_proto_rawDescGZIP(), []int{0}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*PlanChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Code) Descriptor() ([]byte, []int) {\n\treturn file_internal_pkg_pb_ports_proto_rawDescGZIP(), []int{2}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*WithEnum) Descriptor() ([]byte, []int) {\n\treturn file_testproto_proto_rawDescGZIP(), []int{5}\n}", "func (*StaleReadRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{24}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2}\n}", "func (*PrivateApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{24}\n}", "func (*MetadataProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{7}\n}", "func (*Trickle) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{4}\n}", "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "func (*DropTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{22}\n}", "func (*Primitive) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{15}\n}", "func (*ValidatorUpdates) Descriptor() ([]byte, []int) {\n\treturn file_core_abci_v1alpha1_abci_proto_rawDescGZIP(), []int{6}\n}", "func (x *fastReflection_Input) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Input\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*Team) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteTeam) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6}\n}", "func (*MetadataUpdateEventProto) Descriptor() ([]byte, []int) {\n\treturn file_inotify_proto_rawDescGZIP(), []int{7}\n}", "func (*EnumMessage) Descriptor() ([]byte, []int) {\n\treturn file_enum_enum_example_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.6994223", "0.69564056", "0.68918157", "0.6883137", "0.6881855", "0.68322396", "0.6789128", "0.6786295", "0.67834914", "0.6772274", "0.6771531", "0.67621785", "0.6762107", "0.67534095", "0.6751933", "0.6744234", "0.6737102", "0.6735611", "0.6730613", "0.6726951", "0.6716874", "0.67139655", "0.67112136", "0.6669158", "0.6667757", "0.66625357", "0.66497433", "0.6648978", "0.6647966", "0.6644056", "0.6642547", "0.6640395", "0.6629992", "0.6616527", "0.6615226", "0.66073585", "0.6605462", "0.6604254", "0.6601256", "0.66009104", "0.6596463", "0.6592672", "0.6592665", "0.6579745", "0.6579705", "0.6576435", "0.6573049", "0.6570036", "0.6568852", "0.65685815", "0.65670604", "0.6562234", "0.6561843", "0.65552884", "0.65552336", "0.6554672", "0.6554552", "0.6551753", "0.65483296", "0.6547297", "0.65469146", "0.6542176", "0.65403044", "0.65375763", "0.6533439", "0.6529948", "0.65244836", "0.6522341", "0.6519801", "0.6518689", "0.6518288", "0.6515527", "0.65083826", "0.6508263", "0.65058714", "0.6505666", "0.65055436", "0.6503814", "0.65030813", "0.6502264", "0.6500557", "0.64966536", "0.64961934", "0.6495505", "0.64939255", "0.6489828", "0.64897674", "0.64890915", "0.64889973", "0.64850533", "0.64841723", "0.6483112", "0.64817196", "0.6481496", "0.64802635", "0.6477951", "0.64777344", "0.6477612", "0.6477249", "0.6476083", "0.6475414" ]
0.0
-1
Deprecated: Use RunOpsReq.ProtoReflect.Descriptor instead.
func (*RunOpsReq) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{15} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*UpdateTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{24}\n}", "func (*GetTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{19}\n}", "func (*RunWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_instances_proto_rawDescGZIP(), []int{15}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*PatchWorkflowsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{131}\n}", "func (*PatchConceptsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{34}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*CreateTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{18}\n}", "func (*RevokeTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{17}\n}", "func (*PatchWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{143}\n}", "func (*DeleteTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{25}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*CalculatorRequest) Descriptor() ([]byte, []int) {\n\treturn file_basicpb_unary_api_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}", "func (*RunRequest) Descriptor() ([]byte, []int) {\n\treturn file_command_proto_rawDescGZIP(), []int{9}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*GenerateProductMixIdeasRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{7}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*GetModelEvaluationRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{18}\n}", "func (*RevokeFactoryCertificateRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{15}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*WatchProvisioningApprovalRequestsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{7}\n}", "func (*PatchAnnotationsStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{5}\n}", "func (*PatchInputsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{59}\n}", "func (*RunRequest) Descriptor() ([]byte, []int) {\n\treturn file_coco_proto_rawDescGZIP(), []int{3}\n}", "func (*ApplyRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{0}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*DiagnoseRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{14}\n}", "func (*ScheduleWorkloadRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_protoc_api_schedule_workload_request_message_proto_rawDescGZIP(), []int{0}\n}", "func (*TaskUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{2}\n}", "func (*ApplyWorkspaceEditRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{86}\n}", "func (*DiffRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_api_services_diff_v1_diff_proto_rawDescGZIP(), []int{2}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*RestartServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{9}\n}", "func (*PatchModelsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{80}\n}", "func (*PatchConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{50}\n}", "func (*EventsRequest) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{23}\n}", "func (*GetTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateIngressRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{26}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{15}\n}", "func (*AddRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_calculator_proto_calc_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{142}\n}", "func (*DeleteWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{132}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{10}\n}", "func (*RefreshRuntimeTokenInternalRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{12}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*SwitchRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{7}\n}", "func (*SelectorVerificationReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{0}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{11}\n}", "func (*PatchModelVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{86}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*ReadTensorboardUsageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{11}\n}", "func (*CheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{0}\n}", "func (*WatchProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{7}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (*RefreshTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{155}\n}", "func (*RevokeCertificateRequest) Descriptor() ([]byte, []int) {\n\treturn file_majordomo_proto_rawDescGZIP(), []int{18}\n}", "func (*UpdateRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datacatalog_lineage_v1_lineage_proto_rawDescGZIP(), []int{13}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*MetricsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{18}\n}", "func (*CreateIngressRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{24}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{13}\n}", "func (*ModelControlRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_authorization_proto_rawDescGZIP(), []int{0}\n}", "func (*BatchUpdateReferencesRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_icas_icas_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*DeviceRestartRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_worker_v1_device_state_proto_rawDescGZIP(), []int{0}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_automate_gateway_api_telemetry_telemetry_proto_rawDescGZIP(), []int{0}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*RunOpsRes) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{16}\n}", "func (*CodeLensRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{163}\n}", "func (*DeleteProvisioningApprovalRequestRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_approval_request_service_proto_rawDescGZIP(), []int{11}\n}", "func (*SendRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{5}\n}", "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteIngressRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{27}\n}", "func (*ComputeDoubleRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_kubernetes_csi_csi_proxy_integrationtests_apigroups_api_dummy_v1_api_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateIpPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_containerregistry_v1_registry_service_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datacatalog_lineage_v1_lineage_proto_rawDescGZIP(), []int{17}\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (*UpdateWithdrawRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_temporal_service_proto_rawDescGZIP(), []int{4}\n}", "func (*WatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_watch_service_proto_rawDescGZIP(), []int{0}\n}", "func (*SelectorVerificationsReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{2}\n}", "func (*DescribePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{6}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_toit_api_auth_proto_rawDescGZIP(), []int{1}\n}", "func (*MemberTaskUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{122}\n}", "func (*AddPermissionToRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{6}\n}", "func (*ToggleWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{35}\n}", "func (*MemberTaskDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{124}\n}", "func (*CallRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRefRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{14}\n}" ]
[ "0.7107612", "0.7017801", "0.6950608", "0.67722416", "0.6765324", "0.6752489", "0.67259437", "0.67221236", "0.6707314", "0.67040014", "0.66941196", "0.6678439", "0.6670832", "0.6666073", "0.6662944", "0.66578716", "0.6657816", "0.66495866", "0.664471", "0.66404855", "0.6631255", "0.6597554", "0.65919924", "0.6584933", "0.65745836", "0.6569091", "0.6565999", "0.6565352", "0.6559366", "0.65591776", "0.65585953", "0.6558227", "0.6557893", "0.65558", "0.6550297", "0.654577", "0.65415055", "0.65385324", "0.653596", "0.653589", "0.6535817", "0.653425", "0.65275604", "0.6518443", "0.6518316", "0.651512", "0.6514705", "0.6513354", "0.6512329", "0.65121657", "0.6508914", "0.65031135", "0.65010965", "0.6498687", "0.6498653", "0.6498526", "0.64939034", "0.64910805", "0.6485894", "0.64841235", "0.6482553", "0.64769036", "0.64767355", "0.6470274", "0.64680564", "0.6467307", "0.6463596", "0.6463322", "0.6462947", "0.6461622", "0.64614546", "0.6460204", "0.64568454", "0.6448052", "0.6444464", "0.6444144", "0.64426154", "0.6441573", "0.64397013", "0.6438975", "0.6438892", "0.6437562", "0.643587", "0.6435127", "0.6432306", "0.64272976", "0.6426354", "0.6425325", "0.6424801", "0.6422673", "0.64224243", "0.6421865", "0.6418393", "0.6417701", "0.64172196", "0.6416531", "0.64149666", "0.6414966", "0.6412226", "0.6410903" ]
0.7500174
0
Deprecated: Use RunOpsRes.ProtoReflect.Descriptor instead.
func (*RunOpsRes) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{16} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*RunOpsReq) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{15}\n}", "func (*UpdateTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{24}\n}", "func (*GetTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{19}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*DiagOperation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{10}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*Run) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{25}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*StandardRunnerProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{55}\n}", "func (*CreateTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{18}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*Operation) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{47}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*Operation) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{24}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateTensorboardOperationMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{45}\n}", "func (StandardRunnerProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{55, 0}\n}", "func (*SelectorVerificationRes) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{1}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*ManagementOperation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{13}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (*WinRMListener) Descriptor() ([]byte, []int) {\n\treturn file_moc_common_computecommon_proto_rawDescGZIP(), []int{0}\n}", "func (*RunWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_instances_proto_rawDescGZIP(), []int{15}\n}", "func (*VirtualMachineRunCommandInstanceView) Descriptor() ([]byte, []int) {\n\treturn file_moc_common_computecommon_proto_rawDescGZIP(), []int{6}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "func (*Resource) Descriptor() ([]byte, []int) {\n\treturn file_apiextensions_fn_proto_v1beta1_run_function_proto_rawDescGZIP(), []int{5}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*Preferences) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{8}\n}", "func (*SecurityOperation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{9}\n}", "func (*GetTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{1}\n}", "func (*PlanChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0}\n}", "func (*ReadTensorboardUsageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{6}\n}", "func (*GenerateProductMixIdeasRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{7}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (*RawOp) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_server_quota_quotapb_update_accounts_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datacatalog_lineage_v1_lineage_proto_rawDescGZIP(), []int{17}\n}", "func (*PlanChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*WriteTensorboardRunDataResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{41}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*FetchInstancesInstruction) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{10}\n}", "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*RevokeTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{17}\n}", "func (*StandardResourceHints) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{63}\n}", "func (*ValidateReply) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{18}\n}", "func (*StandardCoders) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{29}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*ScanRunWarningTrace) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_websecurityscanner_v1_scan_run_warning_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*GetRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datacatalog_lineage_v1_lineage_proto_rawDescGZIP(), []int{14}\n}", "func (*BatchCreateTensorboardRunsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{16}\n}", "func (*ReadTensorboardUsageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{7}\n}", "func (StandardResourceHints_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{63, 0}\n}", "func (*Diagnostic) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{2}\n}", "func (*TaskRun) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ClrThread) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{3}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*CLRMetric) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{1}\n}", "func (*Calculator) Descriptor() ([]byte, []int) {\n\treturn file_basicpb_unary_api_proto_rawDescGZIP(), []int{1}\n}", "func (*RefreshProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*RefreshNamenodesResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{3}\n}", "func (*RefreshRuntimeTokenInternalRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{12}\n}", "func (*DiagnoseRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{14}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*Ref) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{15}\n}", "func (*Refresh) Descriptor() ([]byte, []int) {\n\treturn file_uni_proto_rawDescGZIP(), []int{12}\n}", "func (*Trigger) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{37}\n}", "func (*ControlPlaneOperation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{0}\n}", "func (*SemanticTokensEdit) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{224}\n}", "func (*RanfunctionName) Descriptor() ([]byte, []int) {\n\treturn file_e2sm_mho_go_v2_e2sm_v2_proto_rawDescGZIP(), []int{19}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*RenewDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{6}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*SemanticTokensLegend) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{215}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{7}\n}", "func (*CancelDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{8}\n}", "func (*SelectorVerificationsRes) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{3}\n}", "func (*CreateTensorboardOperationMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{44}\n}", "func (*UpdateRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datacatalog_lineage_v1_lineage_proto_rawDescGZIP(), []int{13}\n}", "func (*UpdateDeleteDisconnectedServicesConfigRes) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{18}\n}", "func (*Run) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datacatalog_lineage_v1_lineage_proto_rawDescGZIP(), []int{1}\n}", "func (*RestartServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{9}\n}", "func (*WriteTensorboardRunDataRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{40}\n}", "func (*PCollection) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{7}\n}", "func (*RunList) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{6}\n}", "func (*DelegateAction) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gateway_api_v1_virtual_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Performance) Descriptor() ([]byte, []int) {\n\treturn file_commissionService_proto_rawDescGZIP(), []int{2}\n}", "func (*ObjectDetectionModule) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visualinspection_v1beta1_module_proto_rawDescGZIP(), []int{4}\n}", "func (*ListTensorboardRunsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{22}\n}" ]
[ "0.6750467", "0.67362535", "0.6681629", "0.66724443", "0.66413933", "0.66265243", "0.6616651", "0.6573871", "0.65253603", "0.6516421", "0.65161854", "0.65145516", "0.650977", "0.64996266", "0.6403638", "0.63801986", "0.6372133", "0.6363645", "0.6316747", "0.6310355", "0.6304522", "0.6289984", "0.6289342", "0.62787557", "0.6278432", "0.6276873", "0.62725", "0.62704253", "0.6265809", "0.6263561", "0.6263043", "0.6260642", "0.6259503", "0.6257157", "0.62363905", "0.62362856", "0.62358344", "0.62293947", "0.6223681", "0.6222004", "0.6218962", "0.6211486", "0.6209614", "0.62081665", "0.62047577", "0.6203609", "0.6201658", "0.62005013", "0.6194407", "0.6192818", "0.61918736", "0.61890703", "0.6187289", "0.61862403", "0.6183751", "0.6183291", "0.6181008", "0.6173144", "0.6169328", "0.6168803", "0.6166364", "0.616426", "0.6160231", "0.6159235", "0.6156902", "0.61496794", "0.6147749", "0.6145528", "0.6144662", "0.61442465", "0.61422265", "0.6138133", "0.6137813", "0.61350626", "0.6130417", "0.6126522", "0.6126184", "0.61226404", "0.6122347", "0.6122278", "0.6122147", "0.6120917", "0.61201096", "0.6117437", "0.6112753", "0.6110256", "0.61093867", "0.6106151", "0.61036384", "0.61028385", "0.610241", "0.6098005", "0.6097212", "0.6096685", "0.609617", "0.6095411", "0.6094804", "0.60941374", "0.6093977", "0.6093747" ]
0.70218784
0
Deprecated: Use Playbook_Env.ProtoReflect.Descriptor instead.
func (*Playbook_Env) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{14, 0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*ValidatorUpdate) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{9}\n}", "func (*ApiListener) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_listener_v2_api_listener_proto_rawDescGZIP(), []int{0}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*ListenApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{22}\n}", "func (*TokenProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{0}\n}", "func (*DebugInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{19}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{1}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*APILevel) Descriptor() ([]byte, []int) {\n\treturn file_Notify_proto_rawDescGZIP(), []int{4}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{4}\n}", "func (*DescribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*KnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{8}\n}", "func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Params\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "func (*RuntimeLibrary) Descriptor() ([]byte, []int) {\n\treturn file_buf_alpha_registry_v1alpha1_generate_proto_rawDescGZIP(), []int{1}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*Play) Descriptor() ([]byte, []int) {\n\treturn file_play_proto_rawDescGZIP(), []int{0}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*Code) Descriptor() ([]byte, []int) {\n\treturn file_internal_pkg_pb_ports_proto_rawDescGZIP(), []int{2}\n}", "func (*WithWellKnownTypes) Descriptor() ([]byte, []int) {\n\treturn file_testing_proto_rawDescGZIP(), []int{1}\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{13}\n}", "func (*PrivateApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{24}\n}", "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "func (*DirectiveUndelegate) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{10}\n}", "func (*CredentialsKVProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{1}\n}", "func (*PlaysReq) Descriptor() ([]byte, []int) {\n\treturn file_sendPlaysNL_proto_rawDescGZIP(), []int{0}\n}", "func (*DiagnoseRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{14}\n}", "func (*ObservabilityListenCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{2}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (*VectorClock) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_l3_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateTeam) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{6}\n}", "func (*WebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{0}\n}", "func (*DropTeamRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{22}\n}", "func (*ExternalGrpcNode) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*FindWebhookCallRequest) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{7}\n}", "func (*ResourceManifest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gkehub_v1_membership_proto_rawDescGZIP(), []int{4}\n}", "func (*StaleReadRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{24}\n}", "func (*TalkVoice) Descriptor() ([]byte, []int) {\n\treturn file_msgdata_proto_rawDescGZIP(), []int{26}\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*PatchConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{50}\n}", "func (*ApplicationDownlink) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{9}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*Vk) Descriptor() ([]byte, []int) {\n\treturn file_parser_company_proto_rawDescGZIP(), []int{35}\n}", "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}", "func (*Name) Descriptor() ([]byte, []int) {\n\treturn file_examples_documents_example_proto_rawDescGZIP(), []int{25}\n}", "func (*PedidoPyme) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_helloworld_proto_rawDescGZIP(), []int{1}\n}", "func (*CMsgFlipLobbyTeams) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{90}\n}", "func (*AddInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_myshoes_proto_rawDescGZIP(), []int{0}\n}", "func (*LanguageDetectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_language_proto_rawDescGZIP(), []int{1}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "func (*Trickle) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{4}\n}", "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteTeam) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6}\n}", "func (*DirectiveCreateValidator) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{7}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{0}\n}", "func (*Team) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{12}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*ObjectDetectionModule) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_visualinspection_v1beta1_module_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*Undefined) Descriptor() ([]byte, []int) {\n\treturn file_rpc_rpc_proto_rawDescGZIP(), []int{3}\n}", "func (*DecodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_videoservice_proto_rawDescGZIP(), []int{0}\n}", "func (*GetTeamByName) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{2}\n}", "func (*GenerateMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{1}\n}" ]
[ "0.6911421", "0.6829972", "0.68295133", "0.68275696", "0.68268377", "0.68055516", "0.67770445", "0.6775906", "0.67675984", "0.6741583", "0.672539", "0.67178535", "0.67139137", "0.67027414", "0.669617", "0.6689195", "0.66723967", "0.6672052", "0.66466224", "0.6646433", "0.663562", "0.66288483", "0.6627893", "0.6615071", "0.66097355", "0.6607276", "0.6585087", "0.65758824", "0.6573082", "0.6571199", "0.65562934", "0.6554266", "0.655137", "0.6551321", "0.65481967", "0.6546445", "0.6539428", "0.65390134", "0.653851", "0.653617", "0.65319246", "0.6524783", "0.6524222", "0.6520747", "0.6519208", "0.65166897", "0.65155774", "0.65124214", "0.6511366", "0.65064645", "0.6503463", "0.64996344", "0.6499119", "0.64946085", "0.6491898", "0.6490671", "0.6488698", "0.6483192", "0.6483089", "0.6481866", "0.64809644", "0.64771914", "0.64747256", "0.647345", "0.6472808", "0.64704084", "0.64690036", "0.64684695", "0.6465885", "0.6465292", "0.64635456", "0.6463132", "0.6459007", "0.6458958", "0.6454927", "0.6453197", "0.64523005", "0.64507484", "0.64504236", "0.644822", "0.64473975", "0.64461625", "0.6445776", "0.64456433", "0.64436036", "0.6443174", "0.64429617", "0.64424807", "0.64409953", "0.6437815", "0.6435519", "0.6435323", "0.64348024", "0.6434071", "0.64332074", "0.64288604", "0.6428392", "0.64282846", "0.64275056", "0.64259386", "0.64251494" ]
0.0
-1
Deprecated: Use Playbook_Task.ProtoReflect.Descriptor instead.
func (*Playbook_Task) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{14, 1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_tasklist_server_proto_rawDescGZIP(), []int{0}\n}", "func (*OldSystemTask) Descriptor() ([]byte, []int) {\n\treturn file_offline_v3tasks_proto_rawDescGZIP(), []int{2}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*OldSystemTaskDetail) Descriptor() ([]byte, []int) {\n\treturn file_offline_v3tasks_proto_rawDescGZIP(), []int{3}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{0}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_protos_v1_task_task_proto_rawDescGZIP(), []int{1}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{2}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{0}\n}", "func (*TaskDefWrapper) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{10}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_model_proto_rawDescGZIP(), []int{11}\n}", "func (*TaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_tasklist_server_proto_rawDescGZIP(), []int{2}\n}", "func (*TaskUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{2}\n}", "func (*OldTaskFile) Descriptor() ([]byte, []int) {\n\treturn file_offline_v3tasks_proto_rawDescGZIP(), []int{1}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{0}\n}", "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_my_task_my_task_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{6}\n}", "func (*TaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{1}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_clientToAppMgr_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{2}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_task_proto_rawDescGZIP(), []int{0}\n}", "func (*ListTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{0}\n}", "func (*CreateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{1}\n}", "func (*AddTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*GetTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{152}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_todolist_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{15}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*GetTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{3}\n}", "func (*TaskList) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{3}\n}", "func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{13}\n}", "func (*ListTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{153}\n}", "func (*NoopTask) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{6}\n}", "func (*CreateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{1}\n}", "func (*GetTaskReq) Descriptor() ([]byte, []int) {\n\treturn file_daangn_eboolkiq_v1_eboolkiq_svc_proto_rawDescGZIP(), []int{6}\n}", "func (*TaskRef) Descriptor() ([]byte, []int) {\n\treturn file_pipelinerun_proto_rawDescGZIP(), []int{4}\n}", "func (*TaskUpdateResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{3}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*CreateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{0}\n}", "func (*NextTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberTaskListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{119}\n}", "func (*TaskSpec) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{2}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*AddTaskResponse) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{1}\n}", "func (*TasksListRequest) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{2}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateTaskResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{7}\n}", "func (*DescribeTaskListResponse) Descriptor() ([]byte, []int) {\n\treturn file_uber_cadence_api_v1_service_workflow_proto_rawDescGZIP(), []int{15}\n}", "func (*EmbeddedTask) Descriptor() ([]byte, []int) {\n\treturn file_pipelinerun_proto_rawDescGZIP(), []int{5}\n}", "func (*MemberTaskUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{122}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_pkg_api_api_proto_rawDescGZIP(), []int{1}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*UrlFetchTask) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{8}\n}", "func (*ConnectRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_v1_task_task_proto_rawDescGZIP(), []int{2}\n}", "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{1}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*CreateTaskResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{2}\n}", "func (*CreateTaskContent) Descriptor() ([]byte, []int) {\n\treturn file_proto_activity_activity_proto_rawDescGZIP(), []int{1}\n}", "func (*ListTaskResponse) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteTeam) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{6}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*MemberTaskData) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{120}\n}", "func (*GetTasksResponse) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{4}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*TaskResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_tasklist_server_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{7}\n}", "func (*DescribeTaskListRequest) Descriptor() ([]byte, []int) {\n\treturn file_uber_cadence_api_v1_service_workflow_proto_rawDescGZIP(), []int{14}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*FindProjectTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{4}\n}", "func (*MemberTaskUpdateResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{123}\n}", "func (*CreateTaskReq) Descriptor() ([]byte, []int) {\n\treturn file_daangn_eboolkiq_v1_eboolkiq_svc_proto_rawDescGZIP(), []int{5}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_my_task_my_task_proto_rawDescGZIP(), []int{0}\n}", "func (*OpTask) Descriptor() ([]byte, []int) {\n\treturn file_model_proto_rawDescGZIP(), []int{10}\n}", "func (*MemberTaskAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{117}\n}", "func (*FindEnabledMessageTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_message_task_proto_rawDescGZIP(), []int{6}\n}", "func (*Staff) Descriptor() ([]byte, []int) {\n\treturn file_task_proto_rawDescGZIP(), []int{4}\n}", "func (*CreateMessageTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_message_task_proto_rawDescGZIP(), []int{0}\n}", "func (*TodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_todolist_proto_rawDescGZIP(), []int{0}\n}", "func (*ToDo) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*TaskRun) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{0}\n}", "func (*Schedule) Descriptor() ([]byte, []int) {\n\treturn file_proto_common_proto_rawDescGZIP(), []int{3}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_resources_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{155}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{44, 1}\n}", "func (*MemberTaskAddResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{118}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*TaskResponse) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{4}\n}", "func (*PostTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{151}\n}", "func (*GetTeamById) Descriptor() ([]byte, []int) {\n\treturn file_uac_Team_proto_rawDescGZIP(), []int{1}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{44, 1}\n}", "func (*FindProjectTasksResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{5}\n}", "func (*MemberTaskListResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{121}\n}", "func (*MemberTaskDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{124}\n}", "func (*ReadTensorboardUsageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateTeam) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{6}\n}" ]
[ "0.7182666", "0.7142638", "0.71236145", "0.71081597", "0.7098932", "0.70734704", "0.7066592", "0.7059467", "0.70552635", "0.7039159", "0.703849", "0.7026142", "0.702429", "0.7005555", "0.7005214", "0.6996637", "0.6988561", "0.69673556", "0.6951356", "0.69451886", "0.68928236", "0.6882545", "0.6879052", "0.68767834", "0.6875573", "0.68705845", "0.6856282", "0.6853926", "0.68503124", "0.68396604", "0.68328446", "0.68220776", "0.68139344", "0.68110156", "0.68085015", "0.67952055", "0.67920643", "0.67737746", "0.67689556", "0.67665875", "0.67658067", "0.6755937", "0.6748199", "0.6744754", "0.6734396", "0.6733558", "0.6732556", "0.6730952", "0.6730419", "0.6730049", "0.672352", "0.6722234", "0.6722145", "0.6714891", "0.6714062", "0.67129725", "0.6711992", "0.6711992", "0.6710389", "0.6708354", "0.6708123", "0.669218", "0.6692044", "0.6691716", "0.6689228", "0.6688654", "0.66885316", "0.6673591", "0.667306", "0.6672957", "0.66710204", "0.666929", "0.6665943", "0.6665831", "0.6660497", "0.6659902", "0.6656549", "0.66558677", "0.6654793", "0.66547763", "0.66546863", "0.6651469", "0.6651289", "0.66512513", "0.6637818", "0.6635087", "0.6628668", "0.6623984", "0.66234523", "0.6611244", "0.6610807", "0.66103244", "0.66096264", "0.6608955", "0.6606963", "0.66055816", "0.66051286", "0.660359", "0.66015774", "0.6601378" ]
0.6957531
18
Deprecated: Use Playbook_Task_Args.ProtoReflect.Descriptor instead.
func (*Playbook_Task_Args) Descriptor() ([]byte, []int) { return file_api_ops_proto_rawDescGZIP(), []int{14, 1, 0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*TaskUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{2}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{2}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*TaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{1}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{0}\n}", "func (*AddTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*OldSystemTask) Descriptor() ([]byte, []int) {\n\treturn file_offline_v3tasks_proto_rawDescGZIP(), []int{2}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{2}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_tasklist_server_proto_rawDescGZIP(), []int{0}\n}", "func (*TaskDefWrapper) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{10}\n}", "func (*TaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_tasklist_server_proto_rawDescGZIP(), []int{2}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{0}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{0}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_protos_v1_task_task_proto_rawDescGZIP(), []int{1}\n}", "func (*OldSystemTaskDetail) Descriptor() ([]byte, []int) {\n\treturn file_offline_v3tasks_proto_rawDescGZIP(), []int{3}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{15}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_model_proto_rawDescGZIP(), []int{11}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_clientToAppMgr_proto_rawDescGZIP(), []int{3}\n}", "func (*GetTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{152}\n}", "func (*Playbook_Task) Descriptor() ([]byte, []int) {\n\treturn file_api_ops_proto_rawDescGZIP(), []int{14, 1}\n}", "func (*OldTaskFile) Descriptor() ([]byte, []int) {\n\treturn file_offline_v3tasks_proto_rawDescGZIP(), []int{1}\n}", "func (*GetTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{3}\n}", "func (*CreateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{1}\n}", "func (*TaskRef) Descriptor() ([]byte, []int) {\n\treturn file_pipelinerun_proto_rawDescGZIP(), []int{4}\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_task_proto_rawDescGZIP(), []int{0}\n}", "func (*GetTaskReq) Descriptor() ([]byte, []int) {\n\treturn file_daangn_eboolkiq_v1_eboolkiq_svc_proto_rawDescGZIP(), []int{6}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{13}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_todolist_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{24}\n}", "func (*CreateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{1}\n}", "func (*PostTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{151}\n}", "func (*TaskSpec) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{2}\n}", "func (*ListTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_task_task_proto_rawDescGZIP(), []int{0}\n}", "func (*CreateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{11}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*TodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_todolist_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberTaskUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{122}\n}", "func (*ReadTensorboardUsageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{6}\n}", "func (*Id) Descriptor() ([]byte, []int) {\n\treturn file_my_task_my_task_proto_rawDescGZIP(), []int{2}\n}", "func (*ListTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{153}\n}", "func (*EmbeddedTask) Descriptor() ([]byte, []int) {\n\treturn file_pipelinerun_proto_rawDescGZIP(), []int{5}\n}", "func (*TasksListRequest) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{2}\n}", "func (*EventsRequest) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{23}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{7}\n}", "func (*CreateTaskReq) Descriptor() ([]byte, []int) {\n\treturn file_daangn_eboolkiq_v1_eboolkiq_svc_proto_rawDescGZIP(), []int{5}\n}", "func (*MemberTaskAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{117}\n}", "func (*ParDoPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{8}\n}", "func (*NoopTask) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{6}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*TaskRun) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{0}\n}", "func (*GetTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{1}\n}", "func (*CreateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{1}\n}", "func (*ToDo) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_pkg_api_api_proto_rawDescGZIP(), []int{1}\n}", "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*DeleteTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{155}\n}", "func (*TaskList) Descriptor() ([]byte, []int) {\n\treturn file_infra_grpc_task_proto_rawDescGZIP(), []int{3}\n}", "func (*NextTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{0}\n}", "func (*Trigger) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{37}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_my_task_my_task_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberTaskListReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{119}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*OriginalDetectIntentRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2beta1_webhook_proto_rawDescGZIP(), []int{2}\n}", "func (*ProcessPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{52}\n}", "func (*UrlFetchTask) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_scheduler_appengine_messages_config_proto_rawDescGZIP(), []int{8}\n}", "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_resources_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*RunWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_instances_proto_rawDescGZIP(), []int{15}\n}", "func (*ListTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{7}\n}", "func (*GetTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{19}\n}", "func (*CreateMessageTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_message_task_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberTaskDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{124}\n}", "func (*FindProjectTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_task_proto_rawDescGZIP(), []int{4}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*WebhookCall) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{6}\n}", "func (*TaskReply) Descriptor() ([]byte, []int) {\n\treturn file_task_proto_rawDescGZIP(), []int{1}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*CreateTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_myorg_todo_v1_create_todo_proto_rawDescGZIP(), []int{0}\n}", "func (*ListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{5}\n}", "func (*GetTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{5}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_threads_proto_rawDescGZIP(), []int{46}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{9}\n}", "func (*StandardRunnerProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{55}\n}", "func (*CreateTensorboardRunRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{18}\n}", "func (*AddTaskResponse) Descriptor() ([]byte, []int) {\n\treturn file_todo_todo_proto_rawDescGZIP(), []int{1}\n}", "func (*PTransform) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{3}\n}", "func (*CreateTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{1}\n}", "func (*CreateTodoRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{1}\n}", "func (*WebhookCall) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{7}\n}", "func (*CreateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{0}\n}", "func (*StandardRequirements) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{56}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*ValidateRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{17}\n}" ]
[ "0.6772049", "0.67473507", "0.67229784", "0.6688819", "0.6679389", "0.6678997", "0.6661416", "0.66595143", "0.6651677", "0.66499674", "0.6629894", "0.6624345", "0.6620293", "0.66010374", "0.6590303", "0.65902686", "0.6589136", "0.6578645", "0.6573349", "0.6548069", "0.65456086", "0.65454495", "0.65316594", "0.652469", "0.6516969", "0.65113646", "0.6496838", "0.64965796", "0.64653116", "0.64555866", "0.6446731", "0.6446237", "0.6441984", "0.6441311", "0.64318395", "0.6427646", "0.64254993", "0.6422727", "0.64165515", "0.6416077", "0.6414238", "0.64060026", "0.63932294", "0.6392991", "0.638681", "0.6386803", "0.63668084", "0.6365201", "0.6364497", "0.63612497", "0.63591725", "0.63559586", "0.63542515", "0.635011", "0.6348458", "0.6348458", "0.6345303", "0.63430756", "0.632733", "0.6327068", "0.6323609", "0.63227767", "0.63211995", "0.6317358", "0.63172", "0.63136154", "0.630987", "0.6308007", "0.6300151", "0.62966925", "0.62959856", "0.6294902", "0.62831664", "0.6281124", "0.62791026", "0.6275932", "0.6275308", "0.6271329", "0.6267396", "0.62652385", "0.62634367", "0.626322", "0.6261061", "0.62600976", "0.6258354", "0.6257153", "0.62545943", "0.6254574", "0.6252246", "0.62515795", "0.6251343", "0.6251161", "0.6246446", "0.6241127", "0.6241127", "0.62362635", "0.62289095", "0.62192386", "0.62189835", "0.6218078" ]
0.6958025
0
Filename returns an absolute filename, appropriate for the operating system
func (s *Single) Filename() string { if len(Lockfile) > 0 { return Lockfile } return filepath.Join(os.TempDir(), fmt.Sprintf("%s.lock", s.name)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *Builder) Filename() string {\n\txOsExts := map[string]string{\n\t\t\"darwin\": \"\",\n\t\t\"linux\": \"\",\n\t\t\"windows\": \".exe\",\n\t}\n\tbinaryName := fmt.Sprintf(\"%s_%s_%s%s\",\n\t\tb.Cmd, b.OS, b.Arch, xOsExts[b.OS])\n\tif b.BinaryName != \"\" {\n\t\tbinaryName = fmt.Sprintf(\"%s%s\",\n\t\t\tb.BinaryName, xOsExts[b.OS])\n\t}\n\treturn filepath.Join(\n\t\t\"./dist/\",\n\t\tfmt.Sprintf(\"%s-%s-%s\",\n\t\t\tb.Cmd, b.OS, b.Arch),\n\t\tbinaryName,\n\t)\n}", "func programName(filename string) string {\n\tfilename = filepath.Base(filename)\n\text := filepath.Ext(filename)\n\treturn filename[:len(filename)-len(ext)]\n}", "func getHostFile() (string, error) {\n\tpaltform := runtime.GOOS\n\tif hostFile, ok := pathMap[paltform]; ok {\n\t\treturn hostFile, nil\n\t} else {\n\t\treturn \"\", errors.New(\"unsupported PLATFORM!\")\n\t}\n}", "func ProgramName(filename string) string{\n\tlast_slash_pos := strings.LastIndexByte(filename, '/')\n\tif (last_slash_pos != -1) {\n\t\tfilename = filename[last_slash_pos+1:];\n\t}\n\n\tlast_dot_pos := strings.LastIndexByte(filename, '.')\n\tif -1 != last_dot_pos {\n\t\tfilename = filename[: last_dot_pos]\n\t}\n\n\treturn filename;\n}", "func executableName() string {\n\t_, file := filepath.Split(os.Args[0])\n\treturn file\n}", "func (uri URI) Filename() string {\n\tfilename, err := filename(uri)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn filepath.FromSlash(filename)\n}", "func GetExecutableFilename() string {\n\t// try readlink first\n\tpath, err := os.Readlink(\"/proc/self/exe\")\n\tif err == nil {\n\t\treturn path\n\t}\n\t// use argv[0]\n\tpath = os.Args[0]\n\tif !filepath.IsAbs(path) {\n\t\tcwd, _ := os.Getwd()\n\t\tpath = filepath.Join(cwd, path)\n\t}\n\tif FileExists(path) {\n\t\treturn path\n\t}\n\t// Fallback : use \"gosemki\" and assume we are in the PATH...\n\tpath, err = exec.LookPath(\"gosemki\")\n\tif err == nil {\n\t\treturn path\n\t}\n\treturn \"\"\n}", "func (ts TestSuite) Filename() string {\n\tvar b strings.Builder\n\n\tif ts.Type == \"xpack\" {\n\t\tb.WriteString(\"xpack_\")\n\t}\n\n\tb.WriteString(strings.ToLower(strings.Replace(ts.Dir, \".\", \"_\", -1)))\n\tb.WriteString(\"__\")\n\n\tbname := reFilename.ReplaceAllString(filepath.Base(ts.Filepath), \"$1\")\n\tb.WriteString(strings.ToLower(bname))\n\n\treturn b.String()\n}", "func (e *Automation) GetFileName() string {\n\treturn fmt.Sprintf(\n\t\t\"%s_v%d_%d.json\",\n\t\te.Name,\n\t\te.VersionNumber,\n\t\te.ID)\n}", "func exe(filename string) string {\n\tif runtime.GOOS == \"windows\" {\n\t\treturn filename + \".exe\"\n\t}\n\treturn filename\n}", "func (o *PlatformImage) GetFilename() string {\n\tif o == nil || o.Filename == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Filename\n}", "func (p *Post) GetFileName() string {\n\ttimeStamp, _ := time.Parse(time.RubyDate, p.CreatedAt)\n\treturn fmt.Sprintf(\"%d-%s-%dx%d.%s\", timeStamp.Unix(), p.Id, p.Width, p.Height, getFileExt(p.FileURL))\n}", "func (deb *DebPkg) GetFilename() string {\n\treturn fmt.Sprintf(\"%s-%s_%s.%s\",\n\t\tdeb.control.info.name,\n\t\tdeb.control.info.version.full,\n\t\tdeb.control.info.architecture,\n\t\tdebianFileExtension)\n}", "func (c *ConfigFile) Filename() string {\n\trw, err := NewConfigReadWriter(c.version)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn rw.Filename(c)\n}", "func GetFilename(URL string) string {\n\n\tif u, err := url.Parse(URL); err == nil && filepath.Ext(u.Path) != \"\" {\n\n\t\treturn filepath.Base(u.Path)\n\t}\n\n\tres, err := http.Head(URL)\n\tif err == nil {\n\t\theader := res.Header\n\t\tif hcd, ok := header[\"Content-Disposition\"]; ok && len(hcd) > 0 {\n\t\t\thcds := strings.Split(hcd[0], \"=\")\n\t\t\tif len(hcds) > 1 {\n\t\t\t\tif filename := hcds[1]; filename != \"\" {\n\t\t\t\t\treturn filepath.Base(filename)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn DefaultFileName\n}", "func getFilename(now *time.Time) string {\n\thour, _, _ := now.Clock()\n\tvar buf [2]byte\n\tbuf[1] = digits[hour%10]\n\thour /= 10\n\tbuf[0] = digits[hour]\n\treturn string(buf[:]) + \".log\"\n}", "func Filename(s string) string {\n\tfilePath := strings.Replace(s, \"..\", \"\", -1)\n\tfilePath = path.Clean(filePath)\n\n\t// Remove illegal characters for paths, flattening accents and replacing some common separators with -\n\tfilePath = cleanString(filePath, illegalPath)\n\n\t// NB this may be of length 0, caller must check\n\treturn filePath\n}", "func generateTitle(filename string) string {\n\tabsPath, err := filepath.Abs(filename)\n\tif err != nil {\n\t\treturn filepath.Base(filename)\n\t}\n\t// First try to find the relative path to the home directory\n\trelPath, err := filepath.Rel(os.Getenv(\"HOME\"), absPath)\n\tif err != nil {\n\t\t// If the relative directory to $HOME could not be found, then just use the base filename\n\t\treturn filepath.Base(filename)\n\t}\n\ttitle := filepath.Join(\"~\", relPath)\n\t// If the relative directory path is too long, just use the base filename\n\tif len(title) >= 30 {\n\t\ttitle = filepath.Base(filename)\n\t}\n\treturn title\n}", "func filename() string {\n\tname := \"results b\" + string('0'+blanktone-38)\n\tif rhfinals {\n\t\tname += \" rhf\"\n\t}\n\treturn name + \".txt\"\n}", "func (socket *Socket) GetFilename() string {\r\n\treturn socket.filename\r\n}", "func (p *Package) Filename() string {\n\treturn fmt.Sprintf(\"%s-%s-%s_%d.tar.bz2\", p.Name, p.Version, p.BuildString, p.BuildNumber)\n}", "func (id Id) Filename() string {\n\treturn strings.Replace(id.String(), \":\", \"-\", -1)\n}", "func getFileName() (string, error) {\n\tif len(os.Args) < 2 {\n\t\treturn \"\", errors.New(\"You need to pass the name of one file\")\n\t}\n\tfileName := os.Args[1]\n\n\treturn fileName, nil\n}", "func (idx *HardlinkIndex) GetFilename(inode uint64, device uint64) string {\n\tidx.m.Lock()\n\tdefer idx.m.Unlock()\n\treturn idx.Index[HardlinkKey{inode, device}]\n}", "func DetermineExecutableFilenameSuffix() string {\n\tfilenameSuffix := \"\"\n\tif runtime.GOOS == \"windows\" {\n\t\tfilenameSuffix = \".exe\"\n\t}\n\treturn filenameSuffix\n}", "func (e Entry) Filename() (string, error) {\n\treturn e.df.Filename(e.name)\n}", "func programName() string {\n\treturn filepath.Base(os.Args[0])\n}", "func GetFileName() string {\n\t_, sourcePath, _, _ := runtime.Caller(4)\n\trootDir, _ := os.Getwd()\n\n\tfilename := strings.TrimSuffix(strings.TrimPrefix(sourcePath, rootDir+\"/\"), \".go\")\n\n\treturn filename\n}", "func (ie *InitEnvironment) GetAbsFilePath(filename string) string {\n\t// Here IsAbs should be enough but unfortunately it doesn't handle absolute paths starting from\n\t// the current drive on windows like `\\users\\noname\\...`. Also it makes it more easy to test and\n\t// will probably be need for archive execution under windows if always consider '/...' as an\n\t// absolute path.\n\tif filename[0] != '/' && filename[0] != '\\\\' && !filepath.IsAbs(filename) {\n\t\tfilename = filepath.Join(ie.CWD.Path, filename)\n\t}\n\tfilename = filepath.Clean(filename)\n\tif filename[0:1] != afero.FilePathSeparator {\n\t\tfilename = afero.FilePathSeparator + filename\n\t}\n\treturn filename\n}", "func TodayFilename() string {\n\t// today := time.Now().Format(\"Jan 02 2006\")\n\ttoday := time.Now().Format(\"2006-01-02\")\n\treturn today + \".log\"\n}", "func FileName(f *os.File,) string", "func createUniqueFileName() string {\n\n\t// Get a timestamp\n\ttv := syscall.Timeval{}\n\tsyscall.Gettimeofday(&tv)\n\tleft := fmt.Sprintf(\"%d.%d\", tv.Sec, tv.Usec)\n\n\t// Just generate a random number for now\n\tb := make([]byte, 16)\n\trand.Read(b)\n\tmiddle := fmt.Sprintf(\"%x\", b)\n\n\t// The right dot should be the hostname\n\tright, _ := os.Hostname()\n\n\t// Put the pieces together\n\tcombined := []string{left, middle, right}\n\treturn strings.Join(combined, \".\")\n}", "func Filename(e *editarea.EditArea) string {\n\t_, fn := filepath.Split(e.Filename)\n\tif e.Saved() {\n\t\treturn fn\n\t}\n\treturn fn + \" *\"\n}", "func (c Comic) FileName() string {\n\treturn fmt.Sprintf(\"%04s\", c.ID()) + \".png\"\n}", "func getFilename(src string) string {\n\trs := []rune(src)\n\ti := strings.LastIndex(src, \"\\\\\")\n\tif i == -1 {\n\t\ti = strings.LastIndex(src, \"/\")\n\t}\n\tres := string(rs[i+1:])\n\tres = strings.Split(res, \".bz2\")[0]\n\treturn res\n}", "func (c *Client) Filename() (string, error) {\n\treturn c.GetProperty(\"filename\")\n}", "func (file File) GetFilename() string {\n\treturn filepath.Base(file.Path)\n}", "func Filename(in string) (name string) {\n\tname, _ = fileAndExt(in, fpb)\n\treturn\n}", "func FileName(name string) string {\n\treturn ReplaceExt(filepath.Base(name), \"\")\n}", "func FILE() string {\n\t_, file, _, _ := runtime.Caller(1)\n\treturn file\n}", "func (l *Logger) getFilename() (filename string) {\n\t// Get current unix timestamp\n\tnow := time.Now().UnixNano()\n\t// Create a filename by:\n\t//\t- Concatinate directory and name\n\t//\t- Append unix timestamp\n\t//\t- Append log extension\n\treturn fmt.Sprintf(\"%s.%d.log\", path.Join(l.dir, l.name), now)\n}", "func GetPlateFilename(filename string) string {\n\t_, file := filepath.Split(filename)\n\tfile = strings.TrimSuffix(file, filepath.Ext(file))\n\tplateFileName := path.Join(config.Opts.PlateDir, file+\".plate.jpg\")\n\treturn plateFileName\n}", "func (r WritableResult) Filename() string {\n\tif len(r.FilePath) == 0 {\n\t\treturn \"\"\n\t}\n\treturn filepath.Base(r.FilePath)\n}", "func FileName(filename string) string {\n\treturn strings.TrimSuffix(filename, filepath.Ext(filename))\n}", "func (c *Config) GetFilename() (filename string) {\n\tfilename = defaultConfigFileName\n\tif len(c.filename) > 0 {\n\t\tfilename = c.filename\n\t}\n\treturn\n}", "func (kvs *FS) filename(key string) string {\n\treturn filepath.Join(kvs.basedir, key)\n}", "func getFilePath(filename string) (string, error) {\n\thome, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfmt.Println(home)\n\tdir, err := filepath.Abs(filepath.Join(home, \"./crawling-data/outs/\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif _, err := os.Stat(dir); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tfmt.Println(err)\n\t\t\tfmt.Println(\"Creando dir\")\n\t\t\tif err := os.MkdirAll(dir, os.ModePerm); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn filepath.Join(dir, filename), nil\n}", "func guessFilename(resp *http.Response) (string, error) {\n\tfilename := resp.Request.URL.Path\n\tif cd := resp.Header.Get(\"Content-Disposition\"); cd != \"\" {\n\t\tif _, params, err := mime.ParseMediaType(cd); err == nil {\n\t\t\tfilename = params[\"filename\"]\n\t\t}\n\t}\n\n\t// sanitize\n\tif filename == \"\" || strings.HasSuffix(filename, \"/\") || strings.Contains(filename, \"\\x00\") {\n\t\treturn \"\", ErrNoFilename\n\t}\n\n\tfilename = filepath.Base(path.Clean(\"/\" + filename))\n\tif filename == \"\" || filename == \".\" || filename == \"/\" {\n\t\treturn \"\", ErrNoFilename\n\t}\n\n\treturn filename, nil\n}", "func Filename() string {\n\tmutex.RLock()\n\tdefer mutex.RUnlock()\n\treturn logFilename\n}", "func (t *Typeface) FileName() string {\n\tif t.URL == nil {\n\t\treturn \"\"\n\t}\n\n\tif t.URL.RawQuery != \"\" {\n\t\t// /l/font?kit=L0xhDFMnlVwD4h3Lt9JWnbX3jG-2X3LAI18&skey=ea73fc1e1d1dfd9a&v=v10#Domine\n\t\tkitUID := t.URL.Query().Get(\"kit\")\n\t\tif kitUID == \"\" {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn kitUID + \".svg\"\n\t}\n\n\tpathParts := strings.Split(t.URL.Path, \"/\")\n\treturn pathParts[len(pathParts)-1]\n}", "func DetermineBazelFilename(version string, includeSuffix bool) (string, error) {\n\tvar machineName string\n\tswitch runtime.GOARCH {\n\tcase \"amd64\":\n\t\tmachineName = \"x86_64\"\n\tcase \"arm64\":\n\t\tmachineName = \"arm64\"\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported machine architecture \\\"%s\\\", must be arm64 or x86_64\", runtime.GOARCH)\n\t}\n\n\tvar osName string\n\tswitch runtime.GOOS {\n\tcase \"darwin\", \"linux\", \"windows\":\n\t\tosName = runtime.GOOS\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported operating system \\\"%s\\\", must be Linux, macOS or Windows\", runtime.GOOS)\n\t}\n\n\tvar filenameSuffix string\n\tif includeSuffix {\n\t\tfilenameSuffix = DetermineExecutableFilenameSuffix()\n\t}\n\n\treturn fmt.Sprintf(\"bazel-%s-%s-%s%s\", version, osName, machineName, filenameSuffix), nil\n}", "func getFilenameFromArgs(conf *cf.Config) string {\n\tflag.Parse()\n\n\tfileName := flag.Arg(0)\n\tif fileName != \"\" && !path.IsAbs(fileName) {\n\t\tcurrDir, _ := os.Getwd()\n\t\tif currDir != conf.BinPath {\n\t\t\tabsName, err := path.Abs(fileName)\n\t\t\tif err == nil {\n\t\t\t\tfileName = absName\n\t\t\t}\n\t\t}\n\t}\n\n\treturn fileName\n}", "func GetDownloadFilename(\n\tresponse *http.Response, nonStableDB bool, desiredVersion string,\n) (string, error) {\n\tfilename := fmt.Sprintf(\"cockroach-%s\", desiredVersion)\n\tif runtime.GOOS == \"windows\" {\n\t\tfilename += \".exe\"\n\t}\n\treturn filename, nil\n}", "func (c *Conn) Filename(dbName string) string {\n\tcname := C.CString(dbName)\n\tdefer C.free(unsafe.Pointer(cname))\n\treturn C.GoString(C.sqlite3_db_filename(c.db, cname))\n}", "func (ref *UIElement) Filename() string {\n\tret, _ := ref.StringAttr(FilenameAttribute)\n\treturn ret\n}", "func (fs *Ipfs) makeFilename(path string) (string, error) {\n\tpaths := strings.Split(path, \"/\")\n\tif len(paths) == 0 {\n\t\treturn \"\", fmt.Errorf(\"path specified does not specify a valid ipfs CID\")\n\t}\n\n\treturn filepath.Join(fs.config.TempDir, paths[len(paths)-1]), nil\n}", "func downloadingFileName(ur string) (string, error) {\n\tu, err := url.Parse(ur)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tss := strings.Split(u.Path, \"/\")\n\treturn ss[len(ss)-1], nil\n}", "func commandName(filename string) string {\n\treturn filepath.Base(strings.ReplaceAll(filename, filepath.Ext(filename), \"\"))\n}", "func determineOutputFilename(outputName string, renderType go_benchpress.RenderType) string {\n\tresult := outputName\n\n\t// If the file extension provided is different from that of the format, change the filename to use the correct\n\t// file extension.\n\text := filepath.Ext(result)\n\tformatExt := renderType.FileExtension()\n\tif ext != formatExt {\n\t\treplaceFrom := strings.LastIndex(result, ext)\n\t\tif replaceFrom != -1 {\n\t\t\tresult = result[:replaceFrom]\n\t\t}\n\t\tresult += formatExt\n\t}\n\n\treturn result\n}", "func (rf *HTTPResFile) FileName() string {\n\treturn filepath.Base(rf.path)\n}", "func (c *Config) PIDFilename() string {\n\tif c.options.PIDFilename == \"\" {\n\t\treturn filepath.Join(c.StoragePath(), \"esp.pid\")\n\t}\n\n\treturn fs.Abs(c.options.PIDFilename)\n}", "func (mf MultipartFilename) Filename() string {\n\n\t// NOTE(dustin): The total filename length is specified in the \"Stream\n\t// Extension\" directory entry that occurs after the primary file entry and\n\t// before these file-name directory-entries, but we don't implement/\n\t// validate that count, here.\n\n\tparts := make([]string, 0)\n\n\tfor _, deRaw := range mf {\n\t\tif fnde, ok := deRaw.(*ExfatFileNameDirectoryEntry); ok == true {\n\t\t\tpart := UnicodeFromAscii(fnde.FileName[:], 15)\n\t\t\tparts = append(parts, part)\n\t\t}\n\t}\n\n\tfilename := strings.Join(parts, \"\")\n\n\treturn filename\n}", "func (e ConnError) Filename() string {\n\treturn e.c.Filename(\"main\")\n}", "func (h *HAProxyManager) filename() string {\n\treturn filepath.Join(h.configDir, h.listenAddr+\".conf\")\n}", "func GetBinaryFileName(name string) string {\n\tif runtime.GOOS == \"windows\" {\n\t\tif !strings.HasSuffix(name, \".exe\") {\n\t\t\treturn name + \".exe\"\n\t\t}\n\t\treturn name\n\t}\n\treturn name\n}", "func GetFinalPathNameAsDOSName(fileName string) (string, error) {\n\tresult, err := GetFinalPathName(fileName, wrappers.FILE_ATTRIBUTE_NORMAL|wrappers.FILE_FLAG_BACKUP_SEMANTICS, wrappers.VOLUME_NAME_DOS)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// GetFinalPathName can return path in the \\?\\ syntax\n\tif strings.HasPrefix(result, \"\\\\\\\\?\\\\\") {\n\t\tresult = result[4:]\n\t}\n\treturn result, nil\n}", "func (configFile *ConfigFile) Filename() string {\n\treturn configFile.filename\n}", "func GetFileBasename(fid, in string) string {\n\tfileBasename := \"\"\n\text := filepath.Ext(in)\n\t// not include only `.`\n\tif len(ext) > 1 {\n\t\tfileBasename = fmt.Sprintf(\"%s%s\", fid, ext)\n\t} else {\n\t\tfileBasename = fid\n\t}\n\t// Only accept utf8\n\tif !utf8.Valid([]byte(in)) {\n\t\treturn fileBasename\n\t}\n\t// Handle Windows filepath\n\tif strings.Contains(in, \"\\\\\") {\n\t\ttokens := strings.Split(in, \"\\\\\")\n\t\treturn tokens[len(tokens)-1]\n\t}\n\t// get clean basename\n\tbasename := filepath.Clean(filepath.Base(in))\n\t// truncate space\n\tbasename = strings.Join(strings.Fields(basename), \"\")\n\t// truncate multibyte\n\tscan := len(basename)\n\tfor scan > 0 {\n\t\t_, size := utf8.DecodeLastRuneInString(basename[:scan])\n\t\t// remove multibyte char\n\t\tif size > 1 {\n\t\t\tbasename = basename[:scan-size] + basename[scan:]\n\t\t}\n\t\tscan -= size\n\t}\n\t// truncate length of basename\n\tif utf8.RuneCountInString(basename) > fileBasenameLength {\n\t\tnumRunes := 0\n\t\tfor idx := range basename {\n\t\t\tnumRunes++\n\t\t\tif numRunes > utf8.RuneCountInString(basename)-fileBasenameLength {\n\t\t\t\treturn basename[idx:]\n\t\t\t}\n\t\t}\n\t}\n\t// encode path\n\tbasename = url.PathEscape(basename)\n\t// Replace url sensitive chars\n\treplacer := strings.NewReplacer(\n\t\t\"#\", \"-\",\n\t\t\"?\", \"-\",\n\t\t\"%\", \"\", // remove %\n\t\t\"+\", \"-\",\n\t\t\"=\", \"-\",\n\t\t\"@\", \"-\",\n\t\t\"$\", \"-\",\n\t\t\"&\", \"-\",\n\t)\n\tbasename = replacer.Replace(basename)\n\tif strings.HasPrefix(basename, \".\") {\n\t\treturn fileBasename\n\t}\n\tif len(basename) == 0 {\n\t\treturn fileBasename\n\t}\n\treturn basename\n}", "func (i *Image) Filename() string {\n\tif i.Type == \"\" {\n\t\treturn i.Name\n\t}\n\treturn fmt.Sprintf(\"%s_%s\", i.Name, i.Type)\n}", "func (p *Part) Filename() string {\n\tif p.gmimePart == nil {\n\t\treturn \"\"\n\t}\n\tif !gobool(C.gmime_is_part(p.gmimePart)) {\n\t\treturn \"\"\n\t}\n\tctype := C.g_mime_part_get_filename((*C.GMimePart)(unsafe.Pointer(p.gmimePart)))\n\treturn C.GoString(ctype)\n}", "func (fs FileStorageSettings) FileName() string {\n\tpath := \"\"\n\tif fs.Type == FileStorageTypeLocal {\n\t\tpath = fs.Local.Path\n\t} else if fs.Type == FileStorageTypeS3 {\n\t\tpath = fs.S3.Key\n\t}\n\treturn filepath.Base(path)\n}", "func (d *DirEntry) FileName() string {\n\tcpointer := (*C.char)(unsafe.Pointer(&d.fileName[0]))\n\tclength := C.int(d.FileNameSize)\n\tfileName := C.GoStringN(cpointer, clength)\n\treturn fileName\n}", "func (attachment *Attachment) GetFilename() string {\n\treturn attachment.GetString(14084)\n}", "func (i *Meta) JobFilename() string {\n\tdest := i.DestTable\n\tif dest != \"\" {\n\t\tdest += shared.PathElementSeparator\n\t}\n\tbaseLocation := \"\"\n\tif i.ProjectID != \"\" {\n\t\tbaseLocation = shared.TempProjectPrefix + i.ProjectID + \":\" + i.Region + \"/\"\n\t}\n\treturn baseLocation + dest + fmt.Sprintf(\"%v_%05d_%v\", i.EventID, i.Step%99999, i.Action) + shared.PathElementSeparator + i.Mode\n}", "func (t Test) BaseFilename() string {\n\tparts := strings.Split(t.Filepath, \"rest-api-spec/test\")\n\tif len(parts) < 1 {\n\t\tpanic(fmt.Sprintf(\"Unexpected parts for path [%s]: %s\", t.Filepath, parts))\n\t}\n\treturn strings.TrimPrefix(parts[1], string(filepath.Separator))\n}", "func (x ExportResult) Filename() (string) {\n _, filename := filepath.Split(x.Path)\n return filename\n}", "func FileName(createTime time.Time) string {\n\t// Copied from https://github.com/dyweb/dy-bot/blob/2fedb230d6ba21f0ebb9f1091f27d8482c331772/pkg/util/weeklyutil/weekly.go#L11\n\tsecondsEastOfUTC := int((8 * time.Hour).Seconds())\n\tbeijing := time.FixedZone(\"Beijing Time\", secondsEastOfUTC)\n\n\tcfg := now.Config{\n\t\tWeekStartDay: time.Monday,\n\t\tTimeLocation: beijing,\n\t}\n\tdate := cfg.With(createTime).BeginningOfWeek()\n\treturn fmt.Sprintf(\"%d/%d-%.2d-%.2d-weekly.md\", date.Year(), date.Year(), int(date.Month()), date.Day())\n}", "func GetFileName(path string) string {\n\titems := strings.Split(path, string(os.PathSeparator))\n\tif len(items) <= 1 {\n\t\treturn path\n\t}\n\treturn items[len(items)-1]\n}", "func shortFileName(file string) string {\n\treturn filepath.Base(file)\n}", "func getFullPath(fileName string) (string, error) {\n\t//from where i am calling the program\n\tworkingDir, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Invalid working dir\")\n\t}\n\n\treturn workingDir + \"/\" + fileName, nil\n}", "func (cache *FileCache) GetFileName(key string) string {\n\tpath := filepath.Join(cache.dir, key)\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn \"\"\n\t}\n\tif abs, err := filepath.Abs(path); err == nil {\n\t\treturn abs\n\t}\n\treturn \"\"\n}", "func (dp *Dumper) Filename(key registry.ServiceKey) string {\n\tdp.once.Do(func() {\n\t\terr := os.MkdirAll(dp.dir, 0755)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"os.MkdirAll(%s): %+v\", dp.dir, err)\n\t\t}\n\t})\n\n\treturn filepath.Join(dp.dir, key.ToString())\n}", "func GetSaveFileName(parentHWND unsafe.Pointer, title string, filter FileFilter, initialDir string) (string, bool, error) {\n\tvar ofn *TagOFNA\n\tvar err error\n\tflags := HideReadOnly | PathMustExist | NoChangeDir | OverwritePrompt\n\tif ofn, err = NewTagOFNA(parentHWND, title, filter, initialDir, flags); err != nil {\n\t\treturn \"\", false, err\n\t}\n\tbuf := make([]uint16, 1024)\n\tofn.LpstrFile = &buf[0]\n\tofn.NMaxFile = 1024\n\tret, _, _ := procGetSaveFileName.Call(uintptr(unsafe.Pointer(ofn)))\n\tif ret == 0 {\n\t\treturn \"\", false, nil\n\t}\n\tstr := syscall.UTF16ToString(buf)\n\treturn str, true, nil\n}", "func GenerateFileName(fileName, extension string) (string, error) {\n\tif fileName == \"\" {\n\t\treturn \"\", fmt.Errorf(\"%w missing filename\", errCannotGenerateFileName)\n\t}\n\tif extension == \"\" {\n\t\treturn \"\", fmt.Errorf(\"%w missing filename extension\", errCannotGenerateFileName)\n\t}\n\n\treg := regexp.MustCompile(`[\\w-]`)\n\tparsedFileName := reg.FindAllString(fileName, -1)\n\tparsedExtension := reg.FindAllString(extension, -1)\n\tfileName = strings.Join(parsedFileName, \"\") + \".\" + strings.Join(parsedExtension, \"\")\n\n\treturn strings.ToLower(fileName), nil\n}", "func (r RepoConfig) Filename(base string) string {\n\tif r.OutputFilename != \"\" {\n\t\treturn r.OutputFilename\n\t}\n\n\treturn path.Join(base, fmt.Sprintf(\"%s.json\", r.Name))\n}", "func (c *Config) GetFileName() string {\n\treturn c.defaultName\n}", "func (c *DeploymentConfig) FileName() string {\n\treturn fmt.Sprintf(\"%s/deployments/%s/config.yml\", c.root, c.deployment)\n}", "func getFilename(path string) (string, error) {\n\tparsedURL, err := url.Parse(path)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error parsing url: %w\", err)\n\t}\n\t_, filename := filepath.Split(parsedURL.Path)\n\treturn filename, nil\n}", "func (s Settings) DstFilename() string {\n\tif s.enumType == \"\" {\n\t\treturn \"\"\n\t}\n\tif s.dstDir == \"\" {\n\t\ts.dstDir, _ = os.Getwd()\n\t}\n\treturn filepath.Join(s.dstDir, naming.SnakeCase(s.enumType)+goFileExt)\n}", "func getFilename(p provider.Provider, r *http.Request) (string, error) {\n\t// We expect that if we're dealing with a proxy provider, that we have a\n\t// `?url=` on the URL.\n\tif _, ok := p.(*provider.Proxy); ok {\n\t\t// Get the URL parameter from the filename.\n\t\turl := r.URL.Query().Get(\"url\")\n\n\t\t// To include the scheme, it must be at least 7 characters:\n\t\t//\n\t\t// http://\n\t\t//\n\t\tif len(url) <= 7 {\n\t\t\treturn \"\", ErrFilenameTooShort\n\t\t}\n\n\t\treturn url, nil\n\t}\n\n\t// We expect that the router sends us requests in the form `/:filename`\n\t// so we check to see if the path contains the image url that we want to\n\t// parse. In this case, we check to see that the path is at least 9 characters\n\t// long, which will ensure that the filename has at least 1 character.\n\tif len(r.URL.Path) < 2 {\n\t\treturn \"\", ErrFilenameTooShort\n\t}\n\n\treturn r.URL.Path[1:], nil\n}", "func BaseName(filename string) string {\n\treturn filepath.Base(filename)\n}", "func obtainExecutableFilename(search string) string {\n\tif cmdOptions.Product == \"gpdb\" { // Get the binary file name\n\t\treturn findBinaryFile(search, cmdOptions.Version)\n\t} else if cmdOptions.Product == \"gpcc\" { // GPCC binaries\n\t\tif isThis4x() { // newer directory\n\t\t\t// Get the binary file name\n\t\t\tbinFile, _ := FilterDirsGlob(Config.DOWNLOAD.DOWNLOADDIR, fmt.Sprintf(\"%[1]s/%[1]s\", search))\n\t\t\tif len(binFile) > 0 {\n\t\t\t\treturn binFile[0]\n\t\t\t} else {\n\t\t\t\tFatalf(\"No binaries found for the product %s with version %s under directory %s\", cmdOptions.Product, cmdOptions.CCVersion, Config.DOWNLOAD.DOWNLOADDIR)\n\t\t\t}\n\t\t} else { // older directory\n\t\t\treturn findBinaryFile(search, cmdOptions.CCVersion)\n\t\t}\n\t} else { // Should never reach here since we only accept gpdb and gpcc only, if it does then print the error below\n\t\tFatalf(\"Don't know the installation tag for product provided: %s\", cmdOptions.Product)\n\t}\n\treturn \"\"\n}", "func (o *PlatformImage) GetFilenameOk() (*string, bool) {\n\tif o == nil || o.Filename == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Filename, true\n}", "func Abs(filename string) string {\n\tpath, err := filepath.Abs(filename)\n\tif err != nil {\n\t\treturn filename\n\t}\n\treturn path\n}", "func createFilename(filePath string, documentPath string) string {\n\t_, dcFn := filepath.Split(documentPath)\n\n\t// if no filePath is specified then use the documentpath\n\tif len(filePath) == 0 {\n\t\t// take document filename, strip suffix, then use that.\n\t\t// local directory in that case.\n\t\treturn strings.TrimSuffix(dcFn, filepath.Ext(documentPath))\n\t}\n\n\tfpDir, fpFn := filepath.Split(filePath)\n\n\tif IsDir(filePath) {\n\t\t// need to make sure fbFn is not a directory\n\t\tfpDir = filepath.Clean(filePath)\n\t\tfpFn = \"\"\n\t}\n\n\tif len(fpFn) == 0 {\n\t\t// filepath directory but not file\n\t\tfp := strings.TrimSuffix(dcFn, filepath.Ext(dcFn))\n\t\treturn filepath.Join(fpDir, fp)\n\t}\n\n\treturn strings.TrimSuffix(filePath, filepath.Ext(filePath))\n}", "func getFile(fileName string) string {\n\twd, _ := os.Getwd()\n\n\tif !strings.HasSuffix(wd, \"file\") {\n\t\twd += \"\"\n\t}\n\n\treturn wd + \"/\" + fileName\n}", "func (c *Config) Filename() string {\n\treturn c.filename\n}", "func GetFilePath(url string) string {\n\treturn fileNameRE.ReplaceAllLiteralString(url, \"-\")\n}", "func getOptFileName(filename string) string {\n\treturn genLib.SplitFilePath(filename, \"opt\").OutputNewExt\n}", "func GenerateFileName(dir, name, issueNumber, format string) string {\n\treturn fmt.Sprintf(\"%s/%s-%s.%s\", dir, name, issueNumber, format)\n}" ]
[ "0.72051346", "0.6865569", "0.65848285", "0.65466267", "0.65000707", "0.64210916", "0.6379323", "0.6375483", "0.6336399", "0.63012487", "0.63003117", "0.6290895", "0.6288496", "0.62345266", "0.62114173", "0.61891854", "0.6177012", "0.61716574", "0.614597", "0.6145935", "0.6132704", "0.61155313", "0.610197", "0.60924494", "0.60833323", "0.607703", "0.6072587", "0.6063341", "0.60288256", "0.60223156", "0.60186166", "0.59964705", "0.5988107", "0.59519917", "0.59506005", "0.59410214", "0.59378636", "0.5934748", "0.5906793", "0.59045106", "0.5862438", "0.5856236", "0.58439773", "0.584201", "0.5818316", "0.5815914", "0.58148324", "0.58008426", "0.5799322", "0.5796237", "0.57909197", "0.57908463", "0.5779212", "0.5773244", "0.5772743", "0.5765025", "0.57580924", "0.5757401", "0.57572454", "0.57552856", "0.5752959", "0.5752512", "0.5748715", "0.5747973", "0.5745834", "0.5740819", "0.57401097", "0.5733086", "0.5729121", "0.5726812", "0.5725117", "0.57080966", "0.5704299", "0.569221", "0.56909734", "0.5684744", "0.5684104", "0.56801265", "0.567849", "0.5665534", "0.5642672", "0.5636983", "0.5635727", "0.563367", "0.5607651", "0.55999845", "0.5595153", "0.55946994", "0.5585806", "0.5584684", "0.5574445", "0.5573478", "0.55702114", "0.5566875", "0.55536604", "0.55526614", "0.55421543", "0.55396384", "0.55338734", "0.5519815" ]
0.57931376
50
CheckLock tries to obtain an exclude lock on a lockfile and returns an error if one occurs
func (s *Single) CheckLock() error { if err := os.Remove(s.Filename()); err != nil && !os.IsNotExist(err) { return ErrAlreadyRunning } file, err := os.OpenFile(s.Filename(), os.O_EXCL|os.O_CREATE, 0600) if err != nil { return err } s.file = file return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestGetLock(t *testing.T) {\n\tlockfile := lockOrFail(t)\n\tdefer removeTestLock(lockfile)\n}", "func checkTrylockMainProcess(t *testing.T) {\n\tvar err error\n\tlockfile := lockOrFail(t)\n\tdefer removeTestLock(lockfile)\n\tlockdir := filepath.Dir(lockfile.File.Name())\n\totherAcquired, message, err := forkAndGetLock(lockdir)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error in subprocess trying to lock uncontested fileLock: %v. Subprocess output: %q\", err, message)\n\t}\n\tif !otherAcquired {\n\t\tt.Fatalf(\"Subprocess failed to lock uncontested fileLock. Subprocess output: %q\", message)\n\t}\n\n\terr = lockfile.tryLock()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to lock fileLock: %v\", err)\n\t}\n\n\treacquired, message, err := forkAndGetLock(filepath.Dir(lockfile.File.Name()))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif reacquired {\n\t\tt.Fatalf(\"Permitted locking fileLock twice. Subprocess output: %q\", message)\n\t}\n\n\terr = lockfile.Unlock()\n\tif err != nil {\n\t\tt.Fatalf(\"Error unlocking fileLock: %v\", err)\n\t}\n\n\treacquired, message, err = forkAndGetLock(filepath.Dir(lockfile.File.Name()))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reacquired {\n\t\tt.Fatalf(\"Subprocess failed to acquire lock after it was released by the main process. Subprocess output: %q\", message)\n\t}\n}", "func (l *FileLock) ExclusiveLock() error {\n\treturn syscall.Flock(l.fd, syscall.LOCK_EX)\n}", "func (l *fileLock) tryLock() (Unlocker, error) {\n\tl.mu.Lock()\n\terr := syscall.Flock(l.fd, syscall.LOCK_EX|syscall.LOCK_NB)\n\tswitch err {\n\tcase syscall.EWOULDBLOCK:\n\t\tl.mu.Unlock()\n\t\treturn nopUnlocker{}, nil\n\tcase nil:\n\t\treturn l, nil\n\tdefault:\n\t\tl.mu.Unlock()\n\t\treturn nil, err\n\t}\n}", "func HasLock(basepath string) bool {\n\t_, err := os.Stat(filepath.Join(basepath, LockFile))\n\treturn err == nil\n}", "func (g GoroutineLock) CheckNotOn() {\n\tif getGoroutineID() == goroutineID(g) {\n\t\tpanic(\"running on the wrong goroutine\")\n\t}\n}", "func (r *Locking) MustUnlock() (Result, error) {\n\treturn r.delete()\n}", "func (f *volatileFile) CheckReservedLock() bool {\n\tf.mu.RLock()\n\tdefer f.mu.RUnlock()\n\n\treturn f.reserved > 0 || f.pending > 0 || f.exclusive > 0\n}", "func (wbc *WriteBackConfig) RequiresLocking() bool {\n\tswitch wbc.Method {\n\tcase WriteBackGit:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func obtainLock(lock lockfile.Lockfile) error {\n\t// Check if the lock has any owner.\n\tprocess, err := lock.GetOwner()\n\tif err == nil {\n\t\t// A lock already exists. Check if the lock owner is the current process\n\t\t// itself.\n\t\tif process.Pid == os.Getpid() {\n\t\t\treturn fmt.Errorf(\"lockfile %q already locked by this process\", lock)\n\t\t}\n\n\t\t// A lock already exists, but it's owned by some other process. Continue\n\t\t// to obtain lock, in case the lock owner no longer exists.\n\t}\n\n\t// Obtain a lock. Retry if the lock can't be obtained.\n\terr = lock.TryLock()\n\tfor err != nil {\n\t\t// Check if it's a lock temporary error that can be mitigated with a\n\t\t// retry. Fail if any other error.\n\t\tif _, ok := err.(interface{ Temporary() bool }); !ok {\n\t\t\treturn fmt.Errorf(\"unable to lock %q: %v\", lock, err)\n\t\t}\n\t\terr = lock.TryLock()\n\t}\n\n\treturn nil\n}", "func (st *fakeConn) TryLock(ctx context.Context, dirPath, contents string) (lock LockDescriptor, err error) {\n\tif st.readOnly {\n\t\treturn nil, vterrors.Errorf(vtrpc.Code_READ_ONLY, \"topo server connection is read-only\")\n\t}\n\tif dirPath == \"error\" {\n\t\treturn lock, fmt.Errorf(\"dummy error\")\n\n\t}\n\treturn lock, err\n}", "func checkYarnLock(pwd string) bool {\n\tyarnFile := filepath.Join(pwd, \"yarn.lock\")\n\t_, err := os.Stat(yarnFile)\n\treturn err == nil\n}", "func Test_BlockedLock(t *testing.T) {\n\tkey := \"Test_BlockedLock\"\n\tconn, err := redigo.Dial(\"tcp\", RedisHost)\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"redigo.Dial failure [%s]\", err))\n\t}\n\n\tlock1 := New(conn, key, 2001, 2000)\n\n\tstatus, err := lock1.Lock()\n\tdefer lock1.UnlockIfLocked()\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"lock operation failed [%s]\", err))\n\t}\n\n\tif !status {\n\t\tt.Error(\"lock acquisition failed\")\n\t}\n\n\tlock2 := New(conn, key, 1000)\n\n\tstatus, err = lock2.Lock()\n\tdefer lock2.UnlockIfLocked()\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"lock operation failed [%s]\", err))\n\t}\n\n\tif status {\n\t\tt.Error(\"lock acquisition succeeded\")\n\t}\n}", "func (l *FileLock) TryExclusiveLock() error {\n\terr := syscall.Flock(l.fd, syscall.LOCK_EX|syscall.LOCK_NB)\n\tif err == syscall.EWOULDBLOCK {\n\t\terr = ErrLocked\n\t}\n\treturn err\n}", "func (f *FileLock) GetLock(lockFile string) bool {\n\tf.f_lock = flock.New(lockFile)\n\tis_locked, err := f.f_lock.TryLock()\n\tf.is_locked = is_locked\n\n\tif err != nil { // some OS error attempting to obtain a file lock\n\t\tlog.Errorf(\"unable to obtain a lock on %s\\n\", lockFile)\n\t\treturn false\n\t}\n\tif !f.is_locked { // another process is running.\n\t\treturn false\n\t}\n\n\treturn f.is_locked\n}", "func CheckLock(path string) bool {\n\tlockByte, _ := exec.Command(\"lsof\", \"-w\", \"-F\", \"ln\", path).Output()\n\tlocks := string(lockByte)\n\tif locks == \"\" {\n\t\treturn false\n\t}\n\treadWriteLock := strings.Split(locks, \"\\n\")[2]\n\treturn readWriteLock == \"lR\" || readWriteLock == \"lW\"\n}", "func LockFileExists(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {\n\tfname := p.Get(\"filename\", \"glide.lock\").(string)\n\tif _, err := os.Stat(fname); err != nil {\n\t\tInfo(\"Lock file (glide.lock) does not exist. Performing update.\")\n\t\treturn false, &cookoo.Reroute{\"update\"}\n\t}\n\n\treturn true, nil\n}", "func (f *Flock) TryLock() (bool, error) {\n\treturn f.try(&f.l, winLockfileExclusiveLock)\n}", "func (g GoroutineLock) Check() {\n\tif getGoroutineID() != goroutineID(g) {\n\t\tpanic(\"running on the wrong goroutine\")\n\t}\n}", "func (r *RedisDB) TryLock(newLock models.ProjectLock) (bool, models.ProjectLock, error) {\n\tvar currLock models.ProjectLock\n\tkey := r.lockKey(newLock.Project, newLock.Workspace)\n\tnewLockSerialized, _ := json.Marshal(newLock)\n\n\tval, err := r.client.Get(ctx, key).Result()\n\t// if there is no run at that key then we're free to create the lock\n\tif err == redis.Nil {\n\t\terr := r.client.Set(ctx, key, newLockSerialized, 0).Err()\n\t\tif err != nil {\n\t\t\treturn false, currLock, errors.Wrap(err, \"db transaction failed\")\n\t\t}\n\t\treturn true, newLock, nil\n\t} else if err != nil {\n\t\t// otherwise the lock fails, return to caller the run that's holding the lock\n\t\treturn false, currLock, errors.Wrap(err, \"db transaction failed\")\n\t} else {\n\t\tif err := json.Unmarshal([]byte(val), &currLock); err != nil {\n\t\t\treturn false, currLock, errors.Wrap(err, \"failed to deserialize current lock\")\n\t\t}\n\t\treturn false, currLock, nil\n\t}\n}", "func getLockAndExit(lockpath string) {\n\tfmt.Printf(\"Will lock path %q\\n\", lockpath)\n\tlockfile, err := newLock(lockpath)\n\texitStatus := unexpectedError\n\tif err == nil {\n\t\terr = lockfile.tryLock()\n\t\tif err == nil {\n\t\t\texitStatus = successStatus\n\t\t} else {\n\t\t\texitStatus = busyStatus\n\t\t}\n\t}\n\tfmt.Printf(\"Tried to lock path %s. Received error %v. Exiting with status %v\\n\", lockpath, err, exitStatus)\n\tos.Exit(exitStatus)\n}", "func (*dir) Lock(pid, locktype, flags int, start, length uint64, client string) error {\n\treturn nil\n}", "func (service LockService) Locked(group *scaley.Group) bool {\n\treturn FileExists(lockfile(group))\n}", "func FindAndLoadLock() (lock *Lock) {\n\tvar err error\n\n\tpath, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\tif err != nil {\n\t\tprinter.Fatal(\n\t\t\terr,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"kombustion.lock may need to be corrupted and needs to be rebuilt. Run `kombustion install` to fix this.\",\n\t\t\t),\n\t\t\t\"https://www.kombustion.io/api/cli/#install\",\n\t\t)\n\t}\n\n\tlock, err = findAndLoadLock(path)\n\tif err != nil {\n\t\tprinter.Fatal(\n\t\t\terr,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"kombustion.lock may need to be corrupted and needs to be rebuilt. Run `kombustion install` to fix this.\",\n\t\t\t),\n\t\t\t\"https://www.kombustion.io/api/cli/#install\",\n\t\t)\n\t}\n\n\tif lock == nil {\n\t\tlock = &Lock{}\n\t\tlock.Plugins = make(map[string]Plugin)\n\t}\n\treturn\n}", "func (lt *LockTimeout) TryLock() int {\n\tbrv := atomic.CompareAndSwapInt32(&lt.frontLock, 0, 1)\n\tif brv {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func (f *FileLock) TryLock() error {\n\treturn f.performLock(f.flockType | syscall.LOCK_NB)\n}", "func TestLockAndUnlock(t *testing.T) {\n\tf, err := ioutil.TempFile(\"\", \"lock\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tf.Close()\n\tdefer func() {\n\t\terr = os.Remove(f.Name())\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\t// lock the file\n\tl, err := LockedOpenFile(f.Name(), os.O_WRONLY, 0600)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// unlock the file\n\tif err = l.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// try lock the unlocked file\n\tdupl, err := LockedOpenFile(f.Name(), os.O_WRONLY|os.O_CREATE, 0600)\n\tif err != nil {\n\t\tt.Errorf(\"err = %v, want %v\", err, nil)\n\t}\n\n\t// blocking on locked file\n\tlocked := make(chan struct{}, 1)\n\tgo func() {\n\t\tbl, blerr := LockedOpenFile(f.Name(), os.O_WRONLY, 0600)\n\t\tif blerr != nil {\n\t\t\tt.Error(blerr)\n\t\t\treturn\n\t\t}\n\t\tlocked <- struct{}{}\n\t\tif blerr = bl.Close(); blerr != nil {\n\t\t\tt.Error(blerr)\n\t\t\treturn\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-locked:\n\t\tt.Error(\"unexpected unblocking\")\n\tcase <-time.After(100 * time.Millisecond):\n\t}\n\n\t// unlock\n\tif err = dupl.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// the previously blocked routine should be unblocked\n\tselect {\n\tcase <-locked:\n\tcase <-time.After(1 * time.Second):\n\t\tt.Error(\"unexpected blocking\")\n\t}\n}", "func canIncreaseLock(obj *object, ll LockLevel) bool {\n\tif obj.firstWaiter != nil {\n\t\treturn false\n\t} else if len(obj.locks) == 1 {\n\t\treturn true\n\t}\n\treturn lockSharing[obj.level][ll]\n}", "func (di *distLockInstance) GetLock(timeout *dynamicTimeout) (timedOutErr error) {\n\tlockSource := getSource()\n\tstart := UTCNow()\n\n\tif !di.rwMutex.GetLock(di.opsID, lockSource, timeout.Timeout()) {\n\t\ttimeout.LogFailure()\n\t\treturn OperationTimedOut{Path: di.path}\n\t}\n\ttimeout.LogSuccess(UTCNow().Sub(start))\n\treturn nil\n}", "func (li *localLockInstance) GetLock(timeout *dynamicTimeout) (timedOutErr error) {\n\tlockSource := getSource()\n\tstart := UTCNow()\n\treadLock := false\n\tif !li.ns.lock(li.ctx, li.volume, li.path, lockSource, li.opsID, readLock, timeout.Timeout()) {\n\t\ttimeout.LogFailure()\n\t\treturn OperationTimedOut{Path: li.path}\n\t}\n\ttimeout.LogSuccess(UTCNow().Sub(start))\n\treturn\n}", "func checkAppidLock(appid string, logId int64) bool {\n\tconn := initDbConn(logId)\n\tdefer conn.Close()\n\tsqlc := \"select count(*) from appidActLock where appid = '\" + appid + \"'\"\n\trows, errc := conn.Query(sqlc)\n\tif errc != nil {\n\t\taddErrorLog(logId, \"check appid if locked error:\", errc)\n\t\treturn false\n\t}\n\tvar appnum int\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&appnum); err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tif appnum > 0 {\n\t\taddLog(logId, \"The appid has already locked!\", appid)\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (mfs *MinFS) IsLocked(path string) bool {\n\tmfs.m.Lock()\n\tdefer mfs.m.Unlock()\n\n\t_, ok := mfs.locks[path]\n\treturn ok\n}", "func (s *Single) TryUnlock() error {\n\tif err := s.file.Close(); err != nil {\n\t\treturn fmt.Errorf(\"failed to close the lock file: %v\", err)\n\t}\n\tif err := os.Remove(s.Filename()); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove the lock file: %v\", err)\n\t}\n\treturn nil\n}", "func (l *lock) TryLock(ctx context.Context, key string) (bool, error) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tif l.locked {\n\t\treturn false, nil\n\t}\n\n\tkeyInt64 := crushkey(key)\n\n\t// start transaction\n\ttx, err := l.db.Beginx()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// attempt to acquire lock\n\tvar acquired bool\n\n\terr = tx.Get(&acquired, manifestAdvisoryLock, keyInt64)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn false, fmt.Errorf(\"failed to issue pg_advisory lock query: %v\", err)\n\t}\n\n\t// if acquired set lock status which unblocks caller waiting on Lock() method\n\t// and populate tx which will be Commited on Unlock()\n\tif acquired {\n\t\tl.locked = true\n\t\t// hold this tx until Unlock() is called!\n\t\tl.tx = tx\n\t\treturn true, nil\n\t}\n\n\t// we did not acquire the lock\n\ttx.Rollback()\n\treturn false, nil\n}", "func findAndLoadLock(path string) (lock Lock, err error) {\n\tvar lockPath string\n\tfoundLock := false\n\n\tif _, err := os.Stat(path + \"/kombustion.lock\"); err == nil {\n\t\tlockPath = path + \"/kombustion.lock\"\n\t\tfoundLock = true\n\t}\n\n\tif foundLock {\n\t\t// Read the Lock file\n\t\tdata, err := ioutil.ReadFile(lockPath)\n\t\tif err != nil {\n\t\t\treturn lock, err\n\t\t}\n\n\t\tlock, err := loadLockFromString(data)\n\t\tif err != nil {\n\t\t\treturn lock, err\n\t\t}\n\t\treturn lock, err\n\t}\n\t// We didn't find a lock file\n\treturn lock, nil\n}", "func (l *lock) TryLock() error {\n\terr := os.Chmod(l.fname, syscall.DMEXCL|0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, err := os.Open(l.fname)\n\tif err != nil {\n\t\treturn ErrLocked\n\t}\n\n\tl.file = f\n\treturn nil\n}", "func (st *fakeConn) Lock(ctx context.Context, dirPath, contents string) (lock LockDescriptor, err error) {\n\tif st.readOnly {\n\t\treturn nil, vterrors.Errorf(vtrpc.Code_READ_ONLY, \"topo server connection is read-only\")\n\t}\n\tif dirPath == \"error\" {\n\t\treturn lock, fmt.Errorf(\"dummy error\")\n\n\t}\n\treturn lock, err\n}", "func findAndLoadLock(path string) (lock *Lock, err error) {\n\tvar lockPath string\n\tfoundLock := false\n\n\tif _, err := os.Stat(path + \"/kombustion.lock\"); err == nil {\n\t\tlockPath = path + \"/kombustion.lock\"\n\t\tfoundLock = true\n\t}\n\n\tif foundLock {\n\t\t// Read the Lock file\n\t\tdata, err := ioutil.ReadFile(lockPath)\n\t\tif err != nil {\n\t\t\treturn lock, err\n\t\t}\n\n\t\tlock, err := loadLockFromString(data)\n\t\tif err != nil {\n\t\t\treturn lock, err\n\t\t}\n\t\treturn lock, err\n\t}\n\t// We didn't find a lock file\n\treturn lock, nil\n}", "func (e Locked) IsLocked() {}", "func checkLockedValidFormatFS(fsPath string) (*lock.RLockedFile, error) {\n\tfsFormatPath := pathJoin(fsPath, minioMetaBucket, formatConfigFile)\n\n\trlk, err := lock.RLockedOpenFile((fsFormatPath))\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\t// If format.json not found then\n\t\t\t// its an unformatted disk.\n\t\t\treturn nil, traceError(errUnformattedDisk)\n\t\t}\n\t\treturn nil, traceError(err)\n\t}\n\n\tvar format = &formatConfigV1{}\n\tif err = format.LoadFormat(rlk.LockedFile); err != nil {\n\t\trlk.Close()\n\t\treturn nil, err\n\t}\n\n\t// Check format FS.\n\tif err = format.CheckFS(); err != nil {\n\t\trlk.Close()\n\t\treturn nil, err\n\t}\n\n\t// Always return read lock here and should be closed by the caller.\n\treturn rlk, traceError(err)\n}", "func (n *nsLockMap) lock(ctx context.Context, volume, path string, lockSource, opsID string, readLock bool, timeout time.Duration) (locked bool) {\n\tvar nsLk *nsLock\n\n\tn.lockMapMutex.Lock()\n\tparam := nsParam{volume, path}\n\tnsLk, found := n.lockMap[param]\n\tif !found {\n\t\tn.lockMap[param] = &nsLock{\n\t\t\tLRWMutex: lsync.NewLRWMutex(ctx),\n\t\t\tref: 1,\n\t\t}\n\t\tnsLk = n.lockMap[param]\n\t} else {\n\t\t// Update ref count here to avoid multiple races.\n\t\tnsLk.ref++\n\t}\n\tn.lockMapMutex.Unlock()\n\n\t// Locking here will block (until timeout).\n\tif readLock {\n\t\tlocked = nsLk.GetRLock(opsID, lockSource, timeout)\n\t} else {\n\t\tlocked = nsLk.GetLock(opsID, lockSource, timeout)\n\t}\n\n\tif !locked { // We failed to get the lock\n\n\t\t// Decrement ref count since we failed to get the lock\n\t\tn.lockMapMutex.Lock()\n\t\tnsLk.ref--\n\t\tif nsLk.ref == 0 {\n\t\t\t// Remove from the map if there are no more references.\n\t\t\tdelete(n.lockMap, param)\n\t\t}\n\t\tn.lockMapMutex.Unlock()\n\t}\n\treturn\n}", "func CommandLocked(appName string) error {\n\tif err := common.VerifyAppName(appName); err != nil {\n\t\treturn err\n\t}\n\n\tif appIsLocked(appName) {\n\t\tcommon.LogQuiet(\"Deploy lock exists\")\n\t\treturn nil\n\n\t}\n\treturn errors.New(\"Deploy lock does not exist\")\n}", "func (l *Lock) Lock() (err error) {\n\tstart := time.Now()\n\t// continually try to lock\n\tfor {\n\t\t// try to open+create file and error if it already exists\n\t\tl.f, err = fs.OpenFile(l.name, os.O_CREATE|os.O_EXCL, 0755)\n\t\tif err != nil {\n\t\t\t// if not using a timeout, return an error\n\t\t\tif l.timeout.Nanoseconds() == 0 {\n\t\t\t\treturn errors.New(\"could not obtain lock\")\n\t\t\t} else {\n\t\t\t\t// we are using a timeout, wait for lock\n\t\t\t\ttime.Sleep(l.interval)\n\t\t\t}\n\t\t} else {\n\t\t\t// no error, close file\n\t\t\t// and break out of loop\n\t\t\terr = l.f.Close()\n\t\t\tbreak\n\t\t}\n\t\t// check if we are using a timeout\n\t\tif l.timeout.Nanoseconds() > 0 {\n\t\t\t// check if timeout is exceeded and return error\n\t\t\tif time.Since(start).Nanoseconds() > l.timeout.Nanoseconds() {\n\t\t\t\treturn errors.New(\"could not obtain lock, timeout\")\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (f *FLock) TryLock(timeout time.Duration) error {\n\tf.locker.Lock()\n\tdefer f.locker.Unlock()\n\tif err := f.openLockFile(); err != nil {\n\t\treturn err\n\t}\n\tif err := wait.Poll(300*time.Millisecond, timeout, f.tryLock); err != nil {\n\t\tif closeErr := f.closeLockedFile(); closeErr != nil {\n\t\t\treturn closeErr\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "func (f *Flock) TryRLock() (bool, error) {\n\treturn f.try(&f.r, winLockfileSharedLock)\n}", "func (cl *CacheLock) TryLock(addr string) (busy bool, wait chan struct{}, done func()) {\n\tcl.mtx.Lock()\n\tdefer cl.mtx.Unlock()\n\tdone = func() {}\n\twait, busy = cl.addrs[addr]\n\tif !busy {\n\t\tdone = cl.hold(addr)\n\t}\n\treturn busy, wait, done\n}", "func (es *EtcdService) TryLock(system string, collection string) (storages.Lock, error) {\n\tctx, cancel := context.WithDeadline(es.ctx, time.Now().Add(2*time.Minute))\n\n\t//the session depends on the context. We can't cancel() before unlock.\n\tsession, sessionError := concurrency.NewSession(es.client, concurrency.WithContext(ctx))\n\tif sessionError != nil {\n\t\tcancel()\n\t\treturn nil, sessionError\n\t}\n\tidentifier := system + \"_\" + collection\n\tl := concurrency.NewMutex(session, identifier)\n\n\tif err := l.TryLock(ctx); err != nil {\n\t\tcancel()\n\t\tif err == concurrency.ErrLocked {\n\t\t\treturn nil, ErrAlreadyLocked\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\tlock := storages.NewRetryableLock(identifier, l, session, cancel, 5)\n\n\tes.mutex.Lock()\n\tes.unlockMe[identifier] = lock\n\tes.mutex.Unlock()\n\n\treturn lock, nil\n}", "func (lf *LockFile) LockExists() bool {\n\tif lf.ConsulAddress == \"\" {\n\t\tif _, err := os.Stat(lf.Path); os.IsNotExist(err) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\tvalue, err := GetStringValueFromConsul(lf.ConsulAddress, lf.Path)\n\tif err != nil && value == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func TryExclusiveLock(path string, lockType LockType) (*FileLock, error) {\n\tl, err := NewLock(path, lockType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = l.TryExclusiveLock()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn l, err\n}", "func shouldCopyLockFile(args []string) bool {\n\tif util.FirstArg(args) == CommandNameInit {\n\t\treturn true\n\t}\n\n\tif util.FirstArg(args) == CommandNameProviders && util.SecondArg(args) == CommandNameLock {\n\t\treturn true\n\t}\n\treturn false\n}", "func ExclusiveLock(path string, lockType LockType) (*FileLock, error) {\n\tl, err := NewLock(path, lockType)\n\tif err == nil {\n\t\terr = l.ExclusiveLock()\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn l, nil\n}", "func testNonNilTimeoutLock(ctx context.Context, t *testing.T, w *Wallet) {\n\ttimeChan := make(chan time.Time)\n\terr := w.Unlock(ctx, testPrivPass, timeChan)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\ttimeChan <- time.Time{}\n\ttime.Sleep(100 * time.Millisecond) // Allow time for lock in background\n\tif !w.Locked() {\n\t\tt.Fatal(\"wallet should have locked after timeout\")\n\t}\n}", "func checkShardLockUnblocks(t *testing.T, ts topo.Server) {\n\tunblock := make(chan struct{})\n\tfinished := make(chan struct{})\n\n\t// as soon as we're unblocked, we try to lock the shard\n\tgo func() {\n\t\t<-unblock\n\t\tctx := context.Background()\n\t\tlockPath, err := ts.LockShardForAction(ctx, \"test_keyspace\", \"10-20\", \"fake-content\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"LockShardForAction(test_keyspace, 10-20) failed: %v\", err)\n\t\t}\n\t\tif err = ts.UnlockShardForAction(\"test_keyspace\", \"10-20\", lockPath, \"fake-results\"); err != nil {\n\t\t\tt.Errorf(\"UnlockShardForAction(test_keyspace, 10-20): %v\", err)\n\t\t}\n\t\tclose(finished)\n\t}()\n\n\t// lock the shard\n\tctx := context.Background()\n\tlockPath2, err := ts.LockShardForAction(ctx, \"test_keyspace\", \"10-20\", \"fake-content\")\n\tif err != nil {\n\t\tt.Fatalf(\"LockShardForAction(test_keyspace, 10-20) failed: %v\", err)\n\t}\n\n\t// unblock the go routine so it starts waiting\n\tclose(unblock)\n\n\t// sleep for a while so we're sure the go routine is blocking\n\ttime.Sleep(timeUntilLockIsTaken)\n\n\tif err = ts.UnlockShardForAction(\"test_keyspace\", \"10-20\", lockPath2, \"fake-results\"); err != nil {\n\t\tt.Fatalf(\"UnlockShardForAction(test_keyspace, 10-20): %v\", err)\n\t}\n\n\ttimeout := time.After(10 * time.Second)\n\tselect {\n\tcase <-finished:\n\tcase <-timeout:\n\t\tt.Fatalf(\"unlocking timed out\")\n\t}\n}", "func (l *lockFile) TryLock() error {\n\tvar err error\n\tif l.fd, err = syscall.Open(l.Path, os.O_CREATE|os.O_WRONLY, 0644); err != nil {\n\t\treturn fmt.Errorf(\"Couldn't open '%s' for locking: %s\", l.Path, err)\n\t}\n\n\tif err = syscall.Flock(l.fd, syscall.LOCK_EX|syscall.LOCK_NB); err != nil {\n\t\tsyscall.Close(l.fd)\n\t\treturn fmt.Errorf(\"ondevice daemon seems to be running already (%s)\", err)\n\t}\n\n\tl.closed = false\n\tlogrus.Debug(\"acquired daemon lock file\")\n\n\t// only do this once we've got the lock\n\tlogrus.Debug(\"writing to PID file: \", os.Getpid())\n\tpidstr := fmt.Sprintf(\"%d\\n\", os.Getpid())\n\tsyscall.Write(l.fd, []byte(pidstr))\n\n\treturn nil\n}", "func canSoftlock(g graph.Graph) error {\n\tfor _, check := range softlockChecks {\n\t\tif err := check(g); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (f *Flock) TryLock() (bool, error) {\n\treturn f.try(&f.l, writeLock)\n}", "func (l *lockServer) Lock(args *LockArgs, reply *bool) error {\n\tl.mutex.Lock()\n\tdefer l.mutex.Unlock()\n\tif err := l.verifyArgs(args); err != nil {\n\t\treturn err\n\t}\n\t_, *reply = l.lockMap[args.Name]\n\tif !*reply { // No locks held on the given name, so claim write lock\n\t\tl.lockMap[args.Name] = []lockRequesterInfo{{writer: true, node: args.Node, rpcPath: args.RPCPath, uid: args.UID, timestamp: time.Now(), timeLastCheck: time.Now()}}\n\t}\n\t*reply = !*reply // Negate *reply to return true when lock is granted or false otherwise\n\treturn nil\n}", "func (m *mutex) TryLock(ctx context.Context) error {\n\treturn (*semaphore.Weighted)(m).Acquire(ctx, 1)\n}", "func (m *Mutex) TryLock() bool {\n\treturn atomic.CompareAndSwapUint32(&m.l, 0, 1)\n}", "func (p *preprocessor) skipLockMDL() bool {\n\t// skip lock mdl for IMPORT INTO statement,\n\t// because it's a batch process and will do both DML and DDL.\n\treturn p.flag&inImportInto > 0\n}", "func (f *Flock) Lock() error {\n\treturn f.lock(&f.l, winLockfileExclusiveLock)\n}", "func (nc *NexusConn) Lock(lock string) (bool, error) {\n\tpar := ei.M{\n\t\t\"lock\": lock,\n\t}\n\tres, err := nc.Exec(\"sync.lock\", par)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn ei.N(res).M(\"ok\").BoolZ(), nil\n}", "func obtainQueueLock(ctx context.Context, conn *ZkConn, zkPath string) error {\n\tqueueNode := path.Dir(zkPath)\n\tlockNode := path.Base(zkPath)\n\n\tfor {\n\t\t// Get our siblings.\n\t\tchildren, _, err := conn.Children(ctx, queueNode)\n\t\tif err != nil {\n\t\t\treturn vterrors.Wrap(err, \"obtainQueueLock: trylock failed %v\")\n\t\t}\n\t\tsort.Strings(children)\n\t\tif len(children) == 0 {\n\t\t\treturn fmt.Errorf(\"obtainQueueLock: empty queue node: %v\", queueNode)\n\t\t}\n\n\t\t// If we are the first node, we got the lock.\n\t\tif children[0] == lockNode {\n\t\t\treturn nil\n\t\t}\n\n\t\t// If not, find the previous node.\n\t\tprevLock := \"\"\n\t\tfor i := 1; i < len(children); i++ {\n\t\t\tif children[i] == lockNode {\n\t\t\t\tprevLock = children[i-1]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif prevLock == \"\" {\n\t\t\treturn fmt.Errorf(\"obtainQueueLock: no previous queue node found: %v\", zkPath)\n\t\t}\n\n\t\t// Set a watch on the previous node.\n\t\tzkPrevLock := path.Join(queueNode, prevLock)\n\t\texists, _, watch, err := conn.ExistsW(ctx, zkPrevLock)\n\t\tif err != nil {\n\t\t\treturn vterrors.Wrapf(err, \"obtainQueueLock: unable to watch queued node %v\", zkPrevLock)\n\t\t}\n\t\tif !exists {\n\t\t\t// The lock disappeared, try to read again.\n\t\t\tcontinue\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-watch:\n\t\t\t// Something happened to the previous lock.\n\t\t\t// It doesn't matter what, read again.\n\t\t}\n\t}\n}", "func (es *EtcdService) IsLocked(system string, collection string) (bool, error) {\n\tl, err := es.TryLock(system, collection)\n\tif err != nil {\n\t\tif err == ErrAlreadyLocked {\n\t\t\treturn true, nil\n\t\t}\n\n\t\treturn false, err\n\t}\n\n\tdefer l.Unlock()\n\treturn false, nil\n}", "func (f *volatileFile) Lock(lock C.int) C.int {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\tswitch lock {\n\tcase C.SQLITE_LOCK_NONE:\n\t\tf.none++\n\tcase C.SQLITE_LOCK_SHARED:\n\t\tf.shared++\n\tcase C.SQLITE_LOCK_RESERVED:\n\t\tf.reserved++\n\tcase C.SQLITE_LOCK_PENDING:\n\t\tf.pending++\n\tcase C.SQLITE_LOCK_EXCLUSIVE:\n\t\tf.exclusive++\n\tdefault:\n\t\treturn C.SQLITE_ERROR\n\t}\n\n\treturn C.SQLITE_OK\n}", "func (il *internalLocker) Lock(ctx context.Context) error {\n\tif err := il.mu.Lock(ctx); err != nil {\n\t\tlog.Logger.Error(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (l *Lock) Lock(ctx context.Context, d time.Duration) (time.Duration, error) {\n\tif d < time.Millisecond {\n\t\td = time.Millisecond\n\t}\n\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tconn, err := l.Pool.GetContext(ctx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif l.token == nil {\n\t\tl.token = randomToken()\n\t}\n\n\tdefer conn.Close()\n\treturn parseLockReply(lockScript.Do(conn, l.Key, l.token, dtoms(d)))\n}", "func TestLockDirFail(t *testing.T) {\n\td, err := ioutil.TempDir(\"\", \"lockDir\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer func() {\n\t\terr = os.Remove(d)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\t_, err = LockedOpenFile(d, os.O_APPEND, 0600)\n\tif err == nil {\n\t\tt.Fatal(\"Should fail here\")\n\t}\n}", "func (m *SHMLockManager) RetrieveLock(id string) (Locker, error) {\n\treturn nil, fmt.Errorf(\"not supported\")\n}", "func IsDeadlock(err error) bool {\n\treturn isErrCode(err, 1213)\n}", "func (sp *SpinLock) TryLock(lockKeys []*LockKey) ([]*LockKey, bool) {\n\tsuccLocked := []*LockKey{}\n\tfor _, k := range lockKeys {\n\t\tif lkType, occupiedByOthers := sp.m.LoadOrStore(k.key, k.lockType); occupiedByOthers {\n\t\t\tif lkType == sharedLock && k.lockType == sharedLock { //读读共享\n\t\t\t\tsp.refCounter.Add(k.key)\n\t\t\t\tsuccLocked = append(succLocked, k)\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\treturn succLocked, false //读写冲突\n\t\t\t}\n\t\t}\n\t\tif k.lockType == sharedLock {\n\t\t\tsp.refCounter.Add(k.key)\n\t\t}\n\t\tsuccLocked = append(succLocked, k) //第一个抢到\n\t}\n\treturn succLocked, true\n}", "func (r *ByteRange) Lock() error {\n\treturn r.flock(unix.F_WRLCK)\n}", "func (rs *RedisService) TryLock(system string, collection string) (storages.Lock, error) {\n\tlock, err := rs.doLock(system, collection, redsync.WithExpiry(3*time.Hour), redsync.WithRetryDelay(0), redsync.WithTries(1))\n\tif err != nil {\n\t\tif err == redsync.ErrFailed {\n\t\t\treturn nil, ErrAlreadyLocked\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn lock, nil\n}", "func IsDeadlock(err error) bool {\n\tif err == nil {\n\t\treturn false\n\t}\n\tvar mysqlErr *mysql.MySQLError\n\tif errors.As(err, &mysqlErr) {\n\t\treturn mysqlErr.Number == mysqlerr.ER_LOCK_DEADLOCK\n\t}\n\treturn false\n}", "func (e *EtcdMutex) Lock(ctx context.Context) (bool, error) {\n\tleaseID, err := e.leaseManager.LeaseID()\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"error getting lease ID\")\n\t}\n\n\t_, err = e.kvClient.Txn(ctx).If(\n\t\tclientv3.Compare(clientv3.LeaseValue(e.key), \"=\", 0),\n\t).Then(\n\t\tclientv3.OpPut(e.key, e.id, clientv3.WithLease(leaseID)),\n\t).Commit()\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"error trying to attain lock\")\n\t}\n\n\tgetResponse, err := e.kvClient.Get(ctx, e.key)\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"error getting lock key\")\n\t}\n\tif len(getResponse.Kvs) != 1 {\n\t\treturn false, errors.Errorf(\"error: invalid number of KV pairs returned: %d\",\n\t\t\tlen(getResponse.Kvs))\n\t}\n\n\t// TODO: look into whether we can figure this out from the Txn\n\t// response.\n\tkv := getResponse.Kvs[0]\n\treturn string(kv.Value) == e.id, nil\n}", "func (m *Mutex) TryLock() bool {\n\treturn atomic.CompareAndSwapInt32((*int32)(unsafe.Pointer(&m.in)), 0, mutexLocked)\n}", "func (r *RedisLock) TryLock(ctx context.Context) (context.Context, error) {\n\treturn r.lock(ctx, nil)\n}", "func (f *file) Lock() error {\n\treturn nil\n}", "func (g *glock) Lock() context.Context {\n\tvar (\n\t\tkv goku.KV\n\t\terr error\n\t)\n\n\tg.mt.Lock()\n\tg.waiting = true\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tg.cancel = cancel\n\n\tfor {\n\t\tfor {\n\t\t\tkv, err = g.gok.Get(ctx, g.key)\n\t\t\tif errors.Is(err, goku.ErrNotFound) {\n\t\t\t\t// First set so there's no key\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif strings.HasPrefix(string(kv.Value), \"locked\") {\n\t\t\t\tg.awaitRetry()\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Case for fist time trying to acquire lock.\n\t\tif err != nil {\n\t\t\terr = g.gok.Set(ctx, g.key, []byte(\"locked_\"+g.processID),\n\t\t\t\tgoku.WithCreateOnly(),\n\t\t\t\tgoku.WithExpiresAt(time.Now().Add(time.Second*20)))\n\t\t} else {\n\t\t\terr = g.gok.Set(ctx, g.key, []byte(\"locked_\"+g.processID),\n\t\t\t\tgoku.WithPrevVersion(kv.Version),\n\t\t\t\tgoku.WithExpiresAt(time.Now().Add(time.Second*20)))\n\t\t}\n\n\t\tif err != nil {\n\t\t\t// retry\n\t\t\tcontinue\n\t\t}\n\n\t\t// ensure the lock is ours\n\t\tkv, err = g.gok.Get(ctx, g.key)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Sanity check, paranoid\n\t\tif string(kv.Value) != \"locked_\"+g.processID {\n\t\t\tcontinue\n\t\t}\n\n\t\tg.locked = true\n\t\tgo g.keepAlive(ctx)\n\t\treturn ctx\n\t}\n}", "func (l *Locker) LockWithErr() error {\n\tif l.fd != invalidFileHandle {\n\t\treturn ErrFailedToAcquireLock\n\t}\n\n\tvar flags uint32\n\tif l.nonblock {\n\t\tflags = lockfileExclusiveLock | lockfileFailImmediatly\n\t} else {\n\t\tflags = lockfileExclusiveLock\n\t}\n\n\tif l.filename == \"\" {\n\t\treturn ErrLockFileEmpty\n\t}\n\tfd, err := syscall.CreateFile(&(syscall.StringToUTF16(l.filename)[0]), syscall.GENERIC_READ|syscall.GENERIC_WRITE,\n\t\tsyscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE, nil, syscall.OPEN_ALWAYS, syscall.FILE_ATTRIBUTE_NORMAL, 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"setlock: fatal: unable to open %s: temporary failure\", l.filename)\n\t}\n\n\tif fd == invalidFileHandle {\n\t\treturn ErrFailedToAcquireLock\n\t}\n\tdefer func() {\n\t\t// Close this descriptor if we failed to lock\n\t\tif l.fd == invalidFileHandle {\n\t\t\t// l.fd is not set, I guess we didn't suceed\n\t\t\tsyscall.CloseHandle(fd)\n\t\t}\n\t}()\n\n\tvar ol syscall.Overlapped\n\tvar mu sync.RWMutex\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\tr1, _, _ := syscall.Syscall6(\n\t\tprocLockFileEx.Addr(),\n\t\t6,\n\t\tuintptr(fd), // handle\n\t\tuintptr(flags),\n\t\tuintptr(0), // reserved\n\t\tuintptr(1), // locklow\n\t\tuintptr(0), // lockhigh\n\t\tuintptr(unsafe.Pointer(&ol)),\n\t)\n\tif r1 == 0 {\n\t\treturn ErrFailedToAcquireLock\n\t}\n\n\tl.fd = fd\n\treturn nil\n}", "func (r *FoundationDBClusterReconciler) takeLock(cluster *fdbtypes.FoundationDBCluster, action string) (bool, error) {\n\tlog.Info(\"Taking lock on cluster\", \"namespace\", cluster.Namespace, \"cluster\", cluster.Name, \"action\", action)\n\tlockClient, err := r.getLockClient(cluster)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\thasLock, err := lockClient.TakeLock()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif !hasLock {\n\t\tr.Recorder.Event(cluster, corev1.EventTypeNormal, \"LockAcquisitionFailed\", fmt.Sprintf(\"Lock required before %s\", action))\n\t}\n\treturn hasLock, nil\n}", "func checkTableLocked(tbInfo *model.TableInfo, lockTp model.TableLockType, sessionInfo model.SessionInfo) error {\n\tif !tbInfo.IsLocked() {\n\t\treturn nil\n\t}\n\tif tbInfo.Lock.State == model.TableLockStatePreLock {\n\t\treturn nil\n\t}\n\tif (tbInfo.Lock.Tp == model.TableLockRead && lockTp == model.TableLockRead) ||\n\t\t(tbInfo.Lock.Tp == model.TableLockReadOnly && lockTp == model.TableLockReadOnly) {\n\t\treturn nil\n\t}\n\tsessionIndex := findSessionInfoIndex(tbInfo.Lock.Sessions, sessionInfo)\n\t// If the request session already locked the table before, In other words, repeat lock.\n\tif sessionIndex >= 0 {\n\t\tif tbInfo.Lock.Tp == lockTp {\n\t\t\treturn nil\n\t\t}\n\t\t// If no other session locked this table, and it is not a read only lock (session unrelated).\n\t\tif len(tbInfo.Lock.Sessions) == 1 && tbInfo.Lock.Tp != model.TableLockReadOnly {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn infoschema.ErrTableLocked.GenWithStackByArgs(tbInfo.Name.L, tbInfo.Lock.Tp, tbInfo.Lock.Sessions[0])\n}", "func (service *LockServiceMock) Lock(resourceID string) bool {\n\treturn service.defaultValue\n}", "func TestExclusion(t *testing.T) {\n\tvar (\n\t\tmu ctxsync.Mutex\n\t\twg sync.WaitGroup\n\t\tx int\n\t)\n\trequire.NoError(t, mu.Lock(context.Background()))\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif err := mu.Lock(context.Background()); err != nil {\n\t\t\treturn\n\t\t}\n\t\tx = 100\n\t\tmu.Unlock()\n\t}()\n\tfor i := 1; i <= 10; i++ {\n\t\t// Verify that nothing penetrates our lock and changes x unexpectedly.\n\t\tassert.Equal(t, i-1, x)\n\t\tx = i\n\t\ttime.Sleep(1 * time.Millisecond)\n\t}\n\tmu.Unlock()\n\twg.Wait()\n\tassert.Equal(t, 100, x)\n}", "func checkKeyspaceLockUnblocks(t *testing.T, ts topo.Server) {\n\tunblock := make(chan struct{})\n\tfinished := make(chan struct{})\n\n\t// as soon as we're unblocked, we try to lock the keyspace\n\tgo func() {\n\t\t<-unblock\n\t\tctx := context.Background()\n\t\tlockPath, err := ts.LockKeyspaceForAction(ctx, \"test_keyspace\", \"fake-content\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"LockKeyspaceForAction(test_keyspace) failed: %v\", err)\n\t\t}\n\t\tif err = ts.UnlockKeyspaceForAction(\"test_keyspace\", lockPath, \"fake-results\"); err != nil {\n\t\t\tt.Errorf(\"UnlockKeyspaceForAction(test_keyspace): %v\", err)\n\t\t}\n\t\tclose(finished)\n\t}()\n\n\t// lock the keyspace\n\tctx := context.Background()\n\tlockPath2, err := ts.LockKeyspaceForAction(ctx, \"test_keyspace\", \"fake-content\")\n\tif err != nil {\n\t\tt.Fatalf(\"LockKeyspaceForAction(test_keyspace) failed: %v\", err)\n\t}\n\n\t// unblock the go routine so it starts waiting\n\tclose(unblock)\n\n\t// sleep for a while so we're sure the go routine is blocking\n\ttime.Sleep(timeUntilLockIsTaken)\n\n\tif err = ts.UnlockKeyspaceForAction(\"test_keyspace\", lockPath2, \"fake-results\"); err != nil {\n\t\tt.Fatalf(\"UnlockKeyspaceForAction(test_keyspace): %v\", err)\n\t}\n\n\ttimeout := time.After(10 * time.Second)\n\tselect {\n\tcase <-finished:\n\tcase <-timeout:\n\t\tt.Fatalf(\"unlocking timed out\")\n\t}\n}", "func (g *Github) modLock() {\n\tg.modMutex.Lock()\n\tshouldWait := time.Second - time.Since(g.lastModRequest)\n\tif shouldWait > 0 {\n\t\tlog.Debugf(\"Waiting %s to not hit GitHub ratelimit\", shouldWait)\n\t\ttime.Sleep(shouldWait)\n\t}\n}", "func (tl Noop) TryLock(_ types.JobID, _ time.Duration, targets []*target.Target, limit uint) ([]string, error) {\n\tlog.Infof(\"Trylocked %d targets by doing nothing\", len(targets))\n\tres := make([]string, 0, len(targets))\n\tfor _, t := range targets {\n\t\tres = append(res, t.ID)\n\t}\n\treturn res, nil\n}", "func Test_BlockedHold(t *testing.T) {\n\tkey := \"Test_BlockedHold\"\n\tconn, err := redigo.Dial(\"tcp\", RedisHost)\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"redigo.Dial failure [%s]\", err))\n\t}\n\n\tlock1 := New(conn, key, DefaultTimeout, DefaultAutoExpire, 2000)\n\n\tstatus, err := lock1.Lock()\n\tdefer lock1.UnlockIfLocked()\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"lock operation failed [%s]\", err))\n\t}\n\n\tif !status {\n\t\tt.Error(\"lock acquisition failed\")\n\t}\n\n\tlock1.Unlock()\n\tlock2 := New(conn, key, 1000)\n\n\tstatus, err = lock2.Lock()\n\tdefer lock2.UnlockIfLocked()\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"lock operation failed [%s]\", err))\n\t}\n\n\tif status {\n\t\tt.Error(\"lock acquisition succeeded\")\n\t}\n}", "func (r *Locking) IsLocked() (bool, error) {\n\tclient, err := r.GetClientForAPIVersionAndKind(\n\t\tr.LockingObj.GetAPIVersion(),\n\t\tr.LockingObj.GetKind(),\n\t)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tgot, err := client.\n\t\tNamespace(r.LockingObj.GetNamespace()).\n\t\tGet(\n\t\t\tr.LockingObj.GetName(),\n\t\t\tmetav1.GetOptions{},\n\t\t)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\tklog.V(3).Infof(\n\t\t\"Lock %q %q: Exists=%t\",\n\t\tr.LockingObj.GetNamespace(),\n\t\tr.LockingObj.GetName(),\n\t\tgot != nil,\n\t)\n\treturn got != nil, err\n}", "func (s *S3Storage) Lock(key string) error {\n\tstart := time.Now()\n\tlockFile := s.lockFileName(key)\n\n\tfor {\n\t\terr := s.createLockFile(lockFile)\n\t\tif err == nil {\n\t\t\t// got the lock, yay\n\t\t\treturn nil\n\t\t}\n\n\t\tif err.Error() != lockFileExists {\n\t\t\t// unexpected error\n\t\t\tfmt.Println(err)\n\t\t\treturn fmt.Errorf(\"creating lock file: %+v\", err)\n\n\t\t}\n\n\t\t// lock file already exists\n\n\t\tinfo, err := s.Stat(lockFile)\n\t\tswitch {\n\t\tcase s.errNoSuchKey(err):\n\t\t\t// must have just been removed; try again to create it\n\t\t\tcontinue\n\n\t\tcase err != nil:\n\t\t\t// unexpected error\n\t\t\treturn fmt.Errorf(\"accessing lock file: %v\", err)\n\n\t\tcase s.fileLockIsStale(info):\n\t\t\tlog.Printf(\"[INFO][%s] Lock for '%s' is stale; removing then retrying: %s\",\n\t\t\t\ts, key, lockFile)\n\t\t\ts.deleteLockFile(lockFile)\n\t\t\tcontinue\n\n\t\tcase time.Since(start) > staleLockDuration*2:\n\t\t\t// should never happen, hopefully\n\t\t\treturn fmt.Errorf(\"possible deadlock: %s passed trying to obtain lock for %s\",\n\t\t\t\ttime.Since(start), key)\n\n\t\tdefault:\n\t\t\t// lockfile exists and is not stale;\n\t\t\t// just wait a moment and try again\n\t\t\ttime.Sleep(fileLockPollInterval)\n\n\t\t}\n\t}\n}", "func (m *TRWMutex) TryRLock() bool {\n\tm.mu.Lock()\n\tif m.w > 0 {\n\t\t// other one already acquired lock.\n\t\tm.mu.Unlock()\n\t\treturn false\n\t}\n\tm.r++\n\t// m.rwmu.RLock() never blocks\n\tm.rwmu.RLock()\n\tm.mu.Unlock()\n\treturn true\n}", "func (m *Mutex) TryLock() bool {\n\tselect {\n\tcase m.in <- struct{}{}:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func (f *Flock) TryRLock() (bool, error) {\n\treturn f.try(&f.r, readLock)\n}", "func (sp *SpinLock) IsLocked(key string) bool {\n\t_, locked := sp.m.Load(key)\n\treturn locked\n}", "func (m programMap) existsUnlocked(pid uint16) (ok bool) {\n\t_, ok = m.p[uint32(pid)]\n\treturn\n}", "func (k *Kluster) Lock(name string) (lockfile.Lockfile, error) {\n\tif name == \"\" {\n\t\tname = k.Name\n\t}\n\tf := filepath.Join(k.Dir(), \".\"+name)\n\treturn lockFile(f)\n}", "func (m *EventMutex) TryLock() bool {\n\treturn m.lwm.tryLock()\n}", "func (l *NullPathLocker) Lock(lockPath string) (pathlock.Unlocker, error) {\n\treturn l, nil\n}", "func (m *SHMLockManager) AvailableLocks() (*uint32, error) {\n\treturn nil, fmt.Errorf(\"not supported\")\n}", "func (r *Locking) Lock() (Result, func() (Result, error), error) {\n\tlockstatus, err := r.create()\n\tif err != nil {\n\t\treturn Result{}, nil, err\n\t}\n\t// build the unlock logic\n\tvar unlock func() (Result, error)\n\tif r.IsLockForever {\n\t\tunlock = func() (Result, error) {\n\t\t\t// this is a noop if this lock is meant\n\t\t\t// to be present forever\n\t\t\treturn Result{\n\t\t\t\tPhase: \"Passed\",\n\t\t\t\tMessage: \"Will not unlock: Locked forever\",\n\t\t\t}, nil\n\t\t}\n\t} else {\n\t\t// this is a one time lock that should be removed\n\t\tunlock = r.delete\n\t}\n\treturn lockstatus, unlock, nil\n}" ]
[ "0.6637657", "0.6374418", "0.6349784", "0.62125856", "0.6165353", "0.6146329", "0.60941714", "0.6085537", "0.5988191", "0.5964219", "0.5961086", "0.5947109", "0.5945785", "0.58900595", "0.586523", "0.5865227", "0.5832653", "0.5813164", "0.5785906", "0.5783055", "0.5755824", "0.57419896", "0.57296056", "0.57232183", "0.57148385", "0.5674559", "0.5660761", "0.5659298", "0.5643536", "0.5631881", "0.5603012", "0.55714774", "0.5568533", "0.55665797", "0.5563974", "0.55572563", "0.55542934", "0.5551216", "0.5533271", "0.5520532", "0.55172586", "0.5503987", "0.550284", "0.5482149", "0.5476938", "0.5475635", "0.5449921", "0.54486203", "0.5446053", "0.5440513", "0.5436614", "0.5431422", "0.54224974", "0.54064107", "0.5405636", "0.5404473", "0.5400505", "0.5397558", "0.53973126", "0.5383755", "0.5376637", "0.53706706", "0.5356338", "0.5353146", "0.53523684", "0.534014", "0.5332993", "0.53304607", "0.5324816", "0.53054494", "0.5296399", "0.52947235", "0.5290825", "0.52873135", "0.5284939", "0.5280947", "0.5269883", "0.5269722", "0.5262428", "0.5260737", "0.5259965", "0.52587104", "0.5256347", "0.5251902", "0.523789", "0.52334756", "0.52259004", "0.52241045", "0.5223786", "0.5220514", "0.52172804", "0.52144676", "0.52044284", "0.52035034", "0.520182", "0.51927406", "0.5188878", "0.51831913", "0.51772594", "0.517192" ]
0.6662857
0
TryUnlock closes and removes the lockfile
func (s *Single) TryUnlock() error { if err := s.file.Close(); err != nil { return fmt.Errorf("failed to close the lock file: %v", err) } if err := os.Remove(s.Filename()); err != nil { return fmt.Errorf("failed to remove the lock file: %v", err) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (l *lock) Unlock() error {\n\treturn l.file.Close()\n}", "func (l *NullPathLocker) Unlock() {}", "func release() error {\n\tif disabled() {\n\t\treturn nil\n\t}\n\n\tpath, err := path(lockFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn os.Remove(path)\n}", "func (l *Lock) Unlock() (err error) {\n\t_, err = fs.Stat(l.name)\n\tif err != nil {\n\t\terr = nil\n\t\treturn\n\t}\n\terr = fs.Remove(l.name)\n\treturn\n}", "func (lf *LockFile) Unlock() error {\n\n\tlog.Printf(\"Deleting lockfile at this key '%s'\", lf.Path)\n\n\tif lf.ConsulAddress == \"\" {\n\t\t// Delete the file\n\t\terr := os.Remove(lf.Path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlf.locked = false\n\t\treturn nil\n\t}\n\n\t// Delete the KV pair\n\terr := DeleteValueFromConsul(lf.ConsulAddress, lf.Path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlf.locked = false\n\treturn nil\n}", "func (f *file) Unlock() error {\n\treturn nil\n}", "func (f *FileLock) Unlock() error {\n\terr := f.fileH.Close()\n\tf.fileH = nil\n\treturn err\n}", "func (f *FLock) Unlock() error {\n\tf.locker.Lock()\n\tdefer f.locker.Unlock()\n\n\tif err := syscall.Flock(int(f.lockedFile.Fd()), syscall.LOCK_UN); err != nil {\n\t\treturn err\n\t}\n\n\treturn f.closeLockedFile()\n}", "func (l *FileLock) Unlock() error {\n\tif l.fd == nil {\n\t\treturn fmt.Errorf(\"file %s descriptor is nil\", l.fileName)\n\t}\n\tfd := l.fd\n\tl.fd = nil\n\n\tdefer fd.Close()\n\tif err := syscall.Flock(int(fd.Fd()), syscall.LOCK_UN); err != nil {\n\t\treturn errors.Wrapf(err, \"file %s unlock failed\", l.fileName)\n\t}\n\treturn nil\n}", "func (l *FileLock) Unlock() error {\n\treturn syscall.Flock(l.fd, syscall.LOCK_UN)\n}", "func TestLockAndUnlock(t *testing.T) {\n\tf, err := ioutil.TempFile(\"\", \"lock\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tf.Close()\n\tdefer func() {\n\t\terr = os.Remove(f.Name())\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\t// lock the file\n\tl, err := LockedOpenFile(f.Name(), os.O_WRONLY, 0600)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// unlock the file\n\tif err = l.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// try lock the unlocked file\n\tdupl, err := LockedOpenFile(f.Name(), os.O_WRONLY|os.O_CREATE, 0600)\n\tif err != nil {\n\t\tt.Errorf(\"err = %v, want %v\", err, nil)\n\t}\n\n\t// blocking on locked file\n\tlocked := make(chan struct{}, 1)\n\tgo func() {\n\t\tbl, blerr := LockedOpenFile(f.Name(), os.O_WRONLY, 0600)\n\t\tif blerr != nil {\n\t\t\tt.Error(blerr)\n\t\t\treturn\n\t\t}\n\t\tlocked <- struct{}{}\n\t\tif blerr = bl.Close(); blerr != nil {\n\t\t\tt.Error(blerr)\n\t\t\treturn\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-locked:\n\t\tt.Error(\"unexpected unblocking\")\n\tcase <-time.After(100 * time.Millisecond):\n\t}\n\n\t// unlock\n\tif err = dupl.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// the previously blocked routine should be unblocked\n\tselect {\n\tcase <-locked:\n\tcase <-time.After(1 * time.Second):\n\t\tt.Error(\"unexpected blocking\")\n\t}\n}", "func (f *File) Unlock() error {\n\treturn nil\n}", "func (l *FileLock) Close() error {\n\tfd := l.fd\n\tl.fd = -1\n\treturn syscall.Close(fd)\n}", "func Unlock() {\n\tlock.Unlock()\n}", "func (f *Flock) Unlock() error {\n\tf.m.Lock()\n\tdefer f.m.Unlock()\n\n\t// if we aren't locked or if the lockfile instance is nil\n\t// just return a nil error because we are unlocked\n\tif (!f.l && !f.r) || f.fh == nil {\n\t\treturn nil\n\t}\n\n\t// mark the file as unlocked\n\tif _, errNo := unlockFileEx(syscall.Handle(f.fh.Fd()), 0, 1, 0, &syscall.Overlapped{}); errNo > 0 {\n\t\treturn errNo\n\t}\n\n\tf.fh.Close()\n\n\tf.l = false\n\tf.r = false\n\tf.fh = nil\n\n\treturn nil\n}", "func (f *FileLock) Unlock() {\n\tif f.is_locked {\n\t\tf.f_lock.Unlock()\n\t}\n}", "func (il *internalLocker) Unlock(ctx context.Context) error {\n\tif err := il.mu.Unlock(ctx); err != nil {\n\t\tlog.Logger.Error(err)\n\t\treturn err\n\t}\n\n\treturn il.session.Close()\n}", "func (f *File) Unlock() error {\n\tif err := syscall.Flock(f.lockfd, syscall.LOCK_UN); err != nil {\n\t\treturn err\n\t}\n\tf.mu.Unlock()\n\treturn nil\n}", "func (s *Snapshot) closeLocked() error {\n\ts.db.mu.snapshots.remove(s)\n\n\t// If s was the previous earliest snapshot, we might be able to reclaim\n\t// disk space by dropping obsolete records that were pinned by s.\n\tif e := s.db.mu.snapshots.earliest(); e > s.seqNum {\n\t\ts.db.maybeScheduleCompactionPicker(pickElisionOnly)\n\t}\n\ts.db = nil\n\treturn nil\n}", "func Unlock() {\n\tmutex.Unlock()\n}", "func unlock(lock *flock.Flock) {\n\terr := lock.Unlock()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (m *MutexSafe) unlock() {\n\tm.Mutex.Unlock()\n}", "func TestGetLock(t *testing.T) {\n\tlockfile := lockOrFail(t)\n\tdefer removeTestLock(lockfile)\n}", "func (f *Flock) Close() error {\n\treturn f.Unlock()\n}", "func (l *Locker) Unlock() {\n\tif l.locker != -1 {\n\t\tpanic(\"db: Unlock of unlocked Locker\")\n\t}\n\tatomic.StoreInt32(&l.locker, 0)\n}", "func Release(lock int) error {\n\treturn unix.Flock(lock, unix.LOCK_UN)\n}", "func Release(fd int) error {\n\tdefer unix.Close(fd)\n\tif err := unix.Flock(fd, unix.LOCK_UN); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (l *fileLock) tryLock() (Unlocker, error) {\n\tl.mu.Lock()\n\terr := syscall.Flock(l.fd, syscall.LOCK_EX|syscall.LOCK_NB)\n\tswitch err {\n\tcase syscall.EWOULDBLOCK:\n\t\tl.mu.Unlock()\n\t\treturn nopUnlocker{}, nil\n\tcase nil:\n\t\treturn l, nil\n\tdefault:\n\t\tl.mu.Unlock()\n\t\treturn nil, err\n\t}\n}", "func (l *FileLocker) Release() {\n\tl.f.Close()\n}", "func (file *LockFile) Unlock() error {\n\treturn unlockFile(file.Fd())\n}", "func (l *etcdLock) Unlock() {\n\tif l.cancel != nil {\n\t\tl.cancel()\n\t}\n}", "func (li *localLockInstance) Unlock() {\n\treadLock := false\n\tli.ns.unlock(li.volume, li.path, li.opsID, readLock)\n}", "func (mfs *MinFS) Unlock(path string) error {\n\tmfs.m.Lock()\n\tdefer mfs.m.Unlock()\n\n\tdelete(mfs.locks, path)\n\n\treturn nil\n}", "func (f *volatileFile) Unlock(lock C.int) C.int {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\tswitch lock {\n\tcase C.SQLITE_LOCK_NONE:\n\t\tf.none--\n\tcase C.SQLITE_LOCK_SHARED:\n\t\tf.shared--\n\tcase C.SQLITE_LOCK_RESERVED:\n\t\tf.reserved--\n\tcase C.SQLITE_LOCK_PENDING:\n\t\tf.pending--\n\tcase C.SQLITE_LOCK_EXCLUSIVE:\n\t\tf.exclusive--\n\tdefault:\n\t\treturn C.SQLITE_ERROR\n\t}\n\n\treturn C.SQLITE_OK\n}", "func (w *Writer) unlock() {\n\tw.mutex.Unlock()\n}", "func Unlock() {\n\t// TO DO\n}", "func (di *distLockInstance) Unlock() {\n\tdi.rwMutex.Unlock()\n}", "func (g *glock) Unlock() {\n\tdefer func() {\n\t\t// Cancel the context when this returns\n\t\tif g.cancel != nil {\n\t\t\tg.cancel()\n\t\t\tg.cancel = nil\n\t\t}\n\t}()\n\tif !g.locked {\n\t\t// Called Unlock without actually having the lock,\n\t\t// do nothing or risk overriding someone else's lock\n\t\treturn\n\t}\n\tdefer g.mt.Unlock()\n\tg.waiting = false\n\n\tfor {\n\t\t// ensure the lock is ours\n\t\tkv, err := g.gok.Get(context.Background(), g.key)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Sanity check, that the lock is ours\n\t\tif string(kv.Value) != \"locked_\"+g.processID {\n\t\t\treturn\n\t\t}\n\n\t\terr = g.gok.Set(context.Background(), g.key, []byte(\"unlocked\"))\n\t\tif err == nil {\n\t\t\tg.locked = false\n\t\t\treturn\n\t\t}\n\t}\n}", "func (m *neighborEntryRWMutex) Unlock() {\n\tm.mu.Unlock()\n\tlocking.DelGLock(neighborEntryprefixIndex, -1)\n}", "func (s *SharedState) unlock() {\n s.mutex.Unlock()\n}", "func (rs *RedisService) Unlock(lock storages.Lock) error {\n\tlock.Unlock()\n\n\trs.selfmutex.Lock()\n\tdelete(rs.unlockMe, lock.Identifier())\n\trs.selfmutex.Unlock()\n\n\treturn nil\n}", "func (m *RWMutex) Unlock() {\n\tm.mu.Unlock()\n\tlocking.DelGLock(genericMarkIndex, -1)\n}", "func (l *fileSink) closeFileLocked() error {\n\tif l.mu.file == nil {\n\t\treturn nil\n\t}\n\n\t// First disconnect stderr, if it was connected. We do this before\n\t// closing the file to ensure no direct stderr writes are lost.\n\tif err := l.maybeRelinquishInternalStderrLocked(); err != nil {\n\t\treturn err\n\t}\n\n\tif sb, ok := l.mu.file.(*syncBuffer); ok {\n\t\tif err := sb.file.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tl.mu.file = nil\n\n\treturn nil\n}", "func (sm *SourceMgr) Release() {\n\tsm.lf.Close()\n\tos.Remove(filepath.Join(sm.cachedir, \"sm.lock\"))\n}", "func (n *nsLockMap) ForceUnlock(volume, path string) {\n\tn.lockMapMutex.Lock()\n\tdefer n.lockMapMutex.Unlock()\n\n\t// Clarification on operation:\n\t// - In case of FS or XL we call ForceUnlock on the local globalNSMutex\n\t// (since there is only a single server) which will cause the 'stuck'\n\t// mutex to be removed from the map. Existing operations for this\n\t// will continue to be blocked (and timeout). New operations on this\n\t// resource will use a new mutex and proceed normally.\n\t//\n\t// - In case of Distributed setup (using dsync), there is no need to call\n\t// ForceUnlock on the server where the lock was acquired and is presumably\n\t// 'stuck'. Instead dsync.ForceUnlock() will release the underlying locks\n\t// that participated in granting the lock. Any pending dsync locks that\n\t// are blocking can now proceed as normal and any new locks will also\n\t// participate normally.\n\tif n.isDistXL { // For distributed mode, broadcast ForceUnlock message.\n\t\tdsync.NewDRWMutex(context.Background(), pathJoin(volume, path), globalDsync).ForceUnlock()\n\t}\n\n\t// Remove lock from the map.\n\tdelete(n.lockMap, nsParam{volume, path})\n}", "func (l *lock) TryLock() error {\n\terr := os.Chmod(l.fname, syscall.DMEXCL|0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, err := os.Open(l.fname)\n\tif err != nil {\n\t\treturn ErrLocked\n\t}\n\n\tl.file = f\n\treturn nil\n}", "func UnlockConfig() {\n\tif lockFilePath != \"\" {\n\t\terr := os.Remove(lockFilePath)\n\t\tif err != nil {\n\t\t\tlogging.Error(\"config\", \"Failed to delete lockfile: \"+err.Error())\n\t\t}\n\t}\n}", "func (sm *SourceMgr) Release() {\n\tos.Remove(path.Join(sm.cachedir, \"sm.lock\"))\n}", "func (aio *AsyncIO) FUnlock() error {\n\treturn nil\n}", "func (d *Dam) Unlock() {\n\td.freeze.Unlock()\n}", "func (m *Mutex) Release(lock *Lock) error {\n\tfm := lock.Data.(*filemutex.FileMutex)\n\tlfn := LockFileName(lock.Name)\n\treturn internalRelease(fm, lfn, m.Logger)\n}", "func Unlock(ctx context.Context, lockContext, lockID string) {\n\tgetLock(ctx, lockID).Unlock()\n\tLogc(ctx).WithField(\"lock\", lockID).Debugf(\"Released shared lock (%s).\", lockContext)\n}", "func (lm *LMutex) Unlock() {\n\tif !atomic.CompareAndSwapInt64(&lm.state, WRITELOCK, NOLOCKS) {\n\t\tpanic(\"Trying to Unlock() while no Lock() is active\")\n\t}\n}", "func (this *Lock) Release() error {\n\tres, err := this.manager.GetClient().Get(this.name).Result()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif this.value != res {\n\t\treturn ERR_NOT_MINE_LOCK\n\t}\n\terr = this.manager.GetClient().Watch(func(tx *redis.Tx) error {\n\t\tres, err := tx.Del(this.name).Result()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif res == 0 {\n\t\t\treturn ERR_NOT_MINE_LOCK\n\t\t}\n\t\treturn nil\n\t}, this.name)\n\n\treturn err\n}", "func (el *Lock) Unlock() error {\n\treturn el.Delete(el.key())\n}", "func (u unlocker) Unlock() error {\n\tkvp, meta, err := u.session.client.KV().Get(u.key, nil)\n\tif err != nil {\n\t\treturn NewKVError(\"get\", u.key, err)\n\t}\n\tif kvp == nil {\n\t\treturn nil\n\t}\n\tif kvp.Session != u.session.session {\n\t\treturn AlreadyLockedError{Key: u.key}\n\t}\n\n\tsuccess, _, err := u.session.client.KV().DeleteCAS(&api.KVPair{\n\t\tKey: u.key,\n\t\tModifyIndex: meta.LastIndex,\n\t}, nil)\n\tif err != nil {\n\t\treturn NewKVError(\"deletecas\", u.key, err)\n\t}\n\tif !success {\n\t\t// the key has been mutated since we checked it - probably someone\n\t\t// overrode our lock on it or deleted it themselves\n\t\treturn AlreadyLockedError{Key: u.key}\n\t}\n\treturn nil\n}", "func (l *Lock) Unlock(ctx context.Context) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tconn, err := l.Pool.GetContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer conn.Close()\n\tif l.token == nil {\n\t\tl.token = randomToken()\n\t}\n\n\treply, err := redis.Int(unlockScript.Do(conn, l.Key, l.token))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif reply != 1 {\n\t\treturn ErrNotHeld\n\t}\n\tl.token = nil\n\treturn nil\n}", "func (service LockService) Unlock(group *scaley.Group) error {\n\tif service.Locked(group) {\n\t\terr := Root.Remove(lockfile(group))\n\t\tif err != nil {\n\t\t\treturn scaley.UnlockFailure{Group: group}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (r *RedisDL) Unlock() error {\n\tr.m.Lock()\n\tdefer r.m.Unlock()\n\treturn r.deleteToken()\n}", "func (w *wrapper) Release(path string, fd uint64) int {\n\tw.fdMtx.Lock()\n\tdefer w.fdMtx.Unlock()\n\tfh, ok := w.fileDescriptors[fd]\n\tif !ok {\n\t\treturn -fuse.EINVAL\n\t}\n\tdelete(w.fileDescriptors, fd)\n\t// It's fine if the write lock is still being held. The Close will soon unblock that.\n\tdelete(w.writeLocks, fd)\n\treturn convertError(fh.Close())\n}", "func (self *Map) unlock() {\n\tif self.atomic != nil {\n\t\tself.atomic.Unlock()\n\t}\n}", "func (c *crdLock) Unlock(ctx context.Context) error {\n\treturn nil\n}", "func (e *Enumerate) unlock() {\n\te.u.m.Unlock()\n}", "func (s *Single) CheckLock() error {\n\n\tif err := os.Remove(s.Filename()); err != nil && !os.IsNotExist(err) {\n\t\treturn ErrAlreadyRunning\n\t}\n\n\tfile, err := os.OpenFile(s.Filename(), os.O_EXCL|os.O_CREATE, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.file = file\n\n\treturn nil\n}", "func (lock *ALock) Unlock() {\n\tslot := atomic.LoadInt32(&lock.slot)\n\tlock.Flags[(slot+1)%lock.nThreads] = true\n}", "func (self *Conn) Unlock() {\n\tif self.mainloop != nil && self.isLocked {\n\t\tC.pa_threaded_mainloop_unlock(self.mainloop)\n\t\tself.isLocked = false\n\t}\n}", "func (bl *OnceBlastLock) Close() {\n\tclose(bl.close)\n}", "func (rw *RWMutex) Unlock() {\n\tatomic.StoreInt32(&rw.wLocked, 0)\n\trw.RWMutex.Unlock()\n}", "func TestLockDirFail(t *testing.T) {\n\td, err := ioutil.TempDir(\"\", \"lockDir\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer func() {\n\t\terr = os.Remove(d)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\t_, err = LockedOpenFile(d, os.O_APPEND, 0600)\n\tif err == nil {\n\t\tt.Fatal(\"Should fail here\")\n\t}\n}", "func (lt *LockTimeout) Unlock() {\n\tatomic.StoreInt32(&lt.frontLock, 0)\n}", "func (d *dMutex) unlock(i interface{}) {\n\n\t// acquire global lock\n\td.globalMutex.Lock()\n\n\t// unlock instance mutex\n\td.mutexes[i].mutex.Unlock()\n\n\t// decrease the count, as we are no longer interested in this instance\n\t// mutex\n\td.mutexes[i].count--\n\n\t// if we are the last one interested in this instance mutex delete the\n\t// cMutex\n\tif d.mutexes[i].count == 0 {\n\t\tdelete(d.mutexes, i)\n\t}\n\n\t// release the global lock\n\td.globalMutex.Unlock()\n}", "func internalRelease(fm *filemutex.FileMutex, lfn string, log logger.Interface) error {\n\terr := fm.Close()\n\tif err != nil {\n\t\tlog.V(1).Infof(\"Error closing lock file %s: %s\", lfn, err)\n\t}\n\treturn err\n}", "func (t *Mutex) Unlock() {\n\tt.m.Lock()\n\tdefer t.m.Unlock()\n\tif !t.locked {\n\t\tpanic(\"double call to unlock\")\n\t}\n\tt.locked = false\n}", "func (s *sched) unlock(t Task) {\n\ts.cache.Del(prefixLock + t.GetID())\n}", "func (wp *WPLock) Unlock() {\n\n\twp.waitingLock.Lock()\n\tif atomic.CompareAndSwapInt32(&wp.waiting, 1, 0) {\n\t\twp.writeLock.Unlock()\n\t} else {\n\t\tatomic.AddInt32(&wp.waiting, -1)\n\t}\n\twp.waitingLock.Unlock()\n\n\twp.lock.Unlock()\n}", "func (rw *RWMutex) Unlock() {\n\trw.m.Unlock()\n\tnoteUnlock(unsafe.Pointer(rw))\n}", "func (f *File) UnlockLocal() {\n\tf.mu.Unlock()\n}", "func checkTrylockMainProcess(t *testing.T) {\n\tvar err error\n\tlockfile := lockOrFail(t)\n\tdefer removeTestLock(lockfile)\n\tlockdir := filepath.Dir(lockfile.File.Name())\n\totherAcquired, message, err := forkAndGetLock(lockdir)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error in subprocess trying to lock uncontested fileLock: %v. Subprocess output: %q\", err, message)\n\t}\n\tif !otherAcquired {\n\t\tt.Fatalf(\"Subprocess failed to lock uncontested fileLock. Subprocess output: %q\", message)\n\t}\n\n\terr = lockfile.tryLock()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to lock fileLock: %v\", err)\n\t}\n\n\treacquired, message, err := forkAndGetLock(filepath.Dir(lockfile.File.Name()))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif reacquired {\n\t\tt.Fatalf(\"Permitted locking fileLock twice. Subprocess output: %q\", message)\n\t}\n\n\terr = lockfile.Unlock()\n\tif err != nil {\n\t\tt.Fatalf(\"Error unlocking fileLock: %v\", err)\n\t}\n\n\treacquired, message, err = forkAndGetLock(filepath.Dir(lockfile.File.Name()))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reacquired {\n\t\tt.Fatalf(\"Subprocess failed to acquire lock after it was released by the main process. Subprocess output: %q\", message)\n\t}\n}", "func (t *TrudyPipe) Unlock() {\n\tt.userMutex.Unlock()\n}", "func (vs *versionSet) logUnlock() {\n\tif !vs.writing {\n\t\tpanic(\"MANIFEST not locked for writing\")\n\t}\n\tvs.writing = false\n\tvs.writerCond.Signal()\n}", "func (r *Locking) MustUnlock() (Result, error) {\n\treturn r.delete()\n}", "func (w *Writer) lock() error {\n\tw.mutex.Lock()\n\tif w.tar == nil {\n\t\tw.mutex.Unlock()\n\t\treturn errors.New(\"Internal error: trying to use an already closed tarfile.Writer\")\n\t}\n\treturn nil\n}", "func (m *Mutex) TryRelease() bool {\n\treturn atomic.CompareAndSwapUint32(&m.l, 1, 0)\n}", "func TestUnlockUnlocked(t *testing.T) {\n\tvar mu ctxsync.Mutex\n\tassert.Panics(t, func() { mu.Unlock() })\n}", "func (m *RWMutex) NestedUnlock(i lockNameIndex) {\n\tm.mu.Unlock()\n\tlocking.DelGLock(genericMarkIndex, int(i))\n}", "func (p *pool) Unlock(user, resourceName string) error {\n\tfor k, v := range p.locks {\n\t\tif v == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif k.Name != resourceName {\n\t\t\tcontinue\n\t\t}\n\n\t\tif v.User != user {\n\t\t\treturn ErrResourceLockedByDifferentUser\n\t\t}\n\n\t\tp.locks[k] = nil\n\n\t\tif err := storage.Delete(storageKey, k.Name); err != nil {\n\t\t\tlog.Error(errors.Wrap(err, \"error while storing pool lock entry\"))\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *CheckedLock) Unlock() {\n\tif !c.locked {\n\t\tBug(\"Double unlocking sync.Mutex\")\n\t}\n\tc.locked = false\n\tc.lock.Unlock()\n}", "func (f *file) Lock() error {\n\treturn nil\n}", "func (fsi *fsIOPool) Close(path string) error {\n\tfsi.Lock()\n\tdefer fsi.Unlock()\n\n\tif err := checkPathLength(path); err != nil {\n\t\treturn err\n\t}\n\n\t// Pop readers from path.\n\trlkFile, ok := fsi.readersMap[path]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\t// Close the reader.\n\trlkFile.Close()\n\n\t// If the file is closed, remove it from the reader pool map.\n\tif rlkFile.IsClosed() {\n\n\t\t// Purge the cached lock path from map.\n\t\tdelete(fsi.readersMap, path)\n\t}\n\n\t// Success.\n\treturn nil\n}", "func (r *RedisLock) Unlock(ctx context.Context) error {\n\tif r.l == nil {\n\t\treturn redislock.ErrLockNotHeld\n\t}\n\n\tlockCtx, cancel := context.WithTimeout(ctx, r.ttl)\n\tdefer cancel()\n\treturn r.l.Release(lockCtx)\n}", "func (g MutexGuard[T, M]) Unlock() {\n\tg.m.Unlock()\n}", "func (kvclient *MockResKVClient) ReleaseLock(lockName string) error {\n\treturn nil\n}", "func (lr *libraryCache) Release() {\n\tlr.mtx.Lock()\n\tdefer lr.mtx.Unlock()\n\n\tif lr.refCount == 0 {\n\t\treturn\n\t}\n\n\tlr.refCount--\n\tif lr.refCount == 0 {\n\t\tos.RemoveAll(lr.path)\n\t\tlr.path = \"\"\n\t}\n}", "func (tm *TabletManager) unlock() {\n\ttm.actionSema.Release(1)\n}", "func (m *LocalDLock) Unlock(key string) error {\n\tkey = strings.ToLower(key)\n\n\tl := m.lockMeta(key)\n\tif l == nil {\n\t\treturn ErrDidNotUnlock\n\t}\n\n\tm.release(key)\n\n\treturn nil\n}", "func (l *locker) Unlock(key string) error {\n\tm, ok := l.mutexs[key]\n\tif !ok {\n\t\treturn nil\n\t}\n\tm.Unlock()\n\treturn nil\n}", "func (b *bearerTokenPolicy) unlock() {\n\tb.cond.Broadcast()\n\tb.cond.L.Unlock()\n}", "func Unlockpt(f *os.File) error {\n\tvar u int32\n\n\treturn Ioctl(f.Fd(), syscall.TIOCSPTLCK, uintptr(unsafe.Pointer(&u)))\n}", "func (v *SafeSet) Unlock() {\n\tv.mu.Unlock()\n}", "func (n *nsLockMap) unlock(volume, path, opsID string, readLock bool) {\n\tparam := nsParam{volume, path}\n\tn.lockMapMutex.RLock()\n\tnsLk, found := n.lockMap[param]\n\tn.lockMapMutex.RUnlock()\n\tif !found {\n\t\treturn\n\t}\n\tif readLock {\n\t\tnsLk.RUnlock()\n\t} else {\n\t\tnsLk.Unlock()\n\t}\n\tn.lockMapMutex.Lock()\n\tif nsLk.ref == 0 {\n\t\tlogger.LogIf(context.Background(), errors.New(\"Namespace reference count cannot be 0\"))\n\t} else {\n\t\tnsLk.ref--\n\t\tif nsLk.ref == 0 {\n\t\t\t// Remove from the map if there are no more references.\n\t\t\tdelete(n.lockMap, param)\n\t\t}\n\t}\n\tn.lockMapMutex.Unlock()\n}" ]
[ "0.7291195", "0.71327233", "0.7082573", "0.6988317", "0.6927185", "0.6922704", "0.69134337", "0.6886802", "0.6824476", "0.68202007", "0.67619586", "0.671021", "0.664967", "0.6605279", "0.6600593", "0.65595156", "0.65485597", "0.65302503", "0.65296257", "0.65162563", "0.650584", "0.6504381", "0.6480484", "0.64705074", "0.64675057", "0.6458852", "0.64481246", "0.64338285", "0.638143", "0.6354684", "0.63428164", "0.6339061", "0.631476", "0.62573177", "0.62481534", "0.6244132", "0.62358886", "0.62035346", "0.6193057", "0.6169591", "0.61688805", "0.61613", "0.61604357", "0.614922", "0.61352813", "0.6086423", "0.60356086", "0.6013359", "0.599858", "0.5996862", "0.5993351", "0.5988026", "0.5985696", "0.59848094", "0.59732866", "0.5969968", "0.59687656", "0.5961734", "0.59387684", "0.59385705", "0.5925701", "0.59152734", "0.59113944", "0.5904769", "0.5899427", "0.5891433", "0.5884989", "0.5875652", "0.5870513", "0.58533806", "0.5838645", "0.5825125", "0.5812563", "0.5799066", "0.5798249", "0.57909644", "0.57885087", "0.57752055", "0.5769993", "0.5765821", "0.5756658", "0.5753864", "0.5746041", "0.57339704", "0.5728241", "0.57267845", "0.5705784", "0.5699797", "0.56880856", "0.5686735", "0.5684433", "0.5683506", "0.5680422", "0.56758446", "0.56710863", "0.56693554", "0.56689036", "0.56662214", "0.5664744", "0.5663433" ]
0.7891906
0
String is the Stringer interface of Statistics.
func (s Statistics) String() string { return fmt.Sprintf("\nResult statistic:\nCnt: bad=%v, timeout=%v\nTime: min=%v, middle=%v, max=%v, full=%v", s.CntBad, s.CntTimeout, s.MinTime, s.MiddleTime, s.MaxTime, s.FullTime) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s Statistics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Statistics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s MeterStats) String() string {\n\treturn fmt.Sprintf(\"Meter <%s>: %d since %v, rate: %.3f current, %.3f average\\n\",\n\t\ts.Name, s.TotalCount, s.Start.Format(timeFormat), s.IntervalRatePerS, s.TotalRatePerS)\n}", "func (hist *Histogram) StringStats() string {\n\tvar buffer strings.Builder\n\t_, _ = hist.WriteStatsTo(&buffer)\n\treturn buffer.String()\n}", "func (s GetMetricStatisticsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeviceStats) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Sampling) String() string {\n\tswitch s {\n\tcase Disabled:\n\t\treturn \"disabled\"\n\tcase Production:\n\t\treturn \"production\"\n\tcase Testing:\n\t\treturn \"testing\"\n\t}\n\treturn strconv.FormatFloat(float64(s), 'f', -1, 64)\n}", "func (e *LegacyTabletStats) String() string {\n\treturn fmt.Sprint(*e)\n}", "func (st StatType) String() string {\n\tswitch st {\n\tcase Avg:\n\t\treturn ElemAvg\n\tcase Max:\n\t\treturn ElemMax\n\tcase Min:\n\t\treturn ElemMin\n\t}\n\treturn \"unknown\"\n}", "func (s TaskStatistics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s *StatGroup) String() string {\n\treturn fmt.Sprintf(\"min: %f, max: %f, mean: %f, count: %d, sum: %f\", s.Min, s.Max, s.Mean, s.Count, s.Sum)\n}", "func (s IntentStatistics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (ms *Measurements) String() string {\n\treturn fmt.Sprint(*ms)\n}", "func (m *Metrics) String() string {\n\tb, _ := json.Marshal(m)\n\treturn string(b)\n}", "func (s GetUsageStatisticsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r BenchmarkResult) String() string {}", "func (s SlotTypeStatistics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (hist *Histogram) String() string {\n\tvar buffer strings.Builder\n\t_, _ = hist.WriteTo(&buffer)\n\treturn buffer.String()\n}", "func (p *Pool) String() string {\n\ts := fmt.Sprintf(\"%+v\", p.Stats)\n\ts = strings.Replace(s, \":\", \"=\", -1)\n\ts = strings.Trim(s, \"{}\")\n\treturn s\n}", "func (m *Metric) String() string {\n\treturn fmt.Sprintf(\"%#v\", m)\n}", "func (s BotRecommendationResultStatistics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s GetMetricStatisticsInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s *statGroup) string() string {\n\treturn fmt.Sprintf(\"min: %8.2fms, med: %8.2fms, mean: %8.2fms, max: %7.2fms, stddev: %8.2fms, sum: %5.1fsec, count: %d\", s.min, s.median(), s.mean, s.max, s.stdDev, s.sum/1e3, s.count)\n}", "func (v HistogramValue) String() string {\n\tvar b bytes.Buffer\n\tv.Print(&b)\n\treturn b.String()\n}", "func (s MetricData) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s StatisticalThreshold) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (h *Histogram) String() string {\n\tvar strs []string\n\tfor _, b := range h.Buckets {\n\t\tstrs = append(strs, fmt.Sprintf(\"[%d,%d):%d\", b.Min, b.Max, b.Count))\n\t}\n\treturn h.Name + \": [\" + strings.Join(strs, \" \") + \"]; \" + fmt.Sprintf(\"sum %d\", h.Sum)\n}", "func (s Metric) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (me TRequesterStatistic) String() string { return xsdt.String(me).String() }", "func (v Value) String() string {\n\tif v.Err != nil {\n\t\treturn v.Err.Error()\n\t}\n\treturn fmt.Sprintf(\"%s %s\", strconv.FormatFloat(v.Value, 'f', -1, 64), v.Stat.Unit)\n}", "func (m Metric) String() string {\n\tswitch m {\n\tcase MetricCPUPercentAllocation:\n\t\treturn \"cpu_percent_allocation\"\n\tcase MetricGPUPercentAllocation:\n\t\treturn \"gpu_percent_allocation\"\n\tcase MetricMemoryPercentAllocation:\n\t\treturn \"memory_percent_allocation\"\n\tcase MetricEphemeralStoragePercentAllocation:\n\t\treturn \"ephemeral_storage_percent_allocation\"\n\tcase MetricPodPercentAllocation:\n\t\treturn \"pod_percent_allocation\"\n\t}\n\n\treturn \"unknown\"\n}", "func (s Metrics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (f Function) String() string {\n\ts := make([]string, len(f.stats))\n\tfor i, st := range f.stats {\n\t\ts[i] = st.String()\n\t}\n\treturn format(fmt.Sprintf(\"%s %s(%s)\", f.retType, f.ident.name, f.params.String()), s...)\n}", "func (s *flowStats) String() string {\n\ttstart := time.Unix(0, s.TimeStart)\n\ttout := int32(s.TimeOut)\n\treturn fmt.Sprintf(\"TS %v, TO %d(sec), proto %d src=%s dst=%s sport=%d dport=%d, snd=pkts/bytes %d/%d rcv=pkts/bytes %d/%d app-init %v, appNum %d, aclnum 0x%x\",\n\t\ttstart, tout, s.Proto, s.SrcIP, s.DstIP, s.SrcPort, s.DstPort, s.SendPkts, s.SendBytes,\n\t\ts.RecvPkts, s.RecvBytes, s.AppInitiate, s.appNum, s.aclNum)\n}", "func (s stressng) String() string {\n\treturn s.name\n}", "func (s *Stats) String() string {\n\tvar total int64\n\tcodes := make(map[string]int64)\n\tfor k, v := range s.StatusCodes {\n\t\tcode := strconv.Itoa(k)[:1] + \"xx\"\n\t\tif k == -1 {\n\t\t\tcode = \"Not Crawled\"\n\t\t}\n\t\ttotal += v\n\t\tcodes[code] += v\n\t}\n\n\tif total == 0 {\n\t\treturn \"\"\n\t}\n\n\t// calculate our crawl rate\n\tnano := float64(s.elapsed) // time.Duration is in nanoseconds\n\tmicro := nano / 1000\n\tmilli := micro / 1000\n\tsecond := milli / 1000\n\trps := total / int64(second)\n\n\tstats := fmt.Sprintf(\"[stats] Crawled: %v Elapsed: %v\\n\", total, s.elapsed)\n\tstats += fmt.Sprintf(\"[stats] Rate: %v per second, %v per minute, %v per hour, %v per day\\n\",\n\t\thumanize.Comma(rps), humanize.Comma(rps*60), humanize.Comma(rps*60*60), humanize.Comma(rps*60*60*24))\n\n\tstats += fmt.Sprint(\"[stats]\")\n\n\tkeys := []string{}\n\tfor k := range codes {\n\t\tkeys = append(keys, k)\n\t}\n\n\tsort.Strings(keys)\n\tfor _, k := range keys {\n\t\tstats += fmt.Sprintf(\"%v (%v%%) \", k, strconv.Itoa(int(100*codes[k]/total)))\n\t}\n\n\tstats += fmt.Sprintf(\"\\n\")\n\treturn stats\n}", "func (s CWStatsSet) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s *Summary) String() string {\n\treturn fmt.Sprintf(\n\t\t\"\\n{Connections: %d, RequestRate: %d, RequestTotal: %d, SuccessTotal: %d, ErrorTotal: %d, TimeElapsed: %s, Throughput: %.2f/s}\",\n\t\ts.Connections, s.RequestRate, (s.SuccessTotal + s.ErrorTotal), s.SuccessTotal, s.ErrorTotal, s.TimeElapsed, s.Throughput)\n}", "func (self StringEqualer) String() string {\n\treturn fmt.Sprintf(\"%s\", self.S)\n}", "func (s GetUsageStatisticsInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s MetricValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s MetricValue) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (a *statisticsAction) String() string {\n\tvar props = &statisticsActionProps{}\n\n\tif a.props != nil {\n\t\tprops = a.props\n\t}\n\n\treturn props.tr(a.log, nil)\n}", "func (certainty Certainty) String() string {\n\tif certainty == CertaintyObserved {\n\t\treturn \"Observed\"\n\t} else if certainty == CertaintyLikely {\n\t\treturn \"Likely\"\n\t} else if certainty == CertaintyPossible {\n\t\treturn \"Possible\"\n\t} else if certainty == CertaintyUnlikely {\n\t\treturn \"Unlikley\"\n\t} else if certainty == CertaintyUnknown {\n\t\treturn \"Unknown\"\n\t}\n\n\treturn \"\"\n}", "func (s MetricsSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s EndpointPerformance) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (m MetricDto) String() string {\n\treturn fmt.Sprintf(\"Metric--> key: %s - value: %d\", m.Key, m.Value)\n}", "func (n *NormalModel) String() string {\n\treturn fmt.Sprintf(\"N(%f,%f)\", n.Mean, n.StandardDeviation)\n}", "func (s SequencerData) String() string {\n\treturn fmt.Sprintf(\"%T len %v\", s, s.Len())\n}", "func (statsResponse *StatsResponse) String() string {\n\tstatsResponseBytes, err := json.Marshal(statsResponse)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\treturn string(statsResponseBytes)\n}", "func (sev Severity) String() string {\n\treturn string(sev)\n}", "func (s ModelMetrics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s *S) String() string {\n\treturn fmt.Sprintf(\"%s\", s) // Sprintf will call s.String()\n}", "func (s MonitoringStatisticsResource) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c *Counter) String() string {\n\treturn fmt.Sprintf(\"%s\\t%v\",c.key,c.count)\n}", "func (self *T) String() string {\n\treturn fmt.Sprintf(\"%f %f %f %f\", self[0], self[1], self[2], self[3])\n}", "func (h *Histogram) String() string {\n\th.mutex.Lock()\n\tdefer h.mutex.Unlock()\n\tbuf, err := json.Marshal(h.values)\n\tif err != nil {\n\t\treturn \"{}\"\n\t}\n\treturn string(buf)\n}", "func (number Number) String() string {\n\treturn string(number)\n}", "func (s UsageStatisticsSortBy) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (h *Histogram) String() string {\n\tb, _ := h.MarshalJSON()\n\treturn string(b)\n}", "func (unit HbarUnit) String() string {\n\treturn string(unit)\n}", "func (s TrialComponentMetricSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s UsageMetricBasis) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (z *Float64) String() string {\n\ta := make([]string, 5)\n\ta[0] = leftBracket\n\ta[1] = fmt.Sprintf(\"%g\", z.l)\n\ta[2] = sprintFloat64(z.r)\n\ta[3] = unitName\n\ta[4] = rightBracket\n\treturn strings.Join(a, \"\")\n}", "func (x *Float) String() string {}", "func (s Series) String() string {\n\tjs, _ := json.Marshal(s)\n\treturn string(js)\n}", "func (c *ElementCounter) String() string {\n\tvar b bytes.Buffer\n\tvar ordered []string\n\tfor elm := range c.m {\n\t\tordered = append(ordered, elm)\n\t}\n\tsort.Strings(ordered)\n\n\tfor _, elm := range ordered {\n\t\tfmt.Fprintf(&b, \"%10s: %2d\\n\", elm, c.m[elm])\n\t}\n\treturn b.String()\n}", "func (s *S1Strategy) String() string {\n\treturn fmt.Sprintf(\"S1: ema short period: %d, ema long period: %d, ema up threshold: %f, ema down threshold: %f, rsi entrance threshold: %f, rsi exit threshold: %f\",\n\t\ts.EMAShortPeriod, s.EMALongPeriod, s.EMAUpThreshold, s.EMADownThreshold,\n\t\ts.RSIEntranceThreshold, s.RSIExitThreshold,\n\t)\n}", "func (s *severityValue) String() string {\n\treturn strconv.FormatInt(int64(s.Severity), 10)\n}", "func (pr *PeriodicReader) String() string {\n\treturn fmt.Sprintf(\"%v interval %v\", pr.exporter.String(), pr.interval)\n}", "func (e Speaksfor) String() string {\n\treturn fmt.Sprintf(\"%v\", e)\n}", "func (errors *Errors) String() string {\n\treturn errors.counter.String()\n}", "func (nt NumberDataPointValueType) String() string {\n\tswitch nt {\n\tcase NumberDataPointValueTypeEmpty:\n\t\treturn \"Empty\"\n\tcase NumberDataPointValueTypeInt:\n\t\treturn \"Int\"\n\tcase NumberDataPointValueTypeDouble:\n\t\treturn \"Double\"\n\t}\n\treturn \"\"\n}", "func (s pgStatDatabase) String() string {\n\tres := make([]string, 2)\n\tres[0] = \"DatID: \" + reform.Inspect(s.DatID, true)\n\tres[1] = \"DatName: \" + reform.Inspect(s.DatName, true)\n\treturn strings.Join(res, \", \")\n}", "func (b *Bench) String() string {\n\tprefix := \" \"\n\tvar buf bytes.Buffer\n\tpercentiles := []float64{5, 50, 70, 90, 95, 99, 99.9, 99.95, 99.99, 100}\n\n\tif b.rps <= 0 {\n\t\tfmt.Fprintf(&buf, \"Duration: %2.2fs, Concurrency: %d, Total runs: %d\\n\", b.timeTaken.Seconds(), b.concurrentRuns, b.calls)\n\t} else {\n\t\tfmt.Fprintf(&buf, \"Rate: %d calls/sec, Duration: %2.2fs, Concurrency: %d, Total runs: %d\\n\", b.rps, b.timeTaken.Seconds(), b.concurrentRuns, b.calls)\n\t}\n\n\tfor n, h := range b.timers {\n\t\tfmt.Fprintf(&buf, \"%s>>Timer: %s \\n\", prefix, n)\n\t\tfor _, p := range percentiles {\n\t\t\tfmt.Fprintf(&buf, \"%s%s%2.2fth percentile: %.2fms\\n\", prefix, prefix, p, float64(h.ValueAtQuantile(p))/1000000)\n\t\t}\n\t\tfmt.Fprintf(&buf, \"%s%sMean: %.2fms\\n\", prefix, prefix, float64(h.Mean())/1000000.0)\n\t}\n\tfor n, count := range b.counters {\n\t\tfmt.Fprintf(&buf, \"%s>>Counter: %s\\n\", prefix, n)\n\t\tfmt.Fprintf(&buf, \"%s%sValue: %d \\n\", prefix, prefix, count)\n\t}\n\treturn buf.String()\n}", "func (a *Analysis) String() string {\n\tvar out strings.Builder\n\tfmt.Fprintf(&out, \"Name: %s\\nObjectCount: %d\\nTotalSize: %s\\nCreationDate: %s\\nLastModified: %s\\n\",\n\t\ta.Name,\n\t\ta.TotalCount,\n\t\tbyteCountToHuman(a.TotalSize),\n\t\ta.CreationDate.Format(time.RFC3339),\n\t\ta.LastModified.Format(time.RFC3339))\n\tfmt.Fprintf(&out, \"Objects:\\n\")\n\tfor _, o := range a.Objects {\n\t\tfmt.Fprintf(&out, \" * %s\\n\", o)\n\t}\n\tfmt.Fprintf(&out, \"TotalSizePerAccount:\\n\")\n\tfor owner, size := range a.SizePerOwnerID {\n\t\tfmt.Fprintf(&out, \" * %s/%s %s\\n\", byteCountToHuman(size), byteCountToHuman(a.TotalSize), owner)\n\t}\n\treturn out.String()\n}", "func (o *Metrics) String() string {\n \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 (c *Collector) String() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tif len(c.Buckets) == 0 {\n\t\treturn \"\"\n\t}\n\n\tnLen := printfLen(\"%.2f\", c.Min)\n\tif maxLen := printfLen(\"%.2f\", c.Max); maxLen > nLen {\n\t\tnLen = maxLen\n\t}\n\t// if c.Max is +Inf, the second-largest element can be the longest.\n\tif maxLen := printfLen(\"%.2f\", c.Buckets[len(c.Buckets)-1].Min); maxLen > nLen {\n\t\tnLen = maxLen\n\t}\n\n\tcLen := printfLen(\"%d\", c.Count)\n\tsLen := 0\n\n\tvar res strings.Builder\n\n\tfmt.Fprintf(&res, \"[%*s %*s] %*s total%%\", nLen, \"min\", nLen, \"max\", cLen, \"cnt\")\n\n\tif c.PrintSum {\n\t\tsLen = printfLen(\"%.2f\", c.Sum)\n\t\tfmt.Fprintf(&res, \" %*s\", sLen, \"sum\")\n\t}\n\n\tfmt.Fprintf(&res, \" (%d events)\\n\", c.Count)\n\n\tfor _, b := range c.Buckets {\n\t\tpercent := float64(100*b.Count) / float64(c.Count)\n\n\t\tfmt.Fprintf(&res, \"[%*.2f %*.2f] %*d %5.2f%%\", nLen, b.Min, nLen, b.Max, cLen, b.Count, percent)\n\n\t\tif c.PrintSum {\n\t\t\tfmt.Fprintf(&res, \" %*.2f\", sLen, b.Sum)\n\t\t}\n\n\t\tif dots := strings.Repeat(\".\", int(percent)); len(dots) > 0 {\n\t\t\tfmt.Fprint(&res, \" \", dots)\n\t\t}\n\n\t\tfmt.Fprintln(&res)\n\t}\n\n\treturn res.String()\n}", "func (s MetricsSource) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (value *Value) String() string {\n\treturn strconv.FormatInt(value.Data, 10)\n}", "func (s MetricDatum) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s *FKCascadeRuntimeStats) String() string {\n\tbuf := bytes.NewBuffer(make([]byte, 0, 32))\n\tbuf.WriteString(\"total:\")\n\tbuf.WriteString(execdetails.FormatDuration(s.Total))\n\tif s.Keys > 0 {\n\t\tbuf.WriteString(\", foreign_keys:\")\n\t\tbuf.WriteString(strconv.Itoa(s.Keys))\n\t}\n\treturn buf.String()\n}", "func (s MetricSpecification) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String(v interface{}) string {\n\treturn v.(string)\n}", "func (sd StrDist) String() string {\n\treturn fmt.Sprintf(\"Str: '%s', Dist: %.5f\", sd.Str, sd.Dist)\n}", "func (counter *Counter) String() string {\n\treturn fmt.Sprintf(\"{count: %d}\", counter.count)\n}", "func (f *Float) String() string {\n\ts, _ := f.StringBase(10, 0)\n\treturn s\n}", "func (s InferenceMetrics) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (r WriteCounter) String() string {\n\treturn fmt.Sprintf(\"There were %v write operations totaling %v bytes\", r.numWrites, r.numBytes)\n}", "func (self *monitoringData) String() string {\n\tstr, _ := self.JSON()\n\treturn str\n}", "func String() string {\n\treturn StringWithSize(IntInRange(1, 8))\n}", "func (s MetricDefinition) 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 MetricDataV2) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s AnalyticsUtteranceMetric) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s Series) Str() string {\n\tvar ret []string\n\t// If name exists print name\n\tif s.Name != \"\" {\n\t\tret = append(ret, \"Name: \"+s.Name)\n\t}\n\tret = append(ret, \"Type: \"+fmt.Sprint(s.t))\n\tret = append(ret, \"Length: \"+fmt.Sprint(s.Len()))\n\tif s.Len() != 0 {\n\t\tret = append(ret, \"Values: \"+fmt.Sprint(s))\n\t}\n\treturn strings.Join(ret, \"\\n\")\n}", "func (s *Stat) String() string {\n\treturn fmt.Sprintf(\"License propagation: %d added, %d skipped, %d autogenerated files\",\n\t\ts.Added, s.Skipped, s.DoNotModify)\n}", "func (x *Big) String() string {\n\tif x == nil {\n\t\treturn \"<nil>\"\n\t}\n\tvar (\n\t\tb = new(strings.Builder)\n\t\tf = formatter{w: b, prec: x.Precision(), width: noWidth}\n\t\te = sciE[x.Context.OperatingMode]\n\t)\n\tb.Grow(x.Precision())\n\tf.format(x, normal, e)\n\treturn b.String()\n}", "func (self *T) String() string {\n\treturn fmt.Sprintf(\"%f %f\", self[0], self[1])\n}", "func (individual Individual) String() string {\n\ts := \"\"\n\t//print all the genes\n\tfor _,gene := range individual.Genes {\n\t\ts += gene.String()\n\t}\n\t// followed by a space and the fitness\n\ts += \" \" + strconv.Itoa(individual.Fitness) + \"\\n\"\n\treturn s\n}" ]
[ "0.8234325", "0.8234325", "0.7525964", "0.7318602", "0.7292317", "0.729065", "0.72792244", "0.72606456", "0.72602284", "0.7199449", "0.71782595", "0.71585536", "0.7139482", "0.7139436", "0.71277934", "0.71164274", "0.71054", "0.71043813", "0.70839185", "0.705832", "0.7039552", "0.7016661", "0.7005149", "0.699987", "0.69720894", "0.69710135", "0.6941757", "0.69325536", "0.69225776", "0.6897715", "0.6896636", "0.68808573", "0.6866214", "0.68605983", "0.68541735", "0.68474174", "0.68394285", "0.6833846", "0.6818397", "0.6810454", "0.68044", "0.68044", "0.6795874", "0.6780867", "0.6778408", "0.67752695", "0.6764378", "0.6762841", "0.67627406", "0.6760393", "0.6748232", "0.67430925", "0.67415607", "0.67402077", "0.67209566", "0.6719393", "0.6711768", "0.67041", "0.6695164", "0.66890335", "0.6685924", "0.668521", "0.6685101", "0.6683553", "0.6683092", "0.6682039", "0.66788703", "0.66724885", "0.6666361", "0.66649675", "0.6660576", "0.6657313", "0.6641712", "0.66412526", "0.6633487", "0.66321546", "0.6631131", "0.6629348", "0.662154", "0.6619741", "0.6617655", "0.66166395", "0.6614769", "0.6604682", "0.6599174", "0.65953547", "0.6593551", "0.65916127", "0.65906996", "0.6580859", "0.6572778", "0.6572306", "0.657039", "0.65701157", "0.6569196", "0.65681213", "0.6563563", "0.6555486", "0.6551158", "0.6550457" ]
0.7850229
2
Main function parsed initial parameters, created requests and check result
func main() { domain := flag.String("domain", "", "a domain name") var cntRepeat uint flag.UintVar(&cntRepeat, "cnt", 0, "repeat requests count - positive") var timeout uint flag.UintVar(&timeout, "timeout", 0, "[timeout (ms) - optional, positive]") flag.Parse() // Check existing obligatory params if *domain == "" || cntRepeat == 0 { flag.PrintDefaults() os.Exit(1) } c := make(chan RetData) client := http.Client{ Timeout: time.Second * time.Duration(timeout) / time.Duration(1000), } // Start gorutines with http requests for i := uint(0); i < cntRepeat; i++ { go checkResource(domain, c, &client) } stat := Statistics{} countingStat(&stat, cntRepeat, c) // Print result of request test fmt.Println(stat) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func compareRequest() {\n\tvar artifactList1, artifactList2 []ArtifactRecord\n\tvar artifactSetName1, artifactSetName2 string = \"111\", \"222\"\n\tvar listTitle1, listTitle2 string\n\tvar repoCount int\n\tvar err error\n\n\tif len(os.Args[1:]) == 1 {\n\t\tfmt.Println(_COMPARE_HELP_CONTENT)\n\t\treturn\n\t}\n\n\t// At least one additional argument.\n\t//scanner := bufio.NewScanner(os.Stdin)\n\trepoCount = 0\n\tfor i := 2; i < len(os.Args) && repoCount < 2; i++ {\n\t\t// Check if \"help\" is the second argument.\n\t\tartifact_arg := os.Args[i]\n\t\tswitch strings.ToLower(artifact_arg) {\n\t\tcase \"--help\", \"-help\", \"-h\":\n\t\t\tfmt.Println(_COMPARE_HELP_CONTENT)\n\t\t\treturn\n\t\tcase \"--dir\":\n\t\t\t////fmt.Println (len (os.Args[:i]))\n\t\t\tif len(os.Args[i:]) == 1 {\n\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"Missing next argument: a directory was expected for argument %d\", i))\n\t\t\t\treturn // we are done. exit.\n\t\t\t} else {\n\t\t\t\tdirectory := os.Args[i+1]\n\t\t\t\ti++\n\t\t\t\tif !isDirectory(directory) {\n\t\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"Argument %d: '%s' is not a directory\", i, directory))\n\t\t\t\t\treturn // we are done. exit.\n\t\t\t\t}\n\t\t\t\tswitch repoCount {\n\t\t\t\tcase 0:\n\t\t\t\t\tartifactList1, _ = createEnvelopeFromDirectory(directory, false)\n\t\t\t\t\tartifactSetName1 = directory\n\t\t\t\t\tlistTitle1 = \" Directory** \"\n\t\t\t\t\trepoCount++ // we can accept up to two repositories (director and/or part)\n\t\t\t\tcase 1:\n\t\t\t\t\tartifactList2, _ = createEnvelopeFromDirectory(directory, false)\n\t\t\t\t\tartifactSetName2 = directory\n\t\t\t\t\tlistTitle2 = \" Directory++ \"\n\t\t\t\t\trepoCount++ // we can accept up to two repositories (director and/or part)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase \"--env\":\n\t\t\tif len(os.Args[i:]) == 1 {\n\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"Missing next argument: a directory was expected for argument %d\", i))\n\t\t\t\treturn // we are done. exit.\n\t\t\t} else {\n\t\t\t\tpart_uuid := os.Args[i+1]\n\t\t\t\ti++\n\t\t\t\tif !isValidUUID(part_uuid) {\n\t\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"'%s' is not valid uuid\", part_uuid))\n\t\t\t\t\treturn // we are done. exit.\n\t\t\t\t}\n\t\t\t\tswitch repoCount {\n\t\t\t\tcase 0:\n\t\t\t\t\t//artifactList1, err = getPartArtifacts(part_uuid)\n\t\t\t\t\tartifactList1, err = getEnvelopeArtifactsFromLedger(part_uuid)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tdisplayErrorMsg(err.Error())\n\t\t\t\t\t\treturn // we are done. exit.\n\t\t\t\t\t}\n\t\t\t\t\tartifactSetName1, _ = getAliasUsingValue(part_uuid)\n\t\t\t\t\tif len(artifactSetName1) < 1 {\n\t\t\t\t\t\tartifactSetName1 = trimUUID(part_uuid, 5)\n\t\t\t\t\t}\n\t\t\t\t\tlistTitle1 = \" Ledger** \"\n\t\t\t\t\trepoCount++ // we can accept up to two repositories (director and/or part)\n\t\t\t\tcase 1:\n\t\t\t\t\t// artifactList2, err = getPartArtifacts(part_uuid)\n\t\t\t\t\tartifactList2, err = getEnvelopeArtifactsFromLedger(part_uuid)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tdisplayErrorMsg(err.Error())\n\t\t\t\t\t\treturn // we are done. exit.\n\t\t\t\t\t}\n\t\t\t\t\tartifactSetName2, _ = getAliasUsingValue(part_uuid)\n\t\t\t\t\tif len(artifactSetName2) < 1 {\n\t\t\t\t\t\tartifactSetName2 = trimUUID(part_uuid, 5)\n\t\t\t\t\t}\n\t\t\t\t\tlistTitle2 = \" Ledger++ \"\n\t\t\t\t\trepoCount++ // we can accept up to two repositories (director and/or part)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\tdefault:\n\t\t\tdisplayErrorMsg(fmt.Sprintf(\"'%s' is not a valid argument.\\n\", os.Args[i]))\n\t\t\treturn // we are done. exit.\n\t\t} // switch strings.ToLower(artifact_arg)\n\t} // for i :=\n\n\tif repoCount < 2 { // make sure we have two repositories to compare.\n\n\t\tdisplayErrorMsg(fmt.Sprintf(\"Missing two repositories to compare. Try: %s %s --help\",\n\t\t\tfilepath.Base(os.Args[0]), os.Args[1]))\n\t\treturn\n\t}\n\t// check if any artifacts to display\n\tif len(artifactList1) == 0 {\n\t\tfmt.Printf(\"No artifacts are contained within repo %s\\n\", artifactSetName1)\n\t\treturn\n\t}\n\t// check if any artifacts to display.\n\tif len(artifactList2) == 0 {\n\t\tfmt.Printf(\"No artifacts are contained within repo %s\\n\", artifactSetName2)\n\t\treturn\n\t}\n\n\terr = displayListComparison(artifactList1, artifactList2, listTitle1, listTitle2, artifactSetName1, artifactSetName2)\n}", "func compareRequest2() {\n\tvar artifactList1, artifactList2 []ArtifactRecord\n\tvar artifactName1, artifactName2 string = \"111\", \"222\"\n\tvar listTitle1, listTitle2 string\n\tvar repoCount int\n\tvar err error\n\n\tif len(os.Args[1:]) == 1 {\n\t\tfmt.Println(_COMPARE_HELP_CONTENT)\n\t\treturn\n\t}\n\n\t// At least one additional argument.\n\t//scanner := bufio.NewScanner(os.Stdin)\n\trepoCount = 0\n\tfor i := 2; i < len(os.Args) && repoCount < 2; i++ {\n\t\t// Check if \"help\" is the second argument.\n\t\tartifact_arg := os.Args[i]\n\t\tswitch strings.ToLower(artifact_arg) {\n\t\tcase \"--help\", \"-help\", \"-h\":\n\t\t\tfmt.Println(_COMPARE_HELP_CONTENT)\n\t\t\treturn\n\t\tcase \"--dir\":\n\t\t\t////fmt.Println (len (os.Args[:i]))\n\t\t\tif len(os.Args[i:]) == 1 {\n\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"Missing next argument: a directory was expected for argument %d\", i))\n\t\t\t\treturn // we are done. exit.\n\t\t\t} else {\n\t\t\t\tdirectory := os.Args[i+1]\n\t\t\t\ti++\n\t\t\t\tif !isDirectory(directory) {\n\t\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"Argument %d: '%s' is not a directory\", i, directory))\n\t\t\t\t\treturn // we are done. exit.\n\t\t\t\t}\n\t\t\t\tswitch repoCount {\n\t\t\t\tcase 0:\n\t\t\t\t\tartifactList1, _ = createEnvelopeFromDirectory(directory, false)\n\t\t\t\t\tartifactName1 = directory\n\t\t\t\t\tlistTitle1 = \"Directory**\"\n\t\t\t\t\trepoCount++ // we can accept up to two repositories (director and/or part)\n\t\t\t\tcase 1:\n\t\t\t\t\tartifactList2, _ = createEnvelopeFromDirectory(directory, false)\n\t\t\t\t\tartifactName2 = directory\n\t\t\t\t\tlistTitle2 = \"Directory++\"\n\t\t\t\t\trepoCount++ // we can accept up to two repositories (director and/or part)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase \"--env\":\n\t\t\tif len(os.Args[i:]) == 1 {\n\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"Missing next argument: a directory was expected for argument %d\", i))\n\t\t\t\treturn // we are done. exit.\n\t\t\t} else {\n\t\t\t\tpart_uuid := os.Args[i+1]\n\t\t\t\ti++\n\t\t\t\tif !isValidUUID(part_uuid) {\n\t\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"'%s' is not valid uuid\", part_uuid))\n\t\t\t\t\treturn // we are done. exit.\n\t\t\t\t}\n\t\t\t\tswitch repoCount {\n\t\t\t\tcase 0:\n\t\t\t\t\t//artifactList1, err = getPartArtifacts(part_uuid)\n\t\t\t\t\tartifactList1, err = getEnvelopeArtifactsFromLedger(part_uuid)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tdisplayErrorMsg(err.Error())\n\t\t\t\t\t\treturn // we are done. exit.\n\t\t\t\t\t}\n\t\t\t\t\tartifactName1, _ = getAliasUsingValue(part_uuid)\n\t\t\t\t\tif len(artifactName1) < 1 {\n\t\t\t\t\t\tartifactName1 = trimUUID(part_uuid, 5)\n\t\t\t\t\t}\n\t\t\t\t\tlistTitle1 = \" Ledger** \"\n\t\t\t\t\trepoCount++ // we can accept up to two repositories (director and/or part)\n\t\t\t\tcase 1:\n\t\t\t\t\t// artifactList2, err = getPartArtifacts(part_uuid)\n\t\t\t\t\tartifactList2, err = getEnvelopeArtifactsFromLedger(part_uuid)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tdisplayErrorMsg(err.Error())\n\t\t\t\t\t\treturn // we are done. exit.\n\t\t\t\t\t}\n\t\t\t\t\tartifactName2, _ = getAliasUsingValue(part_uuid)\n\t\t\t\t\tif len(artifactName2) < 1 {\n\t\t\t\t\t\tartifactName2 = trimUUID(part_uuid, 5)\n\t\t\t\t\t}\n\t\t\t\t\tlistTitle2 = \" Ledger++ \"\n\t\t\t\t\trepoCount++ // we can accept up to two repositories (director and/or part)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\tdefault:\n\t\t\tdisplayErrorMsg(fmt.Sprintf(\"'%s' is not a valid argument.\\n\", os.Args[i]))\n\t\t\treturn // we are done. exit.\n\t\t} // switch strings.ToLower(artifact_arg)\n\t} // for i :=\n\n\tif repoCount < 2 { // make sure we have two repositories to compare.\n\n\t\tdisplayErrorMsg(fmt.Sprintf(\"Missing two repositories to compare. Try: %s %s --help\",\n\t\t\tfilepath.Base(os.Args[0]), os.Args[1]))\n\t\treturn\n\t}\n\t// check if any artifacts to display\n\tif len(artifactList1) == 0 {\n\t\tfmt.Printf(\"No artifacts are contained within repo %s\\n\", artifactName1)\n\t\treturn\n\t}\n\t// check if any artifacts to display.\n\tif len(artifactList2) == 0 {\n\t\tfmt.Printf(\"No artifacts are contained within repo %s\\n\", artifactName2)\n\t\treturn\n\t}\n\n\t// Display comparison table\n\tconst equalStr = \"=\"\n\tconst notEqualStr = \"X\"\n\tconst noMatchStr = \" - \"\n\n\t/*******************************************\n\tconst padding = 0\n\t//w := tabwriter.NewWriter(os.Stdout, 0, 0, padding, ' ', tabwriter.Debug)\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, padding, ' ', 0)\n\t// writer := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)\n\tfmt.Println()\n\n\t//fmt.Println(\" \tComparing ...\")\n\tfmt.Fprintf(w, \" \\t %s\\t%s\\t%s\\t%s \\t\\n\", \"----------------------\", \" -----------\", \" \", \" -----------\")\n\t//fmt.Fprintf(w, \" \\t %s \\t%s\\t%s\\t\\n\", \" Artifacts\", \" Directory*\", \" Ledger*\")\n\tfmt.Fprintf(w, \" \\t %s\\t%s\\t%s\\t%s\\t\\n\", \" Artifacts\", listTitle1, \" \", listTitle2)\n\t//fmt.Fprintf(w, \" \\t %s\\t%s %s %s \\t\\n\", \" Artifacts\", listTitle1, \" \", listTitle2)\n\tfmt.Fprintf(w, \" \\t %s\\t%s\\t%s\\t%s \\t\\n\", \"----------------------\", \" -----------\", \" \", \" -----------\")\n\t//fmt.Fprintf(w, \" \\t %s\\t%s %s %s \\t\\n\", \"----------------------\", \" -----------\", \" \", \" -----------\")\n\t*********************************************/\n\tfmt.Println()\n\tconst padding = 0\n\t//w := tabwriter.NewWriter(os.Stdout, 0, 0, padding, ' ', tabwriter.Debug)\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, padding, ' ', 0)\n\n\theader := []string{\" Artifacts \", listTitle1, \"\", listTitle2}\n\tPrintRow(w, PaintRowUniformly(DefaultText, AnonymizeRow(header))) // header separator\n\tPrintRow(w, PaintRowUniformly(CyanText, header))\n\tPrintRow(w, PaintRowUniformly(DefaultText, AnonymizeRow(header))) // header separator\n\n\tvar colors []Color\n\n\tfor i := 0; i < len(artifactList1); i++ {\n\t\tfor k := 0; k < len(artifactList2); k++ {\n\t\t\t// check that it is not the envelope container\n\t\t\tif artifactList1[i].ContentType == \"envelope\" || artifactList2[k].ContentType == \"envelope\" {\n\t\t\t\tif artifactList1[i].ContentType == _ENVELOPE_TYPE {\n\t\t\t\t\tartifactList1[i]._verified = true\n\t\t\t\t}\n\t\t\t\tif artifactList2[k].ContentType == _ENVELOPE_TYPE {\n\t\t\t\t\tartifactList2[k]._verified = true\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// See if we have a match (that is not the main envelope)\n\t\t\tif artifactList1[i].Checksum == artifactList2[k].Checksum {\n\t\t\t\t// we have a match\n\t\t\t\tcolors = []Color{DefaultText, DefaultText, GreenText, DefaultText}\n\t\t\t\t////fmt.Fprintf(w, \"\\t %s\\t %s\\t %s\\t %s\\n\", id, namea, artifacts[i].Type, path)\n\t\t\t\t//fmt.Fprintf(w, \" \\t %s \\t %s \\t %s \\t %s\\t\\n\", artifactList1[i].Name, trimUUID(artifactList1[i].Checksum, 5), equalStr, trimUUID(artifactList2[k].Checksum, 5))\n\t\t\t\tPrintRow(w, PaintRow(colors, []string{\n\t\t\t\t\tartifactList1[i].Name,\n\t\t\t\t\t\" \" + trimUUID(artifactList1[i].Checksum, 5),\n\t\t\t\t\tequalStr,\n\t\t\t\t\t\" \" + trimUUID(artifactList2[k].Checksum, 5)}))\n\t\t\t\t////fmt.Fprintf(w, \" \\t %s \\t %s %s %s\\t\\n\", artifactList1[i].Name, trimUUID(artifactList1[i].Checksum, 5), equalStr, trimUUID(artifactList2[k].Checksum, 5))\n\t\t\t\tartifactList1[i]._verified = true\n\t\t\t\tartifactList2[k]._verified = true\n\t\t\t}\n\t\t}\n\t}\n\t// Now run through the first list to see if any unverified.\n\tfor i := 0; i < len(artifactList1); i++ {\n\t\tif !artifactList1[i]._verified {\n\t\t\tcolors = []Color{DefaultText, DefaultText, RedText, RedText}\n\t\t\tPrintRow(w, PaintRow(colors, []string{\n\t\t\t\tartifactList1[i].Name,\n\t\t\t\t\" \" + trimUUID(artifactList1[i].Checksum, 5),\n\t\t\t\tnotEqualStr,\n\t\t\t\tnoMatchStr}))\n\t\t\t//fmt.Fprintf(w, \" \\t %s \\t %s \\t %s \\t %s\\t\\n\", artifactList1[i].Name, trimUUID(artifactList1[i].Checksum, 5), notEqualStr, noMatchStr)\n\t\t}\n\t}\n\n\t// Now run through the second list to see if any unmatched.\n\tfor k := 0; k < len(artifactList2); k++ {\n\t\tif !artifactList2[k]._verified {\n\t\t\t////id_2 := part_list_2[k].Checksum\n\t\t\t////id_2 = id_2[:5]\n\t\t\t//fmt.Fprintf(w, \" \\t %s \\t %s \\t %s \\t %s\\t\\n\", artifactList2[k].Name2, noMatchStr, notEqualStr, trimUUID(artifactList2[k].Checksum, 5))\n\t\t\t//fmt.Fprintf(w, \" \\t %s \\t %s \\t %s \\t %s\\t\\n\", artifactList2[k].Name2, noMatchStr, notEqualStr, trimUUID(artifactList2[k].Checksum, 5))\n\t\t\tcolors = []Color{DefaultText, RedText, RedText, DefaultText}\n\t\t\tPrintRow(w, PaintRow(colors, []string{\n\t\t\t\tartifactList2[k].Name2,\n\t\t\t\tnoMatchStr,\n\t\t\t\tnotEqualStr,\n\t\t\t\t\" \" + trimUUID(artifactList2[k].Checksum, 5)}))\n\t\t}\n\t}\n\t// Write out comparison table.\n\t//fmt.Fprintf(w, \" \\t %s \\t%s\\t%s\\t\\n\", \"----------------------\", \" -----------\", \" -----------\")\n\t//fmt.Fprintf(w, \" \\t %s\\t%s\\t%s\\t%s \\t\\n\", \"----------------------\", \" -----------\", \" \", \" -----------\")\n\t//fmt.Fprintf(w, \" \\t %s\\t%s\\t%s\\t%s \\t\\n\", \"----------------------\", \" -----------\", \" \", \" -----------\")\n\tPrintRow(w, PaintRowUniformly(DefaultText, AnonymizeRow(header)))\n\tw.Flush()\n\tfmt.Printf(\" **%s%s%s List\\n\", _CYAN_FG, artifactName1, _COLOR_END)\n\tfmt.Printf(\" ++%s%s%s List\\n\", _CYAN_FG, artifactName2, _COLOR_END)\n\tfmt.Println()\n}", "func main() {\n\n\tid := flag.String(\"id\", \"\", \"\")\n\tname := flag.String(\"name\", \"TimeSvr\", \"\")\n\taddr := flag.String(\"http.addr\", \":14444\", \"\")\n\tconsuladdr := flag.String(\"consul.addr\", \"localhost:8500\", \"\")\n\taddress := flag.String(\"consul.regist.addr\", \":14444\", \"\")\n\tcheckhttpurl := flag.String(\"checkhttpurl\", \"http://192.168.10.37:14444\", \"\")\n\tport := flag.Int(\"port\", 14444, \"\")\n\n\tflag.Parse()\n\n\ts := kithttp.NewServer(func(ctx context.Context, request interface{}) (response interface{}, err error) {\n\t\t//if r, ok := request.(string); ok {\n\t\t//\tlog.Println(r)\n\t\t//\tif r == \"1\" {\n\t\t//\t\treturn nil, errors.New(*id + \" : \" + \"Error Req 1\")\n\t\t//\t} else if r == \"2\" {\n\t\t//\t\treturn *id + \" : \" + \"Error Req 2\", nil\n\t\t//\t}\n\t\t//}\n\t\treturn request, nil\n\t}, func(i context.Context, req *http.Request) (request interface{}, err error) {\n\n\t\tbytes, e := ioutil.ReadAll(req.Body)\n\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\treturn string(bytes), nil\n\t}, func(i context.Context, writer http.ResponseWriter, v interface{}) error {\n\n\t\tif v != nil {\n\t\t\tif r, ok := v.(string); ok {\n\n\t\t\t\tif r == \"1\" {\n\t\t\t\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\t\t\t\t//io.WriteString(writer, r)\n\t\t\t\t\treturn errors.New(*id + \" Err req 1\")\n\t\t\t\t} else {\n\t\t\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t\t\t\tio.WriteString(writer, *id+\" => \"+yt.Now())\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t} else {\n\t\t\t\ttime.Sleep(1000 * time.Millisecond)\n\t\t\t\tio.WriteString(writer, *id+\" => \"+yt.Now())\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.New(*id + \"Error\")\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tcfg := api.DefaultConfig()\n\tcfg.Address = *consuladdr\n\tc, e := api.NewClient(cfg)\n\n\tif e != nil {\n\t\tlog.Println(e)\n\t\tos.Exit(-1)\n\t}\n\n\tkitc := consul.NewClient(c)\n\tr := &api.AgentServiceRegistration{Name: *name, Port: *port, Address: *address, Check: &api.AgentServiceCheck{HTTP: *checkhttpurl, Interval: \"2s\"}}\n\tkitc.Register(r)\n\n\thttp.ListenAndServe(*addr, s)\n}", "func runGetFullReq() {\n\t// create new custom request object\n\treq := &http.Request{\n\t\tMethod: http.MethodGet, // set method\n\t\tHeader: http.Header{ // set headers\n\t\t\t\"User-Agent\": {\"cousera-golang\"},\n\t\t},\n\t}\n\t// we can also set url for request, but we do it by url.Parse func below\n\n\t// parse url and add parsed url to created request object\n\treq.URL, _ = url.Parse(\"http://127.0.0.1:8080/?id=42\")\n\t// add \"query parameter\" to request object in \"url\" field\n\treq.URL.Query().Set(\"user\", \"Make\")\n\n\t// do request with created request object parameters\n\t// and !!! \"DEFAULT CLIENT\" !!!\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tfmt.Println(\"error happend\", err)\n\t\treturn\n\t}\n\t// close request body\n\tdefer resp.Body.Close() // !!! very important\n\n\trespBody, err := ioutil.ReadAll(resp.Body) // read resp body just for printin in log\n\tfmt.Printf(\"testGetFullReq resp %#v\\n\\n\\n\", string(respBody))\n}", "func setupRequest(apiID string, apiKey string, argMethod string, argURI string, argPostBody []byte) (*http.Request, error) {\n\turi := atlasURI + argURI\n\turl := atlasHost + uri\n\temptyRequest := http.Request{}\n\treq, err := http.NewRequest(argMethod, url, nil)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Printf(\"Error - setupRequest - Failed http response. Resp: %+v, Err: %+v\", resp, err)\n\t\treturn &emptyRequest, err\n\t}\n\tdefer resp.Body.Close()\n\tdigestParts := digestParts(resp)\n\tdigestParts[\"uri\"] = uri\n\tdigestParts[\"method\"] = argMethod\n\n\tusername := apiID\n\tif len(username) == 0 {\n\t\terr := fmt.Errorf(\"apiID variable not set\")\n\t\tlog.Printf(\"Error - setupRequest. Err: %+v\", err)\n\t\treturn &emptyRequest, err\n\t}\n\n\tpassword := apiKey\n\tif len(password) == 0 {\n\t\terr := fmt.Errorf(\"apiKey variable not set\")\n\t\tlog.Printf(\"Error - setupRequest. Err: %+v\", err)\n\t\treturn &emptyRequest, err\n\t}\n\n\tdigestParts[\"username\"] = username\n\tdigestParts[\"password\"] = password\n\tif argPostBody == nil {\n\t\treq, err = http.NewRequest(argMethod, url, nil)\n\t} else {\n\t\treq, err = http.NewRequest(argMethod, url, bytes.NewBuffer(argPostBody))\n\t}\n\treq.Header.Set(\"Authorization\", getDigestAuthrization(digestParts))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treturn req, nil\n\n}", "func main() {\n\t// Change output location of logs\n\tlog.SetOutput(os.Stdout)\n\n\t// Check the config file\n\tif len(os.Args) != 2 {\n\t\t// No configuration file provided\n\t\toutError(\"[ERROR] No configuration file location provided.\")\n\t\tfmt.Println(usage)\n\t\tos.Exit(1)\n\t}\n\tconfigFile := os.Args[1]\n\tvar err error\n\tconfiguration, err = getConfig(configFile)\n\tif err != nil {\n\t\toutError(\"[ERROR] %s\\n\", err.Error())\n\t\tfmt.Println(usage)\n\t\tos.Exit(1)\n\t}\n\n\t// Send the requests concurrently\n\tlog.Println(\"Requests begin.\")\n\tresponses, errors := sendRequests()\n\tif len(errors) != 0 {\n\t\tfor err := range errors {\n\t\t\toutError(\"[ERROR] %s\\n\", err.Error())\n\t\t}\n\t}\n\tlog.Println(\"Requests completed.\")\n\n\t// Make sure all response bodies are closed- memory leaks otherwise\n\tdefer func() {\n\t\tfor respInfo := range responses {\n\t\t\trespInfo.Response.Body.Close()\n\t\t}\n\t}()\n\n\t// Compare the responses for uniqueness\n\tuniqueResponses, errors := compareResponses(responses)\n\tif len(errors) != 0 {\n\t\tfor err := range errors {\n\t\t\toutError(\"[ERROR] %s\\n\", err.Error())\n\t\t}\n\t}\n\n\t// Make sure all response bodies are closed- memory leaks otherwise\n\tdefer func() {\n\t\tfor _, uRespInfo := range uniqueResponses {\n\t\t\tuRespInfo.Response.Body.Close()\n\t\t}\n\t}()\n\n\t// Output the responses\n\toutputResponses(uniqueResponses)\n}", "func main() {\n\n\t// Primary processing waitgroup\n\tvar wg sync.WaitGroup\n\n\t// Initialize Timers\n\tvar makesRequestTimer operationtimer.Timer\n\tvar modelRequestTimer operationtimer.Timer\n\n\t// Retrieve vehicle make list from car-common-makes.json\n\toperationtimer.StartTimer(&makesRequestTimer)\n\tfile, _ := ioutil.ReadFile(\"car-common-makes.json\")\n\tvar fileContent vehicledbhelperutils.CommonMakesFile\n\t_ = json.Unmarshal([]byte(file), &fileContent)\n\tmakes := fileContent.Makes\n\ttotalMakes := len(fileContent.Makes)\n\toperationtimer.ReportTime(&makesRequestTimer, \"Retrieving All Vehicle Models: \")\n\n\t// Divide and collect data\n\toperationtimer.StartTimer(&modelRequestTimer)\n\tDivideConquerRequests(totalMakes, makes, &wg)\n\toperationtimer.ReportTime(&modelRequestTimer, \"Retrieving All Vehicle Models: \")\n}", "func main() {\n handleRequests()\n}", "func TestMakeRequest(t *testing.T) {\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t}))\n\tdefer ts.Close()\n\n\t// Get Rundeck request\n\tresp, err := MakeRundeckRequest(http.MethodGet, ts.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"MakeRundeckRequest with Get method ran with err %v, want response\", err)\n\t\treturn\n\t}\n\tif resp.StatusCode != 200 {\n\t\tt.Error(\"Expected response status code to be 200\")\n\t}\n\n\t// Get Zabbix request\n\tresp, err = MakeZabbixRequest(http.MethodGet, ts.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"MakeZabbixRequest with Get method ran with err %v, want response\", err)\n\t\treturn\n\t}\n\tif resp.StatusCode != 200 {\n\t\tt.Error(\"Expected response status code to be 200\")\n\t}\n\n\t// Post Rundeck request\n\tresp, err = MakeRundeckRequest(http.MethodPost, ts.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"MakeRundeckRequest with Post method ran with err %v, want response\", err)\n\t\treturn\n\t}\n\tif resp.StatusCode != 200 {\n\t\tt.Error(\"Expected response status code to be 200\")\n\t}\n\n\t// Post Zabbix request\n\tresp, err = MakeZabbixRequest(http.MethodPost, ts.URL, nil)\n\tif err != nil {\n\t\tt.Fatalf(\"MakeZabbixRequest Post method ran with err %v, want response\", err)\n\t\treturn\n\t}\n\tif resp.StatusCode != 200 {\n\t\tt.Error(\"Expected response status code to be 200\")\n\t}\n\n}", "func (app *Application) CreateRequest() error {\n\tfmt.Println(\"Parsing arguments...\")\n\n\tinputFlagMap := map[string]bool{\n\t\t\"-i\": true,\n\t\t\"--input\": true,\n\t}\n\toutputFlagMap := map[string]bool{\n\t\t\"-o\": true,\n\t\t\"--output\": true,\n\t}\n\tjsonFlagMap := map[string]bool{\n\t\t\"-j\": true,\n\t\t\"--json\": true,\n\t}\n\tprintFlagMap := map[string]bool{\n\t\t\"-p\": true,\n\t\t\"--print\": true,\n\t}\n\tcontentTypeOptMap := map[string]bool{\n\t\t\"-c\": true,\n\t\t\"--content-type\": true,\n\t}\n\tacceptOptMap := map[string]bool{\n\t\t\"-a\": true,\n\t\t\"--accept\": true,\n\t}\n\ttimeoutOptMap := map[string]bool{\n\t\t\"-t\": true,\n\t\t\"--timeout\": true,\n\t}\n\tdataOptMap := map[string]bool{\n\t\t\"-d\": true,\n\t\t\"--data\": true,\n\t}\n\n\trequestMethod := app.RequestMethods[0]\n\trequestMethodProvided := false\n\tfor i, j := 0, len(app.RequestMethods); i < j; i++ {\n\t\tif app.RequestMethods[i] == strings.ToUpper(app.Args[0]) {\n\t\t\trequestMethod = strings.ToUpper(app.Args[0])\n\t\t\trequestMethodProvided = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\turlIndex := 0\n\tif requestMethodProvided {\n\t\turlIndex = 1\n\t}\n\tif len(app.Args) < urlIndex+1 {\n\t\treturn errors.New(\"Invalid arguments. Try 'gohttp help' for usage details.\")\n\t}\n\trequestUrl, err := url.Parse(app.Args[urlIndex])\n\tif err != nil {\n\t\treturn errors.New(\"Error parsing URL: \" + err.Error())\n\t}\n\t// URL encode the query string\n\tquery := requestUrl.Query()\n\trequestUrl.RawQuery = query.Encode()\n\n\tinputFilePath := app.getOption(inputFlagMap, \"\")\n\toutputFilePath := app.getOption(outputFlagMap, \"\")\n\tjsonContentType := app.flagIsActive(jsonFlagMap)\n\tprintFlag := app.flagIsActive(printFlagMap)\n\tcontentType := app.getOption(contentTypeOptMap, \"\")\n\tacceptOpt := app.getOption(acceptOptMap, \"\")\n\tdataOpt := app.getOption(dataOptMap, \"\")\n\ttimeoutOpt := app.getOption(timeoutOptMap, \"0\")\n\ttimeout, err := strconv.Atoi(timeoutOpt)\n\tif err != nil || timeout < 1 {\n\t\ttimeout = 60\n\t}\n\n\tcontentLength := 0\n\trequestData := make([]byte, 0)\n\tif requestMethod == \"POST\" || requestMethod == \"PATCH\" || requestMethod == \"PUT\" {\n\t\tif dataOpt != \"\" {\n\t\t\tcontentLength = len(dataOpt)\n\t\t\trequestData = make([]byte, contentLength)\n\t\t\treader := strings.NewReader(dataOpt)\n\t\t\tnumBytesRead, err := reader.Read(requestData)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"Error reading input data: \" + err.Error())\n\t\t\t}\n\n\t\t\tif numBytesRead < contentLength {\n\t\t\t\treturn errors.New(\"Error reading input data: Read \" +\n\t\t\t\t\tstrconv.Itoa(numBytesRead) + \" out of \" + strconv.Itoa(contentLength) + \"bytes.\")\n\t\t\t}\n\n\t\t} else if inputFilePath != \"\" {\n\t\t\tif fileInfo, err := os.Stat(inputFilePath); os.IsNotExist(err) {\n\t\t\t\tinputFilePath = \"\"\n\t\t\t} else {\n\t\t\t\tcontentLength = int(fileInfo.Size())\n\n\t\t\t\tbody, err := os.Open(inputFilePath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.New(\"Error opening file \" + inputFilePath + \"\\n\" + err.Error())\n\t\t\t\t}\n\t\t\t\tdefer body.Close()\n\n\t\t\t\trequestData = make([]byte, contentLength)\n\t\t\t\tnumBytesRead, err := body.Read(requestData)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.New(\"Error reading input file: \" + err.Error())\n\t\t\t\t}\n\n\t\t\t\tif numBytesRead < contentLength {\n\t\t\t\t\treturn errors.New(\"Error reading input file: Read \" +\n\t\t\t\t\t\tstrconv.Itoa(numBytesRead) + \" out of \" + strconv.Itoa(contentLength) + \"bytes.\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if dataOpt != \"\" {\n\t\treturn errors.New(\"Data flag is only valid for POST, PATCH, and PUT requests.\")\n\t}\n\n\trequestContentType := \"\"\n\tif jsonContentType {\n\t\trequestContentType = \"application/json\"\n\t} else if contentType != \"\" {\n\t\trequestContentType = contentType\n\t} else if requestMethod == \"POST\" || requestMethod == \"PATCH\" || requestMethod == \"PUT\" {\n\t\trequestContentType = \"application/json\"\n\t} else {\n\t\trequestContentType = \"application/x-www-form-urlencoded\"\n\t}\n\n\taccept := \"*/*\"\n\tif acceptOpt != \"\" {\n\t\taccept = acceptOpt\n\t}\n\n\tapp.InputFilePath = inputFilePath\n\tapp.OutputFilePath = outputFilePath\n\n\tapp.Request = Request{\n\t\tMethod: requestMethod,\n\t\tURL: requestUrl,\n\t\tTimeout: timeout,\n\t\tContentType: requestContentType,\n\t\tAccept: accept,\n\t\tContentLength: contentLength,\n\t\tPrintResponse: printFlag,\n\t\tBody: requestData,\n\t}\n\n\treturn nil\n}", "func Main(params map[string]interface{}) map[string]interface{} {\n\n\taction := params[\"action\"].(string)\n\ttwilioNumber := params[\"twilioNumber\"].(string)\n\trecipientNumber := params[\"recipientNumber\"].(string)\n\n\t// only invoke Twilio message service if the GitHub PR action = assigned\n\tif action == \"assigned\" {\n\n\t\tfmt.Println(\"pull request assigned\")\n\n\t\t// set account info\n\t\taccountSid := params[\"accountSid\"].(string)\n\t\tauthToken := params[\"authToken\"].(string)\n\t\turlStr := \"https://api.twilio.com/2010-04-01/Accounts/\" + accountSid + \"/Messages.json\"\n\n\t\t// text message being sent to recipient\n\t\ttextMsg := \"New pull request assignee\"\n\n\t\t// package the data values\n\t\tmsgData := url.Values{}\n\t\tmsgData.Set(\"To\", recipientNumber)\n\t\tmsgData.Set(\"From\", twilioNumber)\n\t\tmsgData.Set(\"Body\", textMsg)\n\t\tmsgDataReader := *strings.NewReader(msgData.Encode())\n\n\t\tmsg := request(authToken, accountSid, urlStr, msgDataReader)\n\n\t\treturn msg\n\t}\n\n\tfmt.Println(\"Pull request action = \", action)\n\tmsg := make(map[string]interface{})\n\tmsg[\"action\"] = action\n\n\t// return the output JSON\n\treturn msg\n}", "func main() {\n\n\thandleRequests()\n}", "func main() {\n\tHandleRequests( )\n}", "func orgRequest() {\n\tif len(os.Args[1:]) == 1 {\n\t\t// Display help\n\t\tfmt.Println(_SUPPLIER_HELP_CONTENT)\n\t\treturn\n\t}\n\t//fmt.Println (\"num\", len(os.Args[1:]))\n\tswitch os.Args[2] {\n\tcase \"--list\", \"-l\":\n\t\tdisplaySupplierList2()\n\tcase \"--help\", \"-help\", \"help\", \"-h\":\n\t\t// Display help\n\t\tfmt.Println(_SUPPLIER_HELP_CONTENT)\n\tcase \"--get\":\n\t\tif len(os.Args[3:]) == 0 {\n\t\t\t// no other arguments (e.g., no uuid). Assume local config supplier uuid\n\t\t\tdisplaySupplier(getLocalConfigValue(\"supplier_uuid\"))\n\t\t} else {\n\t\t\t// next argument should be uuid.\n\t\t\t// TODO - check if uuid syntax is correct.\n\t\t\tdisplaySupplier(os.Args[3])\n\t\t}\n\tcase \"--create\", \"-c\":\n\t\t// for each additional arg\n\t\tname, alias, url := \" \", \" \", \" \"\n\t\tfor i := 1; i <= len(os.Args[3:]); i++ {\n\t\t\t//fmt.Println(os.Args[2+i])\n\t\t\targ := strings.Split(os.Args[2+i], \"=\")\n\t\t\tif len(arg) != 2 {\n\t\t\t\tfmt.Println(\" Error with arguments. Expecting: name=value\")\n\t\t\t\tfmt.Println(\" e.g., name=[...] short_id=[...] url=[...]\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tswitch arg[0] {\n\t\t\tcase \"name\":\n\t\t\t\tname = arg[1]\n\t\t\tcase \"alias\":\n\t\t\t\talias = arg[1]\n\t\t\tcase \"url\":\n\t\t\t\turl = arg[1]\n\t\t\tdefault:\n\t\t\t\tfmt.Printf(\" error - '%s'is not a valid argument for %s\\n\", os.Args[2+i], os.Args[2])\n\t\t\t\tfmt.Printf(\" Expecting name=[...] short_id=[...] and url=[...]\\n\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif name == \" \" {\n\t\t\tfmt.Printf(\" error - expecting at least argument name=[supplier name] \\n\")\n\t\t} else {\n\t\t\t// send request to ledger to create new supplier\n\t\t\tuuid, err := createSupplier(name, alias, \"\", \"abc123\", url)\n\t\t\tif err != nil {\n\t\t\t\tif strings.Contains(strings.ToLower(err.Error()), strings.ToLower(\"A connection attempt failed\")) {\n\t\t\t\t\t// expecting something like error msg:\n\t\t\t\t\t// Post http://35.166.246.146:818/ledger/api/v1/suppliers: dial tcp 35.166.246.146:818:\n\t\t\t\t\t// connectex: A connection attempt failed because the connected party did not properly respond after\n\t\t\t\t\t// a period of time, or established connection failed because connected host has failed to respond.\n\t\t\t\t\t//displayErrorMsg(err.Error())\n\t\t\t\t\tdisplayErrorMsg(fmt.Sprintf(\"ledger node not responding. Might try '%s synch' to locate active ledger node.\", filepath.Base(os.Args[0])))\n\t\t\t\t}\n\n\t\t\t\t////fmt.Printf(\" Not able to create new supplier: '%s'\\n\", name)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\" new supplier '%s' has uuid = %s\\n\", name, uuid)\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tfmt.Printf(\"%s: not a valid argument for %s\\n\", os.Args[2], os.Args[1])\n\t\tfmt.Println(_SUPPLIER_HELP_CONTENT)\n\t}\n}", "func (r *http) makeRequests() error {\n\tsrcPods := []string{\"a\", \"b\", \"t\"}\n\tdstPods := []string{\"a\", \"b\"}\n\tif r.Auth == proxyconfig.MeshConfig_NONE {\n\t\t// t is not behind proxy, so it cannot talk in Istio auth.\n\t\tdstPods = append(dstPods, \"t\")\n\t\t// mTLS is not supported for headless services\n\t\tdstPods = append(dstPods, \"headless\")\n\t}\n\tfuncs := make(map[string]func() status)\n\tfor _, src := range srcPods {\n\t\tfor _, dst := range dstPods {\n\t\t\tif src == \"t\" && dst == \"t\" {\n\t\t\t\t// this is flaky in minikube\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, port := range []string{\"\", \":80\", \":8080\"} {\n\t\t\t\tfor _, domain := range []string{\"\", \".\" + r.Namespace} {\n\t\t\t\t\tname := fmt.Sprintf(\"HTTP request from %s to %s%s%s\", src, dst, domain, port)\n\t\t\t\t\tfuncs[name] = (func(src, dst, port, domain string) func() status {\n\t\t\t\t\t\turl := fmt.Sprintf(\"http://%s%s%s/%s\", dst, domain, port, src)\n\t\t\t\t\t\treturn func() status {\n\t\t\t\t\t\t\tresp := r.clientRequest(src, url, 1, \"\")\n\t\t\t\t\t\t\tif r.Auth == proxyconfig.MeshConfig_MUTUAL_TLS && src == \"t\" {\n\t\t\t\t\t\t\t\tif len(resp.id) == 0 {\n\t\t\t\t\t\t\t\t\t// Expected no match for t->a\n\t\t\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn errAgain\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif len(resp.id) > 0 {\n\t\t\t\t\t\t\t\tid := resp.id[0]\n\t\t\t\t\t\t\t\tif src != \"t\" {\n\t\t\t\t\t\t\t\t\tr.logs.add(src, id, name)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif dst != \"t\" {\n\t\t\t\t\t\t\t\t\tif dst == \"headless\" { // headless points to b\n\t\t\t\t\t\t\t\t\t\tif src != \"b\" {\n\t\t\t\t\t\t\t\t\t\t\tr.logs.add(\"b\", id, name)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tr.logs.add(dst, id, name)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// mixer filter is invoked on the server side, that is when dst is not \"t\"\n\t\t\t\t\t\t\t\tif r.Mixer && dst != \"t\" {\n\t\t\t\t\t\t\t\t\tr.logs.add(\"mixer\", id, name)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif src == \"t\" && dst == \"t\" {\n\t\t\t\t\t\t\t\t// Expected no match for t->t\n\t\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn errAgain\n\t\t\t\t\t\t}\n\t\t\t\t\t})(src, dst, port, domain)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn parallel(funcs)\n}", "func main() {\n\n\t// Create a new request using http\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\n\tif err != nil {\n\t\tKO(\"Failed to initiate GET Request: \" + err.Error())\n\t}\n\tif token != \"\" {\n\t\t// Create a Bearer string by appending string access token\n\t\tvar bearer = \"Bearer \" + token\n\t\t// Add authorization header to the req\n\t\treq.Header.Add(\"Authorization\", bearer)\n\t}\n\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\n\t// Send req using http Client\n\tclient := &http.Client{Transport: tr}\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\tKO(\"Failed to execute GET Request: \" + err.Error())\n\t}\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\tvar bodyAsError APIError\n\tjson.Unmarshal(body, &bodyAsError)\n\tif err != nil {\n\t\tKO(string(body))\n\t}\n\n\tfmt.Println(string(body))\n}", "func Apis(w http.ResponseWriter, r *http.Request) *appError {\n decoder := json.NewDecoder(r.Body)\n var apisQuery ApisQuery\n err := decoder.Decode(&apisQuery)\n if err != nil {\n return &appError{err: err, status: http.StatusBadRequest, json: \"Can't decode JSON data\"}\n }\n headers := make(map[string][]string)\n if len(apisQuery.Headers) > 0 {\n headers = apisQuery.Headers\n }\n if apisQuery.Range != \"\" {\n headers[\"Range\"] = []string{apisQuery.Range}\n }\n var response Response\n if apisQuery.Api == \"s3\" {\n s3, err := getS3(r)\n if err != nil {\n return &appError{err: err, status: http.StatusInternalServerError, json: http.StatusText(http.StatusInternalServerError)}\n }\n response, err = s3Request(s3, apisQuery.Bucket, apisQuery.Method, apisQuery.Path, headers, apisQuery.Data)\n if err != nil {\n return &appError{err: err, status: http.StatusInternalServerError, json: http.StatusText(http.StatusInternalServerError)}\n }\n } else if apisQuery.Api == \"swift\" {\n response, err = swiftRequest(apisQuery.Endpoint, apisQuery.User, apisQuery.Password, apisQuery.Container, apisQuery.Method, apisQuery.Path, headers, apisQuery.Data)\n if err != nil {\n return &appError{err: err, status: http.StatusInternalServerError, json: http.StatusText(http.StatusInternalServerError)}\n }\n } else if apisQuery.Api == \"atmos\" {\n s3, err := getS3(r)\n if err != nil {\n return &appError{err: err, status: http.StatusInternalServerError, json: http.StatusText(http.StatusInternalServerError)}\n }\n response, err = atmosRequest(apisQuery.Endpoint, s3.AccessKey, s3.SecretKey, apisQuery.Subtenant, apisQuery.Method, apisQuery.Path, headers, apisQuery.Data)\n if err != nil {\n return &appError{err: err, status: http.StatusInternalServerError, json: http.StatusText(http.StatusInternalServerError)}\n }\n } else if apisQuery.Api == \"ecs\" {\n response, err = ecsRequest(apisQuery.Endpoint, apisQuery.User, apisQuery.Password, apisQuery.Method, apisQuery.Path, headers, apisQuery.Data)\n if err != nil {\n return &appError{err: err, status: http.StatusInternalServerError, json: http.StatusText(http.StatusInternalServerError)}\n }\n }\n var httpResponse HttpResponse\n httpResponse.Method = apisQuery.Method\n httpResponse.Path = apisQuery.Path\n httpResponse.Code = response.Code\n httpResponse.RequestHeaders = response.RequestHeaders\n httpResponse.ResponseHeaders = response.ResponseHeaders\n httpResponse.Body = response.Body\n rendering.JSON(w, http.StatusOK, httpResponse)\n\n return nil\n}", "func PopulateRequest(msg spoe.Message) (request *apis.Request, err error) {\n\tvar countRequired int\n\trequest = &apis.Request{}\n\n\tfor msg.Args.Next() {\n\t\targ := msg.Args.Arg\n\t\tif value, ok := arg.Value.(string); ok {\n\t\t\tswitch arg.Name {\n\t\t\tcase \"method\":\n\t\t\t\trequest.Method = value\n\t\t\t\tcountRequired++\n\t\t\t\tcontinue\n\t\t\tcase \"path\":\n\t\t\t\trequest.Path = value\n\t\t\t\tcountRequired++\n\t\t\t\tcontinue\n\t\t\tcase \"query\":\n\t\t\t\trequest.Query = value\n\t\t\t\tcontinue\n\t\t\tcase \"reqver\":\n\t\t\t\trequest.Version = value\n\t\t\t\tcountRequired++\n\t\t\t\tcontinue\n\t\t\tcase \"ignorerules\":\n\t\t\t\trequest.IgnoreRules = value\n\t\t\t\tcontinue\n\t\t\tcase \"namespace\":\n\t\t\t\trequest.Namespace = value\n\t\t\t\tcontinue\n\t\t\tcase \"ingressname\":\n\t\t\t\trequest.IngressName = value\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif value, ok := arg.Value.(net.IP); ok {\n\t\t\tswitch arg.Name {\n\t\t\tcase \"srvip\":\n\t\t\t\trequest.ServerIP = value.String()\n\t\t\t\tcountRequired++\n\t\t\t\tcontinue\n\t\t\tcase \"clientip\":\n\t\t\t\trequest.ClientIP = value.String()\n\t\t\t\tcountRequired++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif value, ok := arg.Value.(int); ok && arg.Name == \"srvport\" {\n\t\t\tcountRequired++\n\t\t\trequest.ServerPort = value\n\t\t}\n\n\t\tif value, ok := arg.Value.([]byte); ok {\n\t\t\tswitch arg.Name {\n\t\t\tcase \"reqhdrs\":\n\t\t\t\tif request.Headers, err = spoe.DecodeHeaders(value); err != nil {\n\t\t\t\t\treturn &apis.Request{}, fmt.Errorf(\"Failure decoding the headers\")\n\t\t\t\t}\n\t\t\t\tcountRequired++\n\t\t\t\tcontinue\n\t\t\tcase \"reqbody\":\n\t\t\t\trequest.Body = value\n\t\t\t\tcountRequired++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\tif countRequired != expectedSPOEArguments {\n\t\treturn nil, fmt.Errorf(\"spoe error: number of expected arguments (%d) is different from the passed arguments: %d\", expectedSPOEArguments, countRequired)\n\t}\n\treturn request, nil\n}", "func main() {\n\tuseSlingGet()\n\tuseSlingPost()\n\tuseSlingGetWithHeader()\n\tuseSlingGetWithQuery()\n\n}", "func runRequests(requests []Request, env Environment, testname string, verbose bool, monitor bool) (int, int) {\n\tfailCount := 0\n\tcurrentRequest := 0\n\n\t// iterate through requests and keep track of test fails\n\tfor _, r := range requests {\n\t\t// if a test name was provided, skip this test request if it does not match.\n\t\tif testname != \"\" && testname != r.Name {\n\t\t\tcontinue\n\t\t}\n\t\tmethod := strings.ToUpper(r.Method)\n\n\t\tcurrentRequest++\n\n\t\t// make the request.\n\t\t// the hostname/path is parsed immediately so it's available for both\n\t\t// error handling and the \"happy path\"\n\t\trawURL, duration, err := request(r, currentRequest, env, verbose)\n\t\thostname, path := processURL(rawURL)\n\t\tif err != nil {\n\t\t\t// actions to take for unsuccessful requests\n\t\t\tlog.Println(\" \", err)\n\t\t\tfailCount++\n\t\t\tif monitor {\n\t\t\t\trecordError(r.Name, hostname, path, method)\n\t\t\t}\n\t\t}\n\n\t\tdurationSeconds := duration.Seconds()\n\t\trecordRequest(r.Name, hostname, path, method)\n\t\trecordDuration(r.Name, hostname, path, method, durationSeconds)\n\n\t}\n\treturn currentRequest, failCount\n}", "func checkRequest(httpClient *dphttp.ClienterMock, callIndex int, expectedMethod, expectedURI string) {\n\tSo(httpClient.DoCalls()[callIndex].Req.URL.String(), ShouldEqual, expectedURI)\n\tSo(httpClient.DoCalls()[callIndex].Req.Method, ShouldEqual, expectedMethod)\n\tSo(httpClient.DoCalls()[callIndex].Req.Header.Get(dprequest.AuthHeaderKey), ShouldEqual, \"Bearer \"+testServiceToken)\n}", "func initRequest() {\n\tvar spartsDirectory string\n\tvar localConfigFile string\n\t//see if sub directory specified\n\tif len(os.Args[2:]) > 1 {\n\t\t// Too many arguments specified\n\t\tfmt.Println(_INIT_HELP_CONTENT)\n\t\treturn\n\t} else if len(os.Args[2:]) == 1 {\n\t\t// Additional argument specificied -> sub-diretory\n\t\tspartsDirectory = getDirectory() + \"/\" + os.Args[2] + \"/\" + _SPARTS_DIRECTORY\n\t\t// spartsConfigFile = getDirectory() + \"/\" + os.Args[2] + \"/.sparts/config\"\n\t\t//spartsConfigFile = getDirectory() + \"/\" + os.Args[2] + LOCAL_CONFIG_FILE\n\t} else {\n\t\t// local directory (which is most common)\n\t\tspartsDirectory = getDirectory() + \"/\" + _SPARTS_DIRECTORY\n\t}\n\n\tlocalConfigFile = spartsDirectory + \"/\" + _LOCAL_CONFIG_FILE\n\t//fmt.Println (\"spartsDirectory\", spartsDirectory)\n\t//fmt.Println (\"spartsConfigFile\", spartsConfigFile)\n\n\tif isSpartsDirectory(spartsDirectory) {\n\t\t// .sparts directory alreadt exists\n\t\t// Re-intialize - not sure what that entails yet - just print simple message for now\n\t\tfmt.Printf(\"Reinitialized existing %s working directory:\\n\", _TOOL_NAME)\n\t\tfmt.Println(\" \", spartsDirectory)\n\t} else {\n\t\t// Create new directory\n\t\tfmt.Printf(\"Initialized empty %s working directory in:\\n\", _TOOL_NAME)\n\t\tfmt.Println(\" \", spartsDirectory)\n\t\tcreateDirectory(spartsDirectory)\n\t\tf, err := os.Create(localConfigFile)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t\tdefer f.Close()\n\t\t_, err = f.WriteString(_LOCAL_CONFIG_FILE_CONTENT)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// The following will create the global config file if it does not exist.\n\tglobalConfigFile, err := getGlobalConfigFile()\n\tif err != nil && globalConfigFile != \"\" {\n\t\tfmt.Println(\"Created global config file:\", globalConfigFile)\n\t}\n\t//fmt.Println( usr.HomeDir )\n\n\t// Initialize the database\n\tinitializeDB()\n\tif _SEED_FUNCTION_ON {\n\t\tseedRequest()\n\t}\n}", "func main() {\n\tr := gin.Default()\n\tr.Use(cors.Default())\n\tr.Use(parseRequestMiddleware())\n\n\tapi := r.Group(\"/v1\")\n\n\t// all results\n\tapi.POST(\"/all_results\", func(c *gin.Context) {\n\t\texecuteRequest(c, allResults)\n\t})\n\n\t// price group\n\tprice := api.Group(\"/price\")\n\t{\n\t\tprice.POST(\"/by_profit_rate\", func(c *gin.Context) {\n\t\t\texecuteRequest(c, getSellPriceByProfitRate)\n\t\t})\n\t}\n\n\t// fees group\n\tfees := api.Group(\"/fees\")\n\t{\n\t\tfees.POST(\"/total\", func(c *gin.Context) {\n\t\t\texecuteRequest(c, getFeesTotal)\n\t\t})\n\t\tfees.POST(\"/sales_tax\", func(c *gin.Context) {\n\t\t\texecuteRequest(c, getSalesTaxFeesTotal)\n\t\t})\n\t\tfees.POST(\"/payment\", func(c *gin.Context) {\n\t\t\texecuteRequest(c, getPaymentFeesTotal)\n\t\t})\n\t\tfees.POST(\"/channel\", func(c *gin.Context) {\n\t\t\texecuteRequest(c, getChannelFeesTotal)\n\t\t})\n\t\tfees.POST(\"/other\", func(c *gin.Context) {\n\t\t\texecuteRequest(c, getOtherFeesTotal)\n\t\t})\n\t}\n\n\t// profit group\n\tprofit := api.Group(\"/profit\")\n\t{\n\t\tprofit.POST(\"/total\", func(c *gin.Context) {\n\t\t\texecuteRequest(c, getProfitTotal)\n\t\t})\n\t\tprofit.POST(\"/is_valid\", func(c *gin.Context) {\n\t\t\texecuteRequest(c, isValidProfitRate)\n\t\t})\n\t}\n\n\tr.Run(\":9096\")\n}", "func RunTest(c test.Case, context Context) (*Result, error) {\n \n // wait if we need to\n if c.Wait > 0 {\n <- time.After(c.Wait)\n }\n \n // start with an unevaluated result\n result := &Result{Name:fmt.Sprintf(\"%v %v\\n\", c.Request.Method, c.Request.URL), Success:true}\n \n method, err := interpolateIfRequired(context, c.Request.Method)\n if err != nil {\n return result.Error(err), nil\n }else if method == \"\" {\n return nil, fmt.Errorf(\"Request requires a method (set 'method')\")\n }\n \n // incrementally update the name as we evaluate it\n result.Name = fmt.Sprintf(\"%v %v\\n\", method, c.Request.URL)\n \n var url string\n if isAbsoluteURL(c.Request.URL) {\n url = c.Request.URL\n }else{\n url = joinPath(context.BaseURL, c.Request.URL)\n }\n \n // incrementally update the name as we evaluate it\n result.Name = fmt.Sprintf(\"%v %v\\n\", method, url)\n \n url, err = interpolateIfRequired(context, url)\n if err != nil {\n return result.Error(err), nil\n }else if url == \"\" {\n return nil, fmt.Errorf(\"Request requires a URL (set 'url')\")\n }\n \n // incrementally update the name as we evaluate it\n result.Name = fmt.Sprintf(\"%v %v\\n\", method, url)\n \n var reqdata string\n var entity io.Reader\n if c.Request.Entity != \"\" {\n reqdata, err = interpolateIfRequired(context, c.Request.Entity)\n if err != nil {\n return result.Error(err), nil\n }else{\n entity = bytes.NewBuffer([]byte(reqdata))\n }\n }\n \n req, err := http.NewRequest(method, url, entity)\n if err != nil {\n return nil, err\n }\n \n if context.Headers != nil {\n for k, v := range context.Headers {\n k, err = interpolateIfRequired(context, k)\n if err != nil {\n return result.Error(err), nil\n }\n v, err = interpolateIfRequired(context, v)\n if err != nil {\n return result.Error(err), nil\n }\n req.Header.Add(k, v)\n }\n }\n \n if c.Request.Headers != nil {\n for k, v := range c.Request.Headers {\n k, err = interpolateIfRequired(context, k)\n if err != nil {\n return result.Error(err), nil\n }\n v, err = interpolateIfRequired(context, v)\n if err != nil {\n return result.Error(err), nil\n }\n req.Header.Add(k, v)\n }\n }\n \n if reqdata != \"\" {\n req.Header.Add(\"Content-Length\", strconv.FormatInt(int64(len(reqdata)), 10))\n }\n \n if (context.Options & (test.OptionDisplayRequests | test.OptionDisplayResponses)) != 0 {\n fmt.Println()\n }\n if (context.Options & test.OptionDisplayRequests) == test.OptionDisplayRequests {\n b := &bytes.Buffer{}\n err = text.WriteRequest(b, req, reqdata)\n if err != nil {\n return result.Error(err), nil\n }\n fmt.Println(text.Indent(string(b.Bytes()), \"> \"))\n }\n \n rsp, err := client.Do(req)\n if rsp != nil && rsp.Body != nil {\n defer rsp.Body.Close()\n }\n if err != nil {\n return result.Error(err), nil\n }\n \n // check the response status\n result.AssertEqual(c.Response.Status, rsp.StatusCode, \"Unexpected status code\")\n \n // note the content type; we prefer the explicit format over the content type\n var contentType string\n if c.Response.Format != \"\" {\n contentType = c.Response.Format\n }else{\n contentType = strings.ToLower(rsp.Header.Get(\"Content-Type\"))\n }\n \n contentType, err = interpolateIfRequired(context, contentType)\n if err != nil {\n return result.Error(err), nil\n }\n \n // check response headers, if necessary\n if headers := c.Response.Headers; headers != nil {\n for k, v := range headers {\n k, err = interpolateIfRequired(context, k)\n if err != nil {\n return result.Error(err), nil\n }\n v, err = interpolateIfRequired(context, v)\n if err != nil {\n return result.Error(err), nil\n }\n result.AssertEqual(v, rsp.Header.Get(k), \"Headers do not match: %v\", k)\n }\n }\n \n // handle the response entity\n var rspdata []byte\n if rsp.Body != nil {\n rspdata, err = ioutil.ReadAll(rsp.Body)\n if err != nil {\n result.Error(err)\n }\n }\n \n // parse response entity if necessry\n var rspvalue interface{} = rspdata\n if c.Response.Comparison == test.CompareSemantic {\n rspvalue, err = unmarshalEntity(context, contentType, rspdata)\n if err != nil {\n return result.Error(err), nil\n }\n }else if c.Id != \"\" { // attempt it but don't produce an error if we fail\n val, err := unmarshalEntity(context, contentType, rspdata)\n if err == nil {\n rspvalue = val\n }\n }\n \n // check response entity, if necessary\n if entity := c.Response.Entity; entity != \"\" {\n entity, err = interpolateIfRequired(context, entity)\n if err != nil {\n return result.Error(err), nil\n }\n if len(rspdata) == 0 {\n result.AssertEqual(entity, \"\", \"Entities do not match\")\n }else if err = entitiesEqual(context, c.Response.Comparison, contentType, []byte(entity), rspvalue); err != nil {\n result.Error(err)\n }\n }\n \n if (context.Options & test.OptionDisplayResponses) == test.OptionDisplayResponses {\n b := &bytes.Buffer{}\n err = text.WriteResponse(b, rsp, rspdata)\n if err != nil {\n return result.Error(err), nil\n }\n fmt.Println(text.Indent(string(b.Bytes()), \"< \"))\n }\n \n // add to our context if we have an identifier\n if c.Id != \"\" {\n \n headers := make(map[string]string)\n for k, v := range rsp.Header {\n if len(v) > 0 {\n headers[k] = v[0]\n }\n }\n \n context.Variables[c.Id] = map[string]interface{}{\n \"case\": c,\n \"response\": map[string]interface{}{\n \"headers\": headers,\n \"entity\": rspdata,\n \"value\": rspvalue,\n \"status\": rsp.StatusCode,\n },\n }\n \n }\n \n // generate documentation if necessary\n if c.Documented() && len(context.Gendoc) > 0 {\n for _, e := range context.Gendoc {\n err := e.Generate(c, req, reqdata, rsp, rspdata)\n if err != nil {\n return nil, fmt.Errorf(\"Could not generate documentation: %v\", err)\n }\n }\n }\n \n return result, nil\n}", "func main() {\n\n\tparam := new(requestInfo)\n\tparam.Command = \"GetWeather\" //set default command\n\tvar connectAddr string\n\tmyscanner := bufio.NewScanner(os.Stdin)\n\tfmt.Println(\"Enter IP address for connection to or press ENTER to connect to server in Localhost\")\n\tmyscanner.Scan()\n\tconnectAddr = myscanner.Text()\n\tconnectAddr += \":7777\"\n\tfmt.Println(\"Trying to connect to\", connectAddr)\n\tconn, err := net.Dial(\"tcp\", connectAddr)\n\tif err != nil {\n\t\tfmt.Println(\"error connection: \", err)\n\t\treturn\n\t} else {\n\t\tfmt.Println(\"Connected success to\", connectAddr)\n\t}\n\tdefer func() {\n\t\tconn.Close()\n\t\tfmt.Println(\"Disconnecting\")\n\t}()\n\n\tfor {\n\n\t\tcontinueRequesting := GetInfoFromServer(conn, *param)\n\t\tif !continueRequesting {\n\t\t\treturn\n\t\t}\n\t}\n}", "func main() {\n\tflag.Parse()\n\n\t// Criando requisição.\n\t// Atenção para strings.NewReader(). Interfaces é assunto para outro tutorial!\n\t// Atenção para o \"*\" antes do nome da variável.\n\treq, err := http.NewRequest(*metodo, *url, strings.NewReader(*corpo)) // Tratar erro!\n\tif *contentType != \"\" {\n\t\treq.Header.Add(\"Content-Type\", *contentType)\n\t}\n\n\t// Disparando requisição.\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(\"erro realizando requisiçãp - %+v):%q\", req, err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// Lendo corpo da resposta.\n\tcorpoResp, _ := ioutil.ReadAll(resp.Body) // Tratar erro!\n\tfmt.Printf(\"Status:%v | Corpo:%s\\n\", resp.StatusCode, string(corpoResp))\n}", "func execRequest(engine *req.Engine, method, url string, data interface{}) []error {\n\tif engine == nil {\n\t\treturn errEngineIsNil\n\t}\n\n\tif engine.UserAgent == \"\" {\n\t\tengine.SetUserAgent(\"go-ek-librato\", VERSION)\n\t}\n\n\trequest := req.Request{\n\t\tMethod: method,\n\t\tURL: url,\n\n\t\tBasicAuthUsername: Mail,\n\t\tBasicAuthPassword: Token,\n\n\t\tContentType: req.CONTENT_TYPE_JSON,\n\n\t\tClose: true,\n\t}\n\n\tif data != nil {\n\t\trequest.Body = data\n\t}\n\n\tresp, err := engine.Do(request)\n\n\tif err != nil {\n\t\treturn []error{err}\n\t}\n\n\tif resp.StatusCode > 299 || resp.StatusCode == 0 {\n\t\treturn extractErrors(resp.String())\n\t}\n\n\tresp.Discard()\n\n\treturn nil\n}", "func main() {\n\truntime.GOMAXPROCS(cpuNumber)\n\tif concurrency == 0 || totalNumber == 0 || (contractMothod == \"\" && contractType == \"\") {\n\t\tfmt.Printf(\"example: go run -ldflags=\\\"-r ./libs/linux\\\" main.go -c 1000 -n 100 -t kvTableTest -m select -cpuNumber 8 \\n\")\n\t\tfmt.Printf(\"Current request parameters: -c %d -n %d -d %v -u %s \\n\", concurrency, totalNumber, debugStr, requestURL)\n\t\tflag.Usage()\n\t\treturn\n\t}\n\trequest, err := model.NewRequestByContractType(contractType, contractMothod)\n\tif err != nil {\n\t\tfmt.Printf(\"parameter invalid %v \\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"\\n start... concurrency:%d Number of Requests:%d Requests param: \\n\", concurrency, totalNumber)\n\n\tctx := context.Background()\n\tif timeout > 0 {\n\t\tvar cancel context.CancelFunc\n\t\tctx, cancel = context.WithTimeout(ctx, time.Duration(timeout)*time.Second)\n\t\tdefer cancel()\n\t\tdeadline, ok := ctx.Deadline()\n\t\tif ok {\n\t\t\tfmt.Printf(\" deadline %s\", deadline)\n\t\t}\n\t}\n\n\t//\n\tprivateKey, _ := hex.DecodeString(\"145e247e170ba3afd6ae97e88f00dbc976c2345d511b0f6713355d19d8b80b58\")\n\tconfig := &client.Config{IsSMCrypto: false, GroupID: \"group0\", PrivateKey: privateKey,\n\t\tHost: \"127.0.0.1\", Port: 20200, TLSCaFile: \"./ca.crt\", TLSKeyFile: \"./sdk.key\", TLSCertFile: \"./sdk.crt\"}\n\tclient, err := client.DialContext(context.Background(), config)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\tfmt.Println(\"-------------------starting deploy contract-----------------------\")\n\tswitch request.Form {\n\tcase model.FormTypeKvTable:\n\t\t_, _, instance, err := kvTableTest.DeployKVTableTest(client.GetTransactOpts(), client)\n\t\tif err != nil {\n\t\t\tlogrus.Fatal(err)\n\t\t}\n\t\tkvtabletestSession := &kvTableTest.KVTableTestSession{Contract: instance, CallOpts: *client.GetCallOpts(), TransactOpts: *client.GetTransactOpts()}\n\t\tserver.Dispose(ctx, concurrency, totalNumber, request, kvtabletestSession)\n\tcase model.FormParallelOk:\n\t\taddress, tx, instance, err := parallelOk.DeployParallelOk(client.GetTransactOpts(), client)\n\t\tif err != nil {\n\t\t\tlogrus.Fatal(err)\n\t\t}\n\t\tfmt.Println(\"contract address: \", address.Hex()) // the address should be saved\n\t\tfmt.Println(\"transaction hash: \", tx.TransactionHash)\n\t\t_ = instance\n\t\tparallelOkSession := &parallelOk.ParallelOkSession{Contract: instance, CallOpts: *client.GetCallOpts(), TransactOpts: *client.GetTransactOpts()}\n\t\tserver.Dispose(ctx, concurrency, totalNumber, request, parallelOkSession)\n\t}\n\n\treturn\n}", "func testRequest() {\n\n\t/****\n\tkeys, err := getPrivatePublicKeys()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t} else {\n\t\tfmt.Println(\"success\")\n\t\tfmt.Println(\" Public Key:\", keys.PublicKey)\n\t\tfmt.Println(\" Private Key:\", keys.PrivateKey)\n\t}\n\t*****/\n\n\t// keys:\n\t// Private: bf6bb6df3afdbe2cdda1ce4e92d4fbda46a49586832c2dd09900981bfdd37f2b\n\t// Public: 030c9148861b4ee085118bc44a235d961b56dbfd4c01f0d8d6391e923fe04889e9\n\n\terr := registerUser(\"user007\", \"[email protected]\", \"member\", \"allow\", \"030c9148861b4ee085118bc44a235d961b56dbfd4c01f0d8d6391e923fe04889e9\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t} else {\n\t\tfmt.Println(\"success\")\n\t}\n\n\t/*********\n\t\tartifact, err := getArtifactFromLedger(\"d2538468-9245-446c-4b6b-90068f2d8713\")\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(len(artifact.ArtifactList))\n\t***********/\n\n\t/***********\n\t\tenvelopeUUID := os.Args[2]\n\n\t\tpartUUID := getLocalConfigValue(_PART_KEY)\n\t\tif !isValidUUID(partUUID) {\n\t\t\tdisplayErrorMsg(\"Default part UUID not properly set in local config file.\")\n\t\t\treturn\n\t\t}\n\t\talias, err := getAlias(partUUID)\n\t\tif alias == \"\" || err != nil {\n\t\t\talias = partUUID\n\t\t}\n\t\terr = createArtifactOfPartRelation(envelopeUUID, partUUID)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\terror pushing: %s%s%s\\n\", _RED_FG, alias, _COLOR_END)\n\t\t} else {\n\t\t\t// Report success.\n\t\t\tfmt.Printf(\"\tpushing: %s%s%s\\n\", _GREEN_FG, alias, _COLOR_END)\n\t\t}\n\t*******************/\n\n\t/****\n\tvar part PartRecord\n\tpart.Label = os.Args[2]\n\tfmt.Println(getRootEnvelope(part))\n\t****/\n\n\t/******\n\n\tr, _ := regexp.Compile(`^[1-9]+\\-[0-9]+$`)\n\ts, _ := regexp.Compile(`^[1-9][0-9]*$`)\n\tvar idList []int\n\tfor i := 2; i < len(os.Args); i++ {\n\t\tif r.MatchString(os.Args[i]) || s.MatchString(os.Args[i]) {\n\t\t\tif r.MatchString(os.Args[i]) {\n\t\t\t\tlist := strings.Split(os.Args[i], \"-\")\n\t\t\t\tfirst, _ := strconv.Atoi(list[0])\n\t\t\t\tlast, _ := strconv.Atoi(list[1])\n\t\t\t\tfor i := first; i <= last; i++ {\n\t\t\t\t\t////fmt.Print(i, \" \")\n\t\t\t\t\tidList = append(idList, i)\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tid, err := strconv.Atoi(os.Args[i])\n\t\t\t\tif err == nil {\n\t\t\t\t\tidList = append(idList, id)\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\tfmt.Println(\"len=\", len(idList))\n\tfor i := 0; i < len(idList); i++ {\n\t\tfmt.Print(idList[i], \" \")\n\t}\n\tfmt.Println()\n\t************/\n}", "func init() {\n\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\n\tflag.StringVar(&queryStr, \"queryStr\", \"http://0.0.0.0/testingEnd?\", \"Testing End address, including 'debug' parameter if needed\")\n\tmockRequestResponseFile := filepath.Dir(os.Args[0]) + filepath.FromSlash(\"/\") + DataDir + filepath.FromSlash(\"/\") + MockRequestResponseFile\n\tflag.StringVar(&dataFile, \"dataFile\", mockRequestResponseFile, \"Data File with Request/Response map. No validation will be carried out.\")\n\tflag.BoolVar(&checkUp, \"checkUp\", true, \"Check it out that FastCGI is up and running through a HEAD request.\")\n\tflag.BoolVar(&gzipOn, \"gzipOn\", true, \"Activate GZIP by adding specific header to the request. That might make all tests fail\")\n\tflag.Uint64Var(&goroutinesMax, \"goroutinesMax\", uint64(3*runtime.NumCPU()), \"Maximum number of goroutines in parallel in order to avoid hoarding too much resources.\")\n\tflag.Parse()\n\tif len(queryStr) < 2 || strings.Index(queryStr, \"?\") != (len(queryStr)-1) || strings.LastIndex(queryStr, \"/\") == (len(queryStr)-2) {\n\t\tfmt.Printf(\"Check it out that your -queryStr %v is the correct one expected by NGINX and ends in '?'\\n\", queryStr)\n\t\tos.Exit(1)\n\t}\n\t_, err := url.ParseRequestURI(queryStr)\n\tif err != nil {\n\t\tfmt.Printf(\"Check it out that your -queryStr %v is a correct URL\\n\", queryStr)\n\t\tos.Exit(1)\n\t}\n}", "func doRequest(requestMethod, requestUrl,\n\trequestData string) (*http.Response, error) {\n\t// These will hold the return value.\n\tvar res *http.Response\n\tvar err error\n\n\t\n\t// Convert method to uppercase for easier checking.\n\tupperRequestMethod := strings.ToUpper(requestMethod)\n\tswitch upperRequestMethod {\n\tcase \"GET\":\n\t\t// Use the HTTP library Get() method.\n\t\tres, err = http.Get(requestUrl)\n\t\t//fmt.Printf(\"!!! res=\", res)\n\t\t//fmt.Printf(\"error=\", err.Error())\n\n\tdefault:\n\t\t// We doń't know how to handle this request.\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"invalid --request_method provided : %s\",\n\t\t\t\trequestMethod)\n\t}\n\n\treturn res, err\n}", "func main() {\n\t// Parse arguments and setup variables\n\tconcurrencyFlag := flag.Int(\"concurrency\", dConcurrency, \"concurrency\")\n\tlimitFlag := flag.Int(\"limit\", dLimit, \"limit for URLs to be checked\")\n\ttimeoutFlag := flag.Int(\"timeout\", dTimeout, \"timeout for requests\")\n\n\tvar headersFlag parameters\n\tflag.Var(&headersFlag, \"headers\", \"headers to send together with requests\")\n\n\tvar queryParamsFlag parameters\n\tflag.Var(&queryParamsFlag, \"query\", \"query parameters to send together with requests\")\n\n\tflag.Parse()\n\targs := flag.Args()\n\n\t// Fail if sitemap URL is missing\n\tif len(args) == 0 {\n\t\tlog.Fatal(\"Please specify the sitemap URL and try again!\")\n\t}\n\n\tsitemapURL := args[0]\n\n\tsuccess := process(os.Stdout, *concurrencyFlag, *limitFlag, *timeoutFlag, sitemapURL, headersFlag, queryParamsFlag)\n\n\tif success {\n\t\tos.Exit(0)\n\t} else {\n\t\tos.Exit(1)\n\t}\n}", "func main() {\n\tif len(os.Args) < 3 {\n\t\tfmt.Printf(\"argument is Invalid :%v\\n\", os.Args)\n\t\treturn\n\t}\n\tswitch os.Args[1] {\n\tcase \"master\":\n\t\tstartReq, err := json.Marshal(common.Request{\n\t\t\tUrl: os.Args[2],\n\t\t\tFlag: 1,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Error(\"err:%v\", err)\n\t\t}\n\t\tdistribute.NewMaster().Run(startReq)\n\tcase \"slave\":\n\t\tdistribute.NewSlave(os.Args[2]).Run()\n\t}\n}", "func Initialise(s *State, ports string, wordlist string, statusCodesIgn string, protocols string, timeout int, AdvancedUsage bool, easy bool, HostHeaderFile string, httpHeaders string, extensions string) {\n\tif AdvancedUsage {\n\n\t\tvar Usage = func() {\n\t\t\tfmt.Printf(LineSep())\n\t\t\tfmt.Fprintf(os.Stderr, \"Advanced usage of %s:\\n\", os.Args[0])\n\t\t\tflag.PrintDefaults()\n\t\t\tfmt.Printf(LineSep())\n\t\t\tfmt.Printf(\"Examples for %s:\\n\", os.Args[0])\n\t\t\tfmt.Printf(\">> Scan and dirbust the hosts from hosts.txt.\\n\")\n\t\t\tfmt.Printf(\"%v -i hosts.txt -w wordlist.txt -t 2000 -scan -dirbust\\n\", os.Args[0])\n\t\t\tfmt.Printf(\">> Scan and dirbust the hosts from hosts.txt, and screenshot discovered web resources.\\n\")\n\t\t\tfmt.Printf(\"%v -i hosts.txt -w wordlist.txt -t 2000 -scan -dirbust -screenshot\\n\", os.Args[0])\n\t\t\tfmt.Printf(\">> Scan, dirbust, and screenshot the hosts from hosts.txt on common web application ports. Additionally, set the number of phantomjs processes to 3.\\n\")\n\t\t\tfmt.Printf(\"%v -i hosts.txt -w wordlist.txt -t 2000 -p_procs=3 -p top -scan -dirbust -screenshot\\n\", os.Args[0])\n\t\t\tfmt.Printf(\">> Screenshot the URLs from urls.txt. Additionally, use a custom phantomjs path.\\n\")\n\t\t\tfmt.Printf(\"%v -U urls.txt -t 200 -j 400 -phantomjs /my/path/to/phantomjs -screenshot\\n\", os.Args[0])\n\t\t\tfmt.Printf(\">> Screenshot the supplied URL. Additionally, use a custom phantomjs path.\\n\")\n\t\t\tfmt.Printf(\"%v -u http://example.com/test -t 200 -j 400 -phantomjs /my/path/to/phantomjs -screenshot\\n\", os.Args[0])\n\t\t\tfmt.Printf(\">> EASY MODE/I DON'T WANT TO READ STUFF LEMME HACK OK?.\\n\")\n\t\t\tfmt.Printf(\"%v -i hosts.txt -w wordlist.txt -easy\\n\", os.Args[0])\n\n\t\t\tfmt.Printf(LineSep())\n\t\t}\n\t\tUsage()\n\t\tos.Exit(0)\n\t}\n\n\tif easy { // user wants to use easymode... lol?\n\t\ts.Timeout = 20\n\t\ts.Jitter = 25\n\t\ts.Scan = true\n\t\ts.Dirbust = true\n\t\ts.Screenshot = true\n\t\ts.Threads = 1000\n\t\ts.NumPhantomProcs = 7\n\t\tports = \"top\"\n\t}\n\ts.Extensions = StringSet{map[string]bool{}}\n\tfor _, p := range strings.Split(extensions, \",\") {\n\t\ts.Extensions.Add(p)\n\t}\n\ts.Extensions.Add(\"\")\n\ts.HostHeaders = StringSet{map[string]bool{}}\n\tif HostHeaderFile != \"\" {\n\t\thostHeaders, err := GetDataFromFile(HostHeaderFile)\n\t\tif err != nil {\n\t\t\tError.Println(err)\n\t\t\tpanic(err)\n\t\t}\n\t\thostHeadersExpanded := ExpandHosts(hostHeaders)\n\t\tfor hostHeader, _ := range hostHeadersExpanded.Set {\n\t\t\ts.HostHeaders.Add(hostHeader)\n\t\t}\n\t} else {\n\t\ts.HostHeaders.Add(\"\")\n\t}\n\ts.HttpHeaders = map[string]string{}\n\tif httpHeaders != \"\" {\n\t\terr := json.Unmarshal([]byte(httpHeaders), &s.HttpHeaders)\n\t\tif err != nil {\n\t\t\tError.Printf(\"Your JSON looks pretty bad eh. You should do something about that: [%v]\", httpHeaders)\n\t\t}\n\t\t// Debug.Println(s.HttpHeaders)\n\t}\n\n\ts.Timeout = time.Duration(timeout) * time.Second\n\n\ttx = &http.Transport{\n\t\tDialContext: (d).DialContext,\n\t\tDisableCompression: true,\n\t\tMaxIdleConns: 100,\n\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: s.IgnoreSSLErrors}}\n\tcl = http.Client{\n\t\tTransport: tx,\n\t\tTimeout: s.Timeout,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\n\ts.Targets = make(chan Host)\n\ts.ScreenshotFileType = strings.ToLower(s.ScreenshotFileType)\n\n\ts.URLProvided = false\n\tif s.URLFile != \"\" || s.SingleURL != \"\" {\n\t\ts.URLProvided = true\n\t\ts.Scan = false\n\t}\n\ts.Paths = StringSet{Set: map[string]bool{}}\n\n\tif wordlist != \"\" {\n\t\tpathData, err := GetDataFromFile(wordlist)\n\t\tif err != nil {\n\t\t\tError.Println(err)\n\t\t\tpanic(err)\n\t\t}\n\t\tfor _, path := range pathData {\n\t\t\ts.Paths.Add(path)\n\t\t}\n\t} else {\n\t\ts.Paths.Add(\"\")\n\t}\n\ts.StatusCodesIgn = IntSet{map[int]bool{}}\n\tfor _, code := range StrArrToInt(strings.Split(statusCodesIgn, \",\")) {\n\t\ts.StatusCodesIgn.Add(code)\n\t}\n\n\tif s.URLProvided { // A url and/or file full of urls was supplied - treat them as gospel\n\t\t// wg := sync.WaitGroup{}\n\t\t// wg.Add(1)\n\t\tgo func() { // for reasons unknown this seems to work ok... other things dont. I don't understand computers\n\t\t\tdefer func() {\n\t\t\t\tclose(s.Targets)\n\t\t\t\t// wg.Done()\n\t\t\t}()\n\t\t\tif s.URLFile != \"\" {\n\t\t\t\tinputData, err := GetDataFromFile(s.URLFile)\n\t\t\t\tif err != nil {\n\t\t\t\t\tError.Println(err)\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\tfor _, item := range inputData {\n\t\t\t\t\t// Info.Println(item)\n\t\t\t\t\tParseURLToHost(item, s.Targets)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif s.SingleURL != \"\" {\n\t\t\t\ts.URLProvided = true\n\t\t\t\tInfo.Println(s.SingleURL)\n\t\t\t\tParseURLToHost(s.SingleURL, s.Targets)\n\t\t\t}\n\t\t}()\n\t\treturn\n\t}\n\n\tif ports != \"\" {\n\t\tif strings.ToLower(ports) == \"full\" {\n\t\t\tports = full\n\t\t} else if strings.ToLower(ports) == \"med\" {\n\t\t\tports = medium\n\t\t} else if strings.ToLower(ports) == \"small\" {\n\t\t\tports = small\n\t\t} else if strings.ToLower(ports) == \"large\" {\n\t\t\tports = large\n\t\t} else if strings.ToLower(ports) == \"top\" {\n\t\t\tports = top\n\t\t}\n\t\ts.Ports = UnpackPortString(ports)\n\n\t}\n\tif s.InputFile != \"\" {\n\t\tinputData, err := GetDataFromFile(s.InputFile)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t// c := make(chan StringSet)\n\t\ttargetList := ExpandHosts(inputData)\n\t\t// := <-c\n\t\tif s.Debug {\n\t\t\tfor target := range targetList.Set {\n\t\t\t\tDebug.Printf(\"Target: %v\\n\", target)\n\t\t\t}\n\t\t}\n\t\ts.Hosts = targetList\n\t}\n\t// c2 := make(chan []Host)\n\ts.Protocols = StringSet{map[string]bool{}}\n\tfor _, p := range strings.Split(protocols, \",\") {\n\t\ts.Protocols.Add(p)\n\t}\n\n\tgo GenerateURLs(s.Hosts, s.Ports, &s.Paths, s.Targets)\n\t// fmt.Println(s)\n\tif !s.Dirbust && !s.Scan && !s.Screenshot && !s.URLProvided {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\t// close(s.Targets)\n\treturn\n}", "func (i *Instagram) requestMain(method, endpoint string, body io.Reader) (*http.Response, error) {\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(method, endpoint, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"User-Agent\", USERAGENT)\n\tfor _, cookie := range i.cookies {\n\t\treq.AddCookie(cookie)\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "func (c *_Crawler) NewTestRequest(ctx context.Context) (reqs []*http.Request) {\n\tfor _, u := range []string{\n\t\t//\"https://bareminerals.com/\",\n\t\t//\"https://www.bareminerals.com/skincare/skincare-explore/bareblends-customizable-skin-care/\",\n\t\t//\"https://www.bareminerals.com/makeup/face/all-face/\",\n\t\t//\"https://www.bareminerals.com/skincare/moisturizers/ageless-phyto-retinol-neck-cream/US41700210101.html\",\n\t\t//\"https://www.bareminerals.com/makeup/eyes/brow/strength-%26-length-serum-infused-brow-gel/USmasterslbrowgel.html\",\n\t\t//\"https://www.bareminerals.com/makeup/lips/all-lips/maximal-color%2C-minimal-ingredients/US41700127101.html?rrec=true\",\n\t\t//\"https://www.bareminerals.com/skincare/category/lips/ageless-phyto-retinol-lip-balm/US41700893101.html\",\n\t\t//\"https://www.bareminerals.com/offers/sale/barepro-performance-wear-powder-foundation/USmasterbareprosale.html\",\n\t\t//\"https://www.bareminerals.com/offers/sale/barepro-performance-wear-liquid-foundation-spf-20/USmasterbareproliquidsale.html\",\n\t\t//\"https://www.bareminerals.com/skincare/all-skincare/skinlongevity-green-tea-herbal-eye-mask/US41700067101.html\",\n\t\t//\"https://www.bareminerals.com/makeup/face/foundation-kits/i-am-an-original-get-started-makeup-kit/US102713.html\",\n\t\t//\"https://www.bareminerals.com/new/new-explore/poreless-skincare-2/poreless-3-step-regimen/US92860.html\",\n\t\t//\"https://www.bareminerals.com/makeup/face/blush/gen-nude-powder-blush/USmastergnblush.html\",\n\t\t\"https://www.bareminerals.com/makeup/makeup-brushes/face-brushes/beautiful-finish-foundation-brush/US77069.html\",\n\t\t//\"https://www.bareminerals.com/US41700196101.html\",\n\t} {\n\t\treq, err := http.NewRequest(http.MethodGet, u, nil)\n\t\tif err != nil {\n\t\t\tc.logger.Fatal(err)\n\t\t} else {\n\t\t\treqs = append(reqs, req)\n\t\t}\n\t}\n\treturn\n}", "func generateRequest() {\n Counter.Increment(\"Total\")\n\n //credits to http://blog.golang.org/go-concurrency-patterns-timing-out-and\n getTimeout := make(chan bool, 1)\n\n client := http.Client {}\n timeResp := make(chan bool, 1)\n respCode := 0\n\n go func() {\n\ttime.Sleep(time.Millisecond * time.Duration(*timeout))\n\tgetTimeout <- true\n }()\n\n go func() {\n\tauthResp, err := client.Get(*URL)\n\trespCode = authResp.StatusCode\n\ttimeResp <- true\n if err != nil {\n\t fmt.Println(err)\n if P2F == 1 {\n\t defer Log.Flush()\n \t Log.Error(\"Error running client.Get from loadGen\\r\\n\")\n\t }\n\t return\n }\n }()\n\n select {\n\tcase <-getTimeout:\n\t mutex.Lock()\n\t //requestCodeMap[\"error\"] = requestCodeMap[\"error\"] + 1\n\t Counter.Increment(\"Errors\")\n\t mutex.Unlock()\n\t return\n\tcase <-timeResp:\n }\n\n codeCentury := respCode / 100\n if codeCentury == 1 {\n\tmutex.Lock()\n\t//requestCodeMap[\"100\"] = requestCodeMap[\"100\"] + 1\n\tCounter.Increment(\"100s\")\n\tmutex.Unlock()\n } else if codeCentury == 2 {\n\tmutex.Lock()\n\t//requestCodeMap[\"200\"] = requestCodeMap[\"200\"] + 1\n\tCounter.Increment(\"200s\")\n\tmutex.Unlock()\n } else if codeCentury == 3 {\n\tmutex.Lock()\n\t//requestCodeMap[\"300\"] = requestCodeMap[\"300\"] + 1\n\tCounter.Increment(\"300s\")\n\tmutex.Unlock()\n } else if codeCentury == 4 {\n\tmutex.Lock()\n\t//requestCodeMap[\"400\"] = requestCodeMap[\"400\"] + 1 \n\tCounter.Increment(\"400s\") \n\tmutex.Unlock()\n } else if codeCentury == 5 {\n\tmutex.Lock()\n\t//requestCodeMap[\"500\"] = requestCodeMap[\"500\"] + 1 \n\tCounter.Increment(\"500s\") \n\tmutex.Unlock()\n }\n\n}", "func InitCLI() (*CLIConfig, HTTPRequest) {\n\tfmt.Println(\"Initializing .....\")\n\n\tconfig := CLIConfig{}\n\tvar burpHTTPRequest HTTPRequest\n\n\t//config.URL = flag.String(\"u\", \"\", \"Target URL. E.g. http://www.altoromutual.com:8080/login.jsp (Depricated)\")\n\tconfig.BurpRequestFile = flag.String(\"req\", \"\", \"Burp Request File (Required)\")\n\tconfig.Wordlist = flag.String(\"w\", \"\", \"Worldlist file (Required)\")\n\n\tconfig.BurpRequestIsTLS = flag.Bool(\"tls\", true, \"Validate the server certificate\")\n\tconfig.Workers = flag.Int(\"workers\", 5, \"Number of workers\")\n\tconfig.Proxy = flag.String(\"proxy\", \"\", \"Proxy server. E.g. localhost:8080\")\n\tconfig.Insecure = flag.Bool(\"insecure\", true, \"Validate the server certificate\")\n\tconfig.OutputFileName = flag.String(\"o\", \"\", \"File Name.\")\n\n\tflag.Parse()\n\n\tif len(os.Args) < 2 {\n\t\tfmt.Println(\"Usage cli --req <burp.req> -w <path/to/wordlist> [--workers 10] [--proxy http://127.0.0.1:8080] [--insecure false] [-o file.csv]\")\n\t\tos.Exit(1)\n\t}\n\n\t// Check if the required parameters 'URL' are provided\n\t// if *config.URL == \"\" {\n\n\t// \t// Check if burp request file is also not provided\n\t// \tif *config.BurpRequestFile != \"\" {\n\t// \t\tcolor.Set(color.FgHiRed)\n\t// \t\tfmt.Println(\"-u URL is depricated. Use --req req.burp\")\n\t// \t\tflag.Usage()\n\t// \t\tcolor.Unset()\n\t// \t\tos.Exit(1)\n\t// \t}\n\t// }\n\n\t// If burp request file is provided, then update the URL\n\tif *config.BurpRequestFile != \"\" {\n\n\t\t// specify the type of request: http/https\n\t\tvar protocol string\n\n\t\t// Parse the burp request file\n\t\tvar err error\n\t\tburpHTTPRequest, err = parseBurpRequest(*config.BurpRequestFile)\n\t\tif err != nil {\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t// Check if the request is over http/https\n\t\tif *config.BurpRequestIsTLS {\n\t\t\tprotocol = \"https://\"\n\t\t} else {\n\t\t\tprotocol = \"http://\"\n\t\t}\n\n\t\tburpHTTPRequest.URL = protocol + burpHTTPRequest.Host + burpHTTPRequest.Path\n\t} else {\n\t\tcolor.Set(color.FgHiRed)\n\t\tfmt.Println(\"Missing Burp Request File\")\n\t\tflag.Usage()\n\t\tcolor.Unset()\n\t\tos.Exit(1)\n\t}\n\n\t// Check if the required parameters are provided\n\tif *config.Wordlist == \"\" {\n\t\tcolor.Set(color.FgHiRed)\n\t\tfmt.Println(\"Missing Wordlist\")\n\t\tflag.Usage()\n\t\tcolor.Unset()\n\t\tos.Exit(1)\n\t}\n\n\t// Count the number of words in the file\n\tconfig.WordCount, _ = CountWords(*config.Wordlist)\n\tif config.WordCount == 0 {\n\t\tcolor.Set(color.FgHiRed)\n\t\tfmt.Println(\"[config.go] Cannot read from the wordlist\")\n\t\tcolor.Unset()\n\t\tos.Exit(1)\n\t}\n\n\tcolor.Set(color.FgHiYellow)\n\tfmt.Println(\"[-] attacking the Host: \", burpHTTPRequest.Host)\n\tfmt.Println(\"[-] using wordlist: \", *config.Wordlist)\n\tfmt.Println(\"[-] number of words loaded: \", config.WordCount)\n\tfmt.Println(\"[-] using number of workers: \", *config.Workers)\n\n\tif *config.Proxy == \"\" {\n\t\tfmt.Println(\"[-] starting script without any proxy\")\n\t} else {\n\t\tfmt.Println(\"[-] using proxy: \", *config.Proxy)\n\t}\n\n\tif *config.Insecure {\n\t\tfmt.Println(\"[-] skipping certificate verification\")\n\t} else {\n\n\t\tfmt.Println(\"[-] certificate verification ENABLED\")\n\t}\n\tcolor.Unset()\n\n\treturn &config, burpHTTPRequest\n\n}", "func main() {\r\n\r\n\tvar ok bool\r\n\r\n\tstatus_info.status_code = 0\r\n\tstatus_info.error_message = \"\"\r\n\tstatus_info.error_details = \"\"\r\n\tresponse_data = \"\"\r\n\tmysql_connect_string = \"root:archer-nx01@(127.0.0.1:3306)/qwlc?parseTime=true\"\r\n\r\n fmt.Println(\"Content-Type: text/xml\\n\");\r\n\r\n\tread_smart_history_table()\r\n\tread_smart_users_table()\r\n\r\n\tparse_fields()\r\n\r\n\tfunction, ok = fields_map[\"function\"]\r\n\tif ok {\r\n\t\tresponse_data += fmt.Sprintf(\"<FUNCTION>%s</FUNCTION>\\n\",function)\r\n\t} else {\r\n\t\tstatus_info.status_code = 1\r\n\t\tstatus_info.error_message = \"No value specified for function code\"\r\n\t\tstatus_info.error_details = \"\"\r\n\t\tsend_response()\r\n\t}\r\n\r\n\tstatus_info.status_code = 0\r\n\tstatus_info.error_message = \"We are good\"\r\n\tstatus_info.error_details = \"no complaints\"\r\n\tresponse_data += fmt.Sprintf(\"<NUM_USERS>%d</NUM_USERS>\\n\",num_users)\r\n\tresponse_data += fmt.Sprintf(\"<NUM_HIST>%d</NUM_HIST>\\n\",num_hist)\r\n\tsend_response()\r\n}", "func main() {\n\tdaHost := os.Args[1]\n\tgav := os.Args[2]\n\n\tparams := BeforePost(gav)\n\n\turl := fmt.Sprintf(\"http://%s/da/rest/v-1/reports/lookup/gavs\", daHost)\n\tbody := Post(url, params)\n\tAfterPost(body)\n}", "func processRequest(httpParams *HTTPParams) ([]byte, error) {\n\tregex := regexp.MustCompile(`\\?`)\n\tif regex.MatchString(httpParams.Resource) {\n\t\thttpParams.Resource += \"&\" + APIVersion\n\t} else {\n\t\thttpParams.Resource += \"?\" + APIVersion\n\t}\n\treader := bytes.NewReader(httpParams.Data)\n\thttpClient := &http.Client{}\n\treq, err := http.NewRequest(httpParams.Verb, httpParams.Resource, reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsetHeaders(req, httpParams.ContentType)\n\n\tif os.Getenv(\"GOWIT_DEBUG\") == \"true\" {\n\t\tdebug(httputil.DumpRequestOut(req, true))\n\t}\n\n\tresult, err := httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif os.Getenv(\"GOWIT_DEBUG\") == \"true\" {\n\t\tdebug(httputil.DumpResponse(result, true))\n\t}\n\n\tbody, err := ioutil.ReadAll(result.Body)\n\tresult.Body.Close()\n\tif result.StatusCode != 200 {\n\t\treturn nil, errors.New(http.StatusText(result.StatusCode))\n\t}\n\treturn body, nil\n}", "func (m *Webflow) request(cr clientRequest, result interface{}) error {\n\tbody, ct, err := m.generateJSONRequestData(cr)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Construct the request\n\treq, err := http.NewRequest(cr.method, m.Host+cr.path, bytes.NewReader(body))\n\tif err != nil {\n\t\treturn Error{fmt.Sprintf(\"Could not create request: %s\", err), defaultCode}\n\t}\n\treq.Header.Add(\"Content-Type\", ct)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Add(\"Accept-Charset\", \"utf-8\")\n\treq.Header.Add(\"Accept-Version\", m.Version)\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", m.AccessToken))\n\n\t// Create the HTTP client\n\tclient := &http.Client{\n\t\tTransport: m.Transport,\n\t\tTimeout: m.Timeout,\n\t}\n\t// Make the request\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn Error{fmt.Sprintf(\"Failed to make request: %s\", err), defaultCode}\n\t}\n\tdefer res.Body.Close()\n\n\tm.RateLimit, err = strconv.Atoi(res.Header[\"x-ratelimit-limit\"][0])\n\tif err != nil {\n\t\treturn Error{fmt.Sprintf(\"Failed to parse x-ratelimit-limit: %s\", err), defaultCode}\n\t}\n\tm.Remaining, err = strconv.Atoi(res.Header[\"x-ratelimit-remaining\"][0])\n\tif err != nil {\n\t\treturn Error{fmt.Sprintf(\"Failed to parse x-ratelimit-remaining: %s\", err), defaultCode}\n\t}\n\n\t// Parse the response\n\tc, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn Error{fmt.Sprintf(\"Could not read response: %s\", err), defaultCode}\n\t}\n\n\tvar env envelope\n\tif err := json.Unmarshal(c, &env); err != nil {\n\t\treturn Error{fmt.Sprintf(\"Could not parse response: %s\", err), defaultCode}\n\t}\n\n\tif http.StatusOK <= res.StatusCode && res.StatusCode < http.StatusMultipleChoices {\n\t\tif env.Data != nil {\n\t\t\tc, _ = json.Marshal(env.Data)\n\t\t}\n\t\treturn json.Unmarshal(c, &result)\n\t}\n\te := env.Errors[0]\n\treturn Error{e.Message, e.Code}\n}", "func NewRequest(method string, path string, queryParameters []string, body []byte, prettyPrint bool, autopaginate bool) {\n\tvar data models.APIResponse\n\tvar err error\n\tvar cursor string\n\n\tdata.Data = make([]interface{}, 0)\n\tclient, err := GetClientInformation()\n\n\tif viper.GetString(\"BASE_URL\") != \"\" {\n\t\tbaseURL = viper.GetString(\"BASE_URL\")\n\t}\n\n\tif err != nil {\n\t\tfmt.Println(\"Error fetching client information\", err.Error())\n\t}\n\n\tfor {\n\t\tvar apiResponse models.APIResponse\n\n\t\tu, err := url.Parse(baseURL + path)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error getting url: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tq := u.Query()\n\t\tfor _, paramStr := range queryParameters {\n\t\t\tvar value string\n\t\t\tparam := strings.Split(paramStr, \"=\")\n\t\t\tif len(param) == 2 {\n\t\t\t\tvalue = param[1]\n\t\t\t}\n\t\t\tq.Add(param[0], value)\n\t\t}\n\n\t\tif cursor != \"\" {\n\t\t\tq.Set(\"after\", cursor)\n\t\t}\n\n\t\tif autopaginate == true {\n\t\t\tfirst := \"100\"\n\t\t\t// since channel points custom rewards endpoints only support 50, capping that here\n\t\t\tif strings.Contains(u.String(), \"custom_rewards\") {\n\t\t\t\tfirst = \"50\"\n\t\t\t}\n\n\t\t\tq.Set(\"first\", first)\n\t\t}\n\n\t\tu.RawQuery = q.Encode()\n\n\t\tresp, err := apiRequest(strings.ToUpper(method), u.String(), body, apiRequestParameters{\n\t\t\tClientID: client.ClientID,\n\t\t\tToken: client.Token,\n\t\t})\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error reading body: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif resp.StatusCode == http.StatusNoContent {\n\t\t\tfmt.Println(\"Endpoint responded with status 204\")\n\t\t\treturn\n\t\t}\n\n\t\terr = json.Unmarshal(resp.Body, &apiResponse)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error unmarshalling body: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif resp.StatusCode > 299 || resp.StatusCode < 200 {\n\t\t\tdata = apiResponse\n\t\t\tbreak\n\t\t}\n\n\t\td := data.Data.([]interface{})\n\t\tif strings.Contains(path, \"schedule\") || apiResponse.Data == nil {\n\t\t\tdata.Data = append(d, apiResponse.Data)\n\t\t} else {\n\t\t\tdata.Data = append(d, apiResponse.Data.([]interface{})...)\n\t\t}\n\n\t\tif apiResponse.Pagination == nil || *&apiResponse.Pagination.Cursor == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tif autopaginate == false {\n\t\t\tdata.Pagination = &models.APIPagination{\n\t\t\t\tCursor: apiResponse.Pagination.Cursor,\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tif apiResponse.Pagination.Cursor == cursor {\n\t\t\tbreak\n\t\t}\n\t\tcursor = apiResponse.Pagination.Cursor\n\n\t}\n\n\tif data.Data == nil {\n\t\tdata.Data = make([]interface{}, 0)\n\t}\n\t// handle json marshalling better; returns empty slice vs. null\n\tif len(data.Data.([]interface{})) == 0 && data.Error == \"\" {\n\t\tdata.Data = make([]interface{}, 0)\n\t}\n\n\td, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Printf(\"Error marshalling json: %v\", err)\n\t\treturn\n\t}\n\n\tif prettyPrint == true {\n\t\tvar obj map[string]interface{}\n\t\tjson.Unmarshal(d, &obj)\n\t\t// since Command Prompt/Powershell don't support coloring, will pretty print without colors\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\ts, _ := json.MarshalIndent(obj, \"\", \" \")\n\t\t\tfmt.Println(string(s))\n\t\t\treturn\n\t\t}\n\n\t\tf := colorjson.NewFormatter()\n\t\tf.Indent = 2\n\t\tf.KeyColor = color.New(color.FgBlue).Add(color.Bold)\n\t\ts, err := f.Marshal(obj)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(string(s))\n\t\treturn\n\t}\n\n\tfmt.Println(string(d))\n\treturn\n}", "func main() {\n\tparseCLIOptions()\n\n\t// Print version information and exit.\n\tif config.PrintVersion {\n\t\tfmt.Println(toolID)\n\t\tos.Exit(errSuccess)\n\t}\n\n\txca = xcarestclient.New(config.XCAHost)\n\txca.SetPort(config.XCAPort)\n\txca.UseInsecureHTTPS()\n\txca.SetAuth(config.XCAUserID, config.XCASecret)\n\txca.SetUserAgent(toolID)\n\n\tif authErr := xca.Authenticate(); authErr != nil {\n\t\tfmt.Printf(\"Could not authenticate: %s\\n\", authErr)\n\t\tos.Exit(errXCAAuth)\n\t}\n\n\taccessPoints, apErr := getAccessPoints()\n\tif apErr != nil {\n\t\tfmt.Printf(\"Could not obtain AP list: %s\\n\", apErr)\n\t\tos.Exit(errAPICall)\n\t}\n\tfmt.Printf(\"\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%s\\\"\\n\", \"serial\", \"model\", \"ip\", \"hostname\", \"radio\", \"band\", \"bssid\", \"ssid\", \"disabled\")\n\tfor _, singleAP := range accessPoints {\n\t\tdetails, detailsErr := getAPDetails(singleAP.SerialNumber)\n\t\tif detailsErr != nil {\n\t\t\tfmt.Printf(\"Could not get AP details: %s\\n\", detailsErr)\n\t\t\tos.Exit(errAPICall)\n\t\t}\n\t\tfor _, radio := range details.Radios {\n\t\t\tfor _, wlan := range radio.Wlan {\n\t\t\t\tfmt.Printf(\"\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%d\\\",\\\"%s\\\",\\\"%s\\\",\\\"%s\\\",\\\"%t\\\"\\n\", singleAP.SerialNumber, details.HardwareType, details.IPAddress, details.Hostname, radio.RadioIndex, radio.Mode, wlan.Bssid, wlan.Ssid, !radio.AdminState)\n\t\t\t}\n\t\t}\n\t}\n\n\tos.Exit(errSuccess)\n}", "func CreateServiceStatusRequest() (request *ServiceStatusRequest) {\nrequest = &ServiceStatusRequest{\nRpcRequest: &requests.RpcRequest{},\n}\nrequest.InitWithApiInfo(\"Yundun\", \"2015-04-16\", \"ServiceStatus\", \"yundun\", \"openAPI\")\nreturn\n}", "func processRequest(w http.ResponseWriter, r *http.Request) {\n\tparamValues, _ := r.URL.Query()[\"u\"] // Get url values of parameter 'u'\n\n\tif len(paramValues) > 0 { // If parameters exist then loop through it and make a request\n\n\t\tc := make(chan []byte) // Declare a channel c where results will be returned back\n\t\tvar nums map[string][]int\n\t\tvar combinedNumbers []int\n\n\t\tctx := context.Background() // Use context to cancel running child go routines after deadline of 450 miliseconds\n\t\tctx, cancel := context.WithCancel(ctx)\n\n\t\tfor _, value := range paramValues {\n\t\t\tgo requestNumbers(ctx, value, c) // execute request on their own go routines and wait for result in c channel\n\t\t}\n\n\t\ttimeout := time.After(DEADLINE * time.Millisecond) // NOTE: I set deadeline to 450 miliseconds before the for loop\n\t\tfor { // to give allowance of 50 miliseconds for the merging\n\t\t\tselect { // and sorting algorithm below\n\t\t\tcase results := <-c: // Wait for the results here\n\t\t\t\tfmt.Println(string(results))\n\t\t\t\terr := json.Unmarshal(results, &nums)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"Invalid result. \", err.Error(), \" Continuing process.\") // Report invalid result and continue\n\t\t\t\t} else {\n\t\t\t\t\tarrayNums := nums[\"numbers\"]\n\t\t\t\t\tfor counter := 0; counter < len(arrayNums); counter++ {\n\t\t\t\t\t\tif isItemInSlice(arrayNums[counter], combinedNumbers) == false {\n\t\t\t\t\t\t\tcombinedNumbers = append(combinedNumbers, []int{arrayNums[counter]}...) // MERGING: Combine all unique integers into one integer slice\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase <-timeout: // Deadline comes here and cancel remaining go routines requesting from urls\n\t\t\t\tfmt.Println(\"Time Up\")\n\t\t\t\tsort.Slice(combinedNumbers, func(i, j int) bool { // SORTING: Sort slice\n\t\t\t\t\treturn combinedNumbers[i] < combinedNumbers[j]\n\t\t\t\t})\n\t\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\t\tjson.NewEncoder(w).Encode(map[string]interface{}{\"numbers\": combinedNumbers}) // Return result to client\n\t\t\t\tcancel() // Cancel all unfinished go routines\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t} else { // URL has no u parameters\n\t\tw.Write([]byte(\"No valid parameters.\"))\n\t}\n}", "func (dc *httpRequest) createRequest(targetUrl string, body []map[string]interface{}) []error {\n\tvar error []error\n\tfor _, value := range body {\n\t\treqBody, err := parseBody(value)\n\t\tif err != nil {\n\t\t\terror = append(error, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tresponse, err := dc.httpClient.Post(targetUrl, \"application/json\", bytes.NewBuffer(reqBody))\n\t\tif err != nil {\n\t\t\terror = append(error, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif code := response.StatusCode; code >= 400 && code <= 600 {\n\t\t\tbuf := new(strings.Builder)\n\t\t\t_, err = io.Copy(buf, response.Body)\n\n\t\t\terror = append(error, fmt.Errorf(\"unable to seed %s because %s\", reqBody, buf.String()))\n\n\t\t}\n\t}\n\treturn error\n}", "func ProcessRequest(wg *sync.WaitGroup, makes *[]vehicledbhelperutils.CommonMakeName, processIndexStart int, processIndexEnd int, upperBound int) {\n\t// Finished processing these requests\n\tfmt.Printf(\"Processing from %d to %d\\n\", processIndexStart, processIndexEnd)\n\tfor i := processIndexStart; i < processIndexEnd && i < upperBound; i++ {\n\t\tfmt.Printf(\"IDX: %d - Retrieving Models for %s\\n\", i, string((*makes)[i].CommonMake))\n\t\tvehicledbhelperutils.GetCommonModelsJSON((*makes)[i])\n\t}\n\twg.Done()\n}", "func genRequests(N int, ids [][]int, priority []int, topology string, roundNum int) ([]*Request, error) {\r\n\tif topology != graph.GRID && topology != graph.RING {\r\n\t\treturn nil, errors.New(\"request.genRequests: The requested topology is not valid!\")\r\n\t}\r\n\tvar reqs []*Request\r\n\tif topology == graph.GRID {\r\n\t\tvar isSame bool\r\n\t\tvar r [2]int\r\n\t\treqs = make([]*Request, N)\r\n\t\t//s := make([]int, len(ids[0]))\r\n\t\t//d := make([]int, len(ids[0]))\r\n\t\tfor i := 0; i < N; i++ {\r\n\t\t\tisSame = true\r\n\t\t\tfor isSame == true {\r\n\t\t\t\tr[0] = rand.Intn(len(ids))\r\n\t\t\t\tr[1] = rand.Intn(len(ids))\r\n\t\t\t\tisSame = r[0] == r[1]\r\n\t\t\t}\r\n\t\t\treqs[i] = new(Request)\r\n\t\t\treqs[i].Src = new(graph.Node)\r\n\t\t\treqs[i].InitialSrc = new(graph.Node)\r\n\t\t\treqs[i].Dest = new(graph.Node)\r\n\t\t\treqs[i].Src.ID = make([]int, 2)\r\n\t\t\treqs[i].InitialSrc.ID = make([]int, 2)\r\n\t\t\treqs[i].Dest.ID = make([]int, 2)\r\n\t\t\treqs[i].Src = graph.MakeNode(ids[r[0]], config.GetConfig().GetMemory())\r\n\t\t\treqs[i].InitialSrc = graph.MakeNode(ids[r[0]], config.GetConfig().GetMemory())\r\n\t\t\treqs[i].Dest = graph.MakeNode(ids[r[1]], config.GetConfig().GetMemory())\r\n\t\t\treqs[i].PositionID = make([]int, 2)\r\n\t\t\treqs[i].Position = 1\r\n\t\t\treqs[i].RecoveryPosition = 1\r\n\t\t\treqs[i].RecoveryPathIndex = 0\r\n\t\t\treqs[i].RecoveryPathCursor = 0\r\n\t\t\treqs[i].Priority = priority[i]\r\n\t\t\treqs[i].GenerationTime = roundNum\r\n\t\t\treqs[i].HasReached = false\r\n\t\t\treqs[i].CanMove = false\r\n\t\t\treqs[i].CanMoveRecovery = false\r\n\t\t\treqs[i].IsRecovering = false\r\n\r\n\t\t\t////////////// TODO: IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n\t\t\treqs[i].Paths = make([][]*graph.Node, 1)\r\n\t\t\treqs[i].RecoveryPaths = make([][][][]*graph.Node, 1)\r\n\t\t}\r\n\t} else if topology == graph.RING {\r\n\t\tvar isSame bool\r\n\t\tvar r [2]int\r\n\t\treqs = make([]*Request, N)\r\n\t\tfor i := 0; i < N; i++ {\r\n\t\t\tisSame = true\r\n\t\t\tfor isSame == true {\r\n\t\t\t\tr[0] = rand.Intn(len(ids))\r\n\t\t\t\tr[1] = rand.Intn(len(ids))\r\n\t\t\t\tisSame = r[0] == r[1]\r\n\t\t\t}\r\n\t\t\treqs[i] = new(Request)\r\n\t\t\treqs[i].Src = new(graph.Node)\r\n\t\t\treqs[i].InitialSrc = new(graph.Node)\r\n\t\t\treqs[i].Dest = new(graph.Node)\r\n\t\t\treqs[i].Src.ID = make([]int, 1)\r\n\t\t\treqs[i].InitialSrc.ID = make([]int, 1)\r\n\t\t\treqs[i].Dest.ID = make([]int, 1)\r\n\t\t\treqs[i].Src = graph.MakeNode(ids[r[0]], config.GetConfig().GetMemory())\r\n\t\t\treqs[i].InitialSrc = graph.MakeNode(ids[r[0]], config.GetConfig().GetMemory())\r\n\t\t\treqs[i].Dest = graph.MakeNode(ids[r[1]], config.GetConfig().GetMemory())\r\n\t\t\treqs[i].PositionID = make([]int, 1)\r\n\t\t\treqs[i].Position = 1\r\n\t\t\treqs[i].RecoveryPosition = 1\r\n\t\t\treqs[i].RecoveryPathIndex = 0\r\n\t\t\treqs[i].RecoveryPathCursor = 0\r\n\t\t\treqs[i].Priority = priority[i]\r\n\t\t\treqs[i].GenerationTime = roundNum\r\n\t\t\treqs[i].HasReached = false\r\n\t\t\treqs[i].CanMove = false\r\n\t\t\treqs[i].CanMoveRecovery = false\r\n\t\t\treqs[i].IsRecovering = false\r\n\r\n\t\t\t////////////// TODO: IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n\t\t\treqs[i].Paths = make([][]*graph.Node, 1)\r\n\t\t\treqs[i].RecoveryPaths = make([][][][]*graph.Node, 1)\r\n\t\t}\r\n\t} else {\r\n\t\tfmt.Println(\"Request - genRequests: Caution! Input topology is not supported.\")\r\n\t\treturn nil, nil\r\n\t}\r\n\treturn reqs, nil\r\n}", "func ParsingMainPage(){\n\tcurPath:=currentPath()\n\t_ = os.MkdirAll(curPath+\"/pars_result/\"+mainPagesParsResultDir, 0777)\n\t_ = os.MkdirAll(curPath+\"/pars_result/\"+linksParsResultDir, 0777)\n\tresultMainPagePars:=curPath+\"/pars_result/MainPageInformation.json\"\n\tmainPageFileTemp,_:=os.Create(resultMainPagePars)\n\tdefer mainPageFileTemp.Close()\n\tparser.MainPageParser(resultMainPagePars)\n\tmainPageFileSave:=curPath+\"/pars_result/\"+mainPagesParsResultDir+\"/\"+time.Now().Format(\"2006-1-2\")+\".json\"\n\t_ = CopyData(mainPageFileSave, resultMainPagePars)\n\tdefer RemoveFile(resultMainPagePars)\n\n\tvar mainPages models.MainPages\n\t_ = os.MkdirAll(curPath+\"/pars_result/\"+linksParsResultDir+\"/\"+time.Now().Format(\"2006-1-2\"), 0777)\n\tsN:=\"https://domain-status.com/archives/\"+time.Now().AddDate(0,0,-1).Format(\"2006-1-2\")+\"/\"\n\n\tfor _,i:=range OpenAndRead(resultMainPagePars,mainPages){\n\t\tnameOfFile:=strings.Replace(i,sN,time.Now().Format(\"2006-1-2\")+\"_\",1)\n\t\tnameOfFile=strings.Replace(nameOfFile,\"/1\",\".json\",1)\n\t\tnameOfFile=strings.ReplaceAll(nameOfFile,\"/\",\"_\")\n\t\t_ = CreateFile(curPath + \"/pars_result/\" + linksParsResultDir + \"/\" + time.Now().Format(\"2006-1-2\") + \"/\" + nameOfFile)\n\t\tstartUrlArray:=strings.Fields(i)\n\t\tparser.PageParser(curPath+\"/pars_result/\"+linksParsResultDir+\"/\"+time.Now().Format(\"2006-1-2\")+\"/\"+nameOfFile,startUrlArray,100)\n\t}\n}", "func (obj *v1list) Request(w http.ResponseWriter, r *http.Request) {\n\n\tfErr := false\n\n\treq := &v1listAnswer{\n\t\treplyMq: &[]FetchTask.FetchElement{},\n\t\treplyClient: []FetchTask.PublicElement{},\n\t\tbadRequest: &api.ReplayBadRequest{},\n\t}\n\n\tlog.Printf(\"Request: %s\", obj.Url)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\twg := sync.WaitGroup{}\n\twg.Add(1)\n\n\tgo func() {\n\n\t\tvar data []byte\n\n\t\tif !fErr {\n\t\t\tmsg, err := obj.Setup.Nats.Request(obj.Url, data, 30*time.Second)\n\n\t\t\tif err == nil && msg != nil {\n\t\t\t\terr := json.Unmarshal(msg.Data, req.replyMq)\n\t\t\t\tif !v1.LogOnError(err, fmt.Sprintf(\"error: can't parse answer FetchTask %s\", obj.Url)) {\n\t\t\t\t\treq.badRequest.SetBadRequest(w)\n\t\t\t\t\tfErr = true\n\t\t\t\t} else {\n\t\t\t\t\tif len(*req.replyMq) == 0 {\n\t\t\t\t\t\treq.badRequest.SetNotFound(w, \"no elements\")\n\t\t\t\t\t\tfErr = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif fErr {\n\t\t\tv1.LogOnError(req.badRequest.Encode(w), \"warning\")\n\t\t} else {\n\t\t\tfor _, v := range *req.replyMq {\n\t\t\t\treq.replyClient = append(req.replyClient, FetchTask.PublicElement{\n\t\t\t\t\tID: v.ID,\n\t\t\t\t\tStatus: v.Status,\n\t\t\t\t\tHeaders: v.Headers,\n\t\t\t\t\tLength: v.Length})\n\t\t\t}\n\n\t\t\tlog.Printf(\"Request list done elements: %d\", len(req.replyClient))\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tv1.LogOnError(json.NewEncoder(w).Encode(req.replyClient), \"error: can't decode answer for list\")\n\t\t}\n\n\t\twg.Done()\n\t}()\n\twg.Wait()\n}", "func CommandHandler(w http.ResponseWriter, req *http.Request) {\n\n // Here we only allow HTTP GET requests\n switch req.Method {\n case \"GET\":\n\n // Checking if client IP is authorized\n ipauth := strings.Contains(allowedips,GetClientIP(req))\n if ipauth ==false {\n http.Error(w, \"[403] Unauthorized\", 403)\n log.Printf(GetClientIP(req) + \" - [403] Unauthorized Source IP\")\n return\n }\n\n // Data collection requests\n if req.URL.Path == string(\"/hash=\" + hashsecret + \"&fetch=\" + \"release\") {\n out, _ := exec.Command(\"cat\", \"/etc/redhat-release\").Output()\n w.Write([]byte(out))\n } else if req.URL.Path == string(\"/fetch=kernel\") {\n out, _ := exec.Command(\"uname\", \"-r\").Output()\n w.Write([]byte(out))\n } else if req.URL.Path == string(\"/fetch=rpmlist\") {\n out, _ := exec.Command(\"rpm\", \"-qa\").Output()\n w.Write([]byte(out))\n } else if req.URL.Path == string(\"/fetch=hostname\") {\n out, _ := exec.Command(\"hostname\").Output()\n w.Write([]byte(out))\n } else if req.URL.Path == string(\"/fetch=uptime\") {\n out, _ := exec.Command(\"uptime\").Output()\n w.Write([]byte(out))\n } else if req.URL.Path == string(\"/fetch=df\") {\n out, _ := exec.Command(\"df\", \"-h\").Output()\n w.Write([]byte(out))\n } else if req.URL.Path == string(\"/fetch=meminfo\") {\n out, _ := exec.Command(\"cat\", \"/proc/meminfo\").Output()\n w.Write([]byte(out))\n } else if req.URL.Path == string(\"/fetch=cpuinfo\") {\n out, _ := exec.Command(\"cat\", \"/proc/cpuinfo\").Output()\n w.Write([]byte(out))\n\n // Return HTTP Code 400 if no matching request\n } else {\n http.Error(w, \"[400] Bad Request\", 400)\n log.Printf(GetClientIP(req) + \" - [400] Bad Request URL\")\n return\n }\n\n // Return HTTP Code 405 if someone tries a method other than GET\n default:\n http.Error(w, \"[405] Method Not Allowed\", 405)\n log.Printf(GetClientIP(req) + \" - [405] Method Not Allowed\")\n }\n}", "func (c *Client) NewRequest(db *sql.DB) error {\n\n\tclient := &http.Client{}\n\tpostData := make([]byte, 100)\n\turlPath := os.Getenv(\"METAR_PATH\")\n\t// Concatenate ICAO codes to UrlPath\n\tfirst := true\n\tfor _, icao := range c.Icao {\n\t\tif first {\n\t\t\turlPath = urlPath + icao\n\t\t\tfirst = false\n\t\t\tcontinue\n\t\t}\n\t\turlPath = urlPath + \",\" + icao\n\t}\n\t//fmt.Println(urlPath)\n\treq, err := http.NewRequest(\"GET\", urlPath, bytes.NewReader(postData))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Add(\"X-API-Key\", os.Getenv(\"API_KEY\"))\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tbytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = json.Unmarshal(bytes, &c.Result); err != nil {\n\t\treturn err\n\t}\n\n\tcount := fmt.Sprintf(\"%v\", c.Result[\"results\"])\n\toutString := fmt.Sprintf(\"%v\", c.Result[\"data\"])\n\t//fmt.Println(\"Return airport\", count)\n\t//fmt.Println(\"Data \", outString)\n\tvar airports []string\n\t// Parse data\n\n\tif count <= \"1\" {\n\t\tairports = append(airports, outString)\n\t} else {\n\t\tairports = c.ParseData(outString)\n\t}\n\tm := MetarRepository{}\n\tr := Report{}\n\tfor _, v := range airports {\n\t\t// Update History table\n\t\tstationID := r.ParseStationID(v)\n\t\tm.AddWeather(db, v, stationID)\n\t\t//fmt.Println(\"Airport add\", id, \"and raw text is \", v)\n\n\t\tif r.IsWindSucks(v) || r.ParseWeather(v) {\n\t\t\tfmt.Println(\"Weather at \", stationID, \"Sucks!!\")\n\t\t} else {\n\t\t\tfmt.Println(\"Enjoy Weather at \", stationID)\n\t\t}\n\t}\n\n\treturn nil\n}", "func main() {\n\tif len(os.Args) < 4 {\n\t\tfmt.Printf(\"Usage: <node1 ip> <node2 ip> ... <num_threads> <duration_secs>\\n\")\n\t\tos.Exit(1)\n\t}\n\n\t// Grab the third-to-last argument from os.Args -- that is num_threads\n\tvar numThreads, err1 = strconv.ParseInt(os.Args[len(os.Args)-2], 10, 64)\n\tif int(numThreads) < 1 || err1 != nil {\n\t\tfmt.Printf(\"Error: Invalid number of threads %v\\n\", os.Args[len(os.Args)-2])\n\t\tos.Exit(1)\n\t}\n\n\t// Grab the second-to-last argument from os.Args -- that is duration\n\tvar duration, err2 = strconv.ParseInt(os.Args[len(os.Args)-1], 10, 64)\n\tif int(duration) < 1 || err2 != nil {\n\t\tfmt.Printf(\"Error: Invalid duration %v\\n\", os.Args[len(os.Args)-1])\n\t\tos.Exit(1)\n\t}\n\n\tvar endpoints = make([]string, len(os.Args)-2)\n\tfor i := 0; i < len(endpoints); i++ {\n\t\tendpoints[i] = fmt.Sprintf(\"%s:%d\", os.Args[i+1], etcdPort)\n\t}\n\n\t// use a logger to serialize all prints to standard output\n\tvar logger = log.New(os.Stdout,\n\t\t\"REQUEST: \", log.LstdFlags)\n\trun(endpoints, numThreads, time.Duration(duration)*time.Second, logger)\n}", "func processRequestDefault(w http.ResponseWriter, req *http.Request) {\n\n\t//Get the headers map\n\theaderMap := w.Header()\n\n\t//Returns the payload in the response (echo)\n\theaderMap.Add(\"Content-Type\", \"application/json;charset=UTF-8\")\n\n\t//Copy headers sent to the response\n\tif req.Header[\"Test\"] != nil {\n\t\theaderMap.Add(\"Test\", req.Header[\"Test\"][0])\n\t}\n\n\t//Performs action based on the request Method\n\tswitch req.Method {\n\n\tcase http.MethodGet:\n\n\t\t//Wait 100ms\n\t\tsleep()\n\n\t\t//return the example json\n\t\tw.WriteHeader(200)\n\t\tw.Write([]byte(\"{\\\"id\\\":\\\"MLA\\\"}\"))\n\t\treturn\n\n\tcase http.MethodHead:\n\n\t\t//return the example json\n\t\tw.WriteHeader(200)\n\t\treturn\n\n\tcase http.MethodPut:\n\n\t\t//Create the array to hold the body\n\t\tp := make([]byte, req.ContentLength)\n\n\t\t//Reads the body content\n\t\treq.Body.Read(p)\n\n\t\tw.WriteHeader(200)\n\t\tw.Write([]byte(\"echoPut --> \" + string(p)))\n\n\tcase http.MethodDelete:\n\t\tw.WriteHeader(200)\n\t\tw.Write([]byte(\"echoDelete --> OK\"))\n\n\tcase http.MethodPost:\n\n\t\t//Create the array to hold the body\n\t\tp := make([]byte, req.ContentLength)\n\n\t\t//Reads the body content\n\t\treq.Body.Read(p)\n\n\t\tw.WriteHeader(201)\n\t\tw.Write([]byte(\"echo --> \" + string(p)))\n\n\tdefault:\n\t\t//Method Not Allowed\n\t\tw.WriteHeader(405)\n\t}\n\n}", "func handleRequests(cfg datastructures.Configuration, mgoClient *mgo.Session, redisClient *redis.Client) {\n\tm := func(ctx *fasthttp.RequestCtx) {\n\t\tif cfg.SSL.Enabled {\n\t\t\tlog.Debug(\"handleRequests | SSL is enabled!\")\n\t\t}\n\t\thttputils.SecureRequest(ctx, cfg.SSL.Enabled)\n\t\tctx.Response.Header.Set(\"AuthentiGo\", \"$v0.2.1\")\n\n\t\t// Avoid to print stats for the expvar handler\n\t\tif strings.Compare(string(ctx.Path()), \"/stats\") != 0 {\n\t\t\tlog.Info(\"\\n|REQUEST --> \", ctx, \" \\n|Headers: \", ctx.Request.Header.String(), \"| Body: \", string(ctx.PostBody()))\n\t\t}\n\n\t\tswitch string(ctx.Path()) {\n\t\tcase \"/middleware\":\n\t\t\tmiddleware(ctx, redisClient)\n\t\tcase \"/benchmark\":\n\t\t\tfastBenchmarkHTTP(ctx) // Benchmark API\n\t\tcase \"/auth/login\":\n\t\t\tAuthLoginWrapper(ctx, mgoClient, redisClient, cfg) // Login functionality [Test purpouse]\n\t\tcase \"/auth/register\":\n\t\t\tAuthRegisterWrapper(ctx, mgoClient, cfg) // Register an user into the DB [Test purpouse]\n\t\tcase \"/auth/delete\":\n\t\t\tDeleteCustomerHTTP(ctx, cfg.Mongo.Users.DB, cfg.Mongo.Users.Collection, redisClient, mgoClient)\n\t\tcase \"/auth/verify\":\n\t\t\tVerifyCookieFromRedisHTTP(ctx, redisClient) // Verify if an user is authorized to use the service\n\t\tcase \"/test/crypt\":\n\t\t\tCryptDataHTTPWrapper(ctx)\n\t\tcase \"/test/decrypt\":\n\t\t\tDecryptDataHTTPWrapper(ctx)\n\t\tcase \"/stats\":\n\t\t\texpvarhandler.ExpvarHandler(ctx)\n\t\tdefault:\n\t\t\t_, err := ctx.WriteString(\"The url \" + string(ctx.URI().RequestURI()) + string(ctx.QueryArgs().QueryString()) + \" does not exist :(\\n\")\n\t\t\tcommonutils.Check(err, \"handleRequests\")\n\t\t\tctx.Response.SetStatusCode(404)\n\t\t\tfastBenchmarkHTTP(ctx)\n\t\t}\n\t}\n\t// ==== GZIP HANDLER ====\n\t// The gzipHandler will serve a compress request only if the client request it with headers (Content-Type: gzip, deflate)\n\tgzipHandler := fasthttp.CompressHandlerLevel(m, fasthttp.CompressBestSpeed) // Compress data before sending (if requested by the client)\n\tlog.Info(\"HandleRequests | Binding services to @[\", cfg.Host, \":\", cfg.Port)\n\n\t// ==== SSL HANDLER + GZIP if requested ====\n\tif cfg.SSL.Enabled {\n\t\thttputils.ListAndServerSSL(cfg.Host, cfg.SSL.Path, cfg.SSL.Cert, cfg.SSL.Key, cfg.Port, gzipHandler)\n\t}\n\t// ==== Simple GZIP HANDLER ====\n\thttputils.ListAndServerGZIP(cfg.Host, cfg.Port, gzipHandler)\n\n\tlog.Trace(\"HandleRequests | STOP\")\n}", "func initCommon(c *cli.Context) {\n\tvar (\n\t\terr error\n\t\t//resp *resty.Response\n\t\tsession tls.ClientSessionCache\n\t)\n\tif err = configSetup(c); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Failed to read the configuration: \"+\n\t\t\t\"%s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t// setup our REST client\n\tClient = resty.New().SetRESTMode().\n\t\t//SetTimeout(Cfg.Run.TimeoutResty). XXX Bad client setting?\n\t\tSetDisableWarn(true).\n\t\tSetHeader(`User-Agent`, fmt.Sprintf(\"%s %s\", c.App.Name, c.App.Version)).\n\t\tSetHostURL(Cfg.Run.SomaAPI.String())\n\n\tif Cfg.Run.SomaAPI.Scheme == `https` {\n\t\tsession = tls.NewLRUClientSessionCache(64)\n\n\t\t// SetTLSClientConfig replaces, SetRootCertificate updates the\n\t\t// tls configuration - option ordering is important\n\t\tClient = Client.SetTLSClientConfig(&tls.Config{\n\t\t\tServerName: strings.SplitN(Cfg.Run.SomaAPI.Host, `:`, 2)[0],\n\t\t\tClientSessionCache: session,\n\t\t\tMinVersion: tls.VersionTLS12,\n\t\t\tMaxVersion: tls.VersionTLS12,\n\t\t\tCipherSuites: []uint16{\n\t\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\t},\n\t\t}).SetRootCertificate(Cfg.Run.CertPath)\n\t}\n\n\t/*\n\t\t// check configured API\n\t\tif resp, err = Client.R().Head(`/`); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error tasting the API endpoint: %s\\n\",\n\t\t\t\terr.Error())\n\t\t} else if resp.StatusCode() != 204 {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error, API Url returned %d instead of 204.\"+\n\t\t\t\t\" Sure this is SOMA?\\n\", resp.StatusCode())\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\t// check who we talked to\n\t\tif resp.Header().Get(`X-Powered-By`) != `SOMA Configuration System` {\n\t\t\tfmt.Fprintf(os.Stderr, `Just FYI, at the end of that API URL`+\n\t\t\t\t` is not SOMA`)\n\t\t\tos.Exit(1)\n\t\t}\n\t*/\n\n\t// embed configuration in boltdb wrapper\n\tstore.Configure(\n\t\tCfg.Run.PathBoltDB,\n\t\tos.FileMode(uint32(Cfg.Run.ModeBoltDB)),\n\t\t&bolt.Options{Timeout: Cfg.Run.TimeoutBoltDB},\n\t)\n\n\t// configure adm client library\n\tadm.ConfigureClient(Client)\n\tadm.ActivateAsyncWait(Cfg.AsyncWait)\n\tadm.AutomaticJobSave(Cfg.JobSave)\n\tadm.ConfigureCache(&store)\n}", "func main() {\n\tr := gin.New()\n\tr.Use(cors.Default())\n\n\t//r.GET(\"/email\", ctrl.GenEmail)\n\tr.GET(\"/gentax\", ctrl.GenTaxData)\n\n\tr.Run(\":8099\")\n}", "func main() {\n\t// flag.Parse()\n\t// args := flag.Args()\n\t// if len(args) < 1 {\n\t// \tfmt.Println(\"Please specify start page\") // if a starting page wasn't provided as an argument\n\t// \tos.Exit(1) // show a message and exit.\n\t// }\n\t// getBody(args[0])\n\tgetBody(\"https://ng.indeed.com/jobs-in-Lagos\")\n}", "func main() {\n\t// Submit the search and display the results.\n\tresults := search.Submit(\n\t\t\"golang\",\n\t\tsearch.OnlyFirst,\n\t\tsearch.Google,\n\t\tsearch.Bing,\n\t\tsearch.Yahoo,\n\t)\n\n\tfor _, result := range results {\n\t\tlog.Printf(\"main : Results : Info : %+v\\n\", result)\n\t}\n\n\t// This time we want to wait for all the results.\n\tresults = search.Submit(\n\t\t\"golang\",\n\t\tsearch.Google,\n\t\tsearch.Bing,\n\t\tsearch.Yahoo,\n\t)\n\n\tfor _, result := range results {\n\t\tlog.Printf(\"main : Results : Info : %+v\\n\", result)\n\t}\n}", "func main() {\n\tflag.Parse()\n\tfriskUrl := \"http://\" + *host + \"/v1/frisk/record\"\n\tlog.Println(\"Starting to put data in to frisk for app: \", *app)\n\tfor postCount := 1; postCount <= *posts; postCount++ {\n\t\tvar postRecords []map[string]interface{}\n\t\tfor entryCount := 1; entryCount <= *entries; entryCount++ {\n\t\t\t// Randomly select pass or fail\n\t\t\tresult := \"pass\"\n\t\t\tr := rand.Intn(2)\n\t\t\tlog.Println(\"RESULT: \", r)\n\t\t\tif r == 1 {\n\t\t\t\tresult = \"fail\"\n\t\t\t}\n\t\t\te := map[string]interface{}{\n\t\t\t\t\"title\": \"test-\" + strconv.Itoa(postCount) + \"-\" + strconv.Itoa(entryCount),\n\t\t\t\t\"tags\": map[string]string{\n\t\t\t\t\t\"app\": *app,\n\t\t\t\t\t\"project\": *project,\n\t\t\t\t\t\"result\": result,\n\t\t\t\t},\n\t\t\t}\n\t\t\tpostRecords = append(postRecords, e)\n\t\t}\n\t\t// Send payload to api\n\t\terr := postFrisk(friskUrl,postRecords)\n\t\tif err != nil {\n\t\t\tlog.Println(\"PostErr: \", err)\n\t\t}\n\t}\n}", "func synchRequest() {\n\n\tfmt.Println(\" Network: \", getLocalConfigValue(_LEDGER_NETWORK_KEY))\n\tok, err := pingServer(_LEDGER)\n\t//ok, err := pingServer(_ATLAS)\n\t//ok := false\n\tif ok {\n\t\t// things are good.\n\t\tfmt.Println(\" Current ledger node is ACTIVE at address:\", getLocalConfigValue(_LEDGER_ADDRESS_KEY))\n\t\treturn // done.\n\t}\n\n\t// could not successful access the current ledger node. Proceed to check for other nodes.\n\tfmt.Println(\" Default ledger node is NOT ACTIVE:\", getLocalConfigValue(_LEDGER_ADDRESS_KEY))\n\tfmt.Println(\" Searching for a new primary ledger node .....\")\n\n\t// Obtain current list of available ledger nodes from look up directory (atlas)\n\tnodeList, err := getLedgerNodeList()\n\tif err != nil {\n\t\tfmt.Println(\" \", err)\n\t\t// Suggest a fix for certain circumstances\n\t\tif strings.Contains(err.Error(), \"does not exist\") {\n\t\t\tfmt.Printf(\" You may need to set or update local config variable: '%s'\\n\", _LEDGER_NETWORK_KEY)\n\t\t\tfmt.Printf(\" To view local and global variables try: %s config --list\\n\", filepath.Base(os.Args[0]))\n\t\t}\n\t\treturn\n\t}\n\t// Check if list is empty\n\tif len(nodeList) == 0 {\n\t\tfmt.Printf(\" The network '%s' has no ledger nodes registered\\n\", getLocalConfigValue(_LEDGER_NETWORK_KEY))\n\t\treturn\n\t}\n\tnewNodeFound := false\n\tfor _, node := range nodeList {\n\t\tif newNodeFound {\n\t\t\tbreak // from for loop.\n\t\t}\n\t\t//fmt.Println(\" Checking node:\", node.APIURL)\n\t\tok, err := pingServer(node.APIURL)\n\t\tif err != nil {\n\t\t\t//fmt.Println(\" \", err)\n\t\t}\n\t\tif ok {\n\t\t\tnewNodeFound = true\n\t\t\tsetLocalConfigValue(_LEDGER_ADDRESS_KEY, node.APIURL)\n\t\t\tfmt.Printf(\" Found ACTIVE ledger node at: '%s'\\n\", node.APIURL)\n\t\t\tfmt.Println(\" UPDATING default ledger node in config to:\", node.APIURL)\n\t\t}\n\t}\n\tif newNodeFound == false {\n\t\tfmt.Printf(\" Not able to locate an active ledger node referring the %s directory\\n\", _ATLAS)\n\t}\n}", "func (t *Tester) doRequest(client *http.Client, item url_item.Item, numRequests int) {\n\tvar (\n\t\tnow = time.Now()\n\t\tnowSince = since(now)\n\t\tdnsStart time.Duration\n\t\tstartConn time.Duration\n\t\treqStart time.Duration\n\t\tdelayStart time.Duration\n\t\trespStart time.Duration\n\n\t\tresult = &requestResult{\n\t\t\turlKey: item.Url,\n\t\t\thost: item.Host,\n\t\t\toffset: nowSince,\n\t\t}\n\t)\n\n\treq, _ := http.NewRequestWithContext(t.shutdownCtx, t.conf.Method, item.Url, nil)\n\n\treq.Header.Set(acceptHeader, t.conf.AcceptHeaderRequest)\n\treq.Header.Set(userAgentHeader, t.conf.UserAgent)\n\n\ttrace := &httptrace.ClientTrace{\n\t\tDNSStart: func(info httptrace.DNSStartInfo) {\n\t\t\tdnsStart = since(now)\n\t\t},\n\t\tDNSDone: func(info httptrace.DNSDoneInfo) {\n\t\t\tresult.dnsDuration = since(now) - dnsStart\n\t\t},\n\t\tGetConn: func(h string) {\n\t\t\tstartConn = since(now)\n\t\t},\n\t\tGotConn: func(info httptrace.GotConnInfo) {\n\t\t\tif info.Reused {\n\t\t\t\tresult.connDuration = since(now) - startConn\n\t\t\t}\n\n\t\t\treqStart = since(now)\n\t\t},\n\t\tWroteRequest: func(info httptrace.WroteRequestInfo) {\n\t\t\tresult.reqDuration = since(now) - reqStart\n\t\t\tdelayStart = since(now)\n\t\t},\n\t\tGotFirstResponseByte: func() {\n\t\t\tresult.delayDuration = since(now) - delayStart\n\t\t\trespStart = since(now)\n\t\t},\n\t}\n\n\treq = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))\n\n\tresp, err := client.Do(req)\n\tresult.err = err\n\tswitch {\n\tcase err == nil:\n\t\tresult.statusCode = resp.StatusCode\n\t\t_ = resp.Body.Close()\n\tcase errors.Is(err, context.DeadlineExceeded):\n\t\tt.throttlingChecker.Throttle(item.Url, numRequests)\n\tcase os.IsTimeout(err):\n\t\tt.throttlingChecker.Throttle(item.Url, numRequests)\n\tdefault:\n\t\tt.throttlingChecker.Throttle(item.Url, numRequests)\n\t\tt.log.\n\t\t\tWithError(err).\n\t\t\tWithField(\"url\", item.Url).\n\t\t\tError(\"do request failed\")\n\t}\n\n\tfinishedDuration := since(now)\n\tresult.respDuration = finishedDuration - respStart\n\n\tresult.finishDuration = finishedDuration - nowSince\n\n\tt.reqResultCh <- result\n}", "func main() {\n\tdate := time.Now().AddDate(0, 0, -1)\n\tdates := \"year_\" + date.Format(\"2006/month_01/day_02\")\n\n\tmyTeamsMap := InitMyTeamsMap()\n\tgames := make(map[int][]string)\n\tgames = SearchMyMLBGames(dates, games, myTeamsMap)\n\n\tdownloadedGames := downloadMyMLBGames(games, myTeamsMap)\n\tlog.Printf(\"%v\", downloadedGames)\n\n\tpushBulletAPI := os.Getenv(\"pushBulletAPI\")\n\tlog.Printf(pushBulletAPI)\n\n\t// TODO3: prepare upload_urls per game\n\n\t// TODO4: upload games to pushbullet\n\n\t// TODO5: send file via pushbullet\n}", "func rootHandler(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(fmt.Sprintf(`\n<html>\n<head><title>Interview</title></head>\n<body>\n\n<h1>Interview</h1>\n\n<h3>Lite Version</h3>\nSimilar to the Full Version below, instead, we only need to grab the initial data and then validate the keys.\nWe want to keep a running total of the invalid and valid keys.\n\n\n<h3>Full Version</h3>\nCurl or go to <a href=\"http://localhost:%d/generate?count=10\">http://localhost:%d/generate?count=10</a>\n<br>\nFeel free to adjust count.\n<br><br>\nThe data you see is in the form:\n<br>\n<pre>\nB C\nAPIKEY FUNCTION STRING_A STRING_B\nAPIKEY FUNCTION STRING_A STRING_B\n</pre>\nWhere B is the name of the batch.\nC is the number of elements/work-items in this batch.\nEach work-item will have an api key that must be validated at /validate/apikey/:APIKEY.\n(This is where the lite version stops)\nNon valid api keys should not be allowed to request work to be processed.\nThese entries should report \"invalid\" as the solution.\n<br>\n<br>\nThe function can be one of the following:\n<br>\n%s: get the characters that appear in both strings and drop duplicates\n<br>\n%s: concat the two strings together and preserve order and drop duplicates\n<br>\n%s: concat the strings and sort them (assuming American English as the guide for letter priority) and drop duplicates\n<br>\n%s: take the even indexed letters from the first string and the odd indexed letters from the second string and drop duplicates\n<br>\n<br>\nEach batch can be verified for correctness by submitting to /validate/batch/:B with a post body where each line represents the solution to the corresponding work request.\n<br>\n<pre>\nExample (note: there are no duplicate characters in solutions):\n\nFoo 5\nsome-key intersection apples planes\nsome-other-key union apples planes\ninvalid-key union apples planes\nsome-key mangle apples planes\nsome-key unionsort apples planes\n\nSolution:\ncurl -X POST localhost:%d/validate/batch/Foo -d 'pes\naplesn\ninvalid\nalpnes\nadlnps\n'\n</pre>\n\n\n</body>\n</html>\n`, Port, Port, Intersection, Union, UnionSort, Mangle, Port)))\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 (conn *n1qlConn) doClientRequest(query string, requestValues *url.Values) (*http.Response, error) {\n\n\tstmtType := txStatementType(query)\n\tok := false\n\tfor !ok {\n\n\t\tvar request *http.Request\n\t\tvar err error\n\t\tvar selectedNode, numNodes int\n\t\tvar queryAPI string\n\t\tvar txParams map[string]string\n\n\t\t// select query API\n\t\tif conn.txid != \"\" && query != N1QL_DEFAULT_STATEMENT {\n\t\t\ttxParams = map[string]string{\"txid\": conn.txid, \"tximplicit\": \"\"}\n\t\t\tqueryAPI = conn.txService\n\t\t} else {\n\t\t\tif stmtType == TX_START && TxTimeout != \"\" {\n\t\t\t\ttxParams = map[string]string{\"txtimeout\": TxTimeout}\n\t\t\t}\n\t\t\trand.Seed(time.Now().Unix())\n\t\t\tnumNodes = len(conn.queryAPIs)\n\n\t\t\tselectedNode = rand.Intn(numNodes)\n\t\t\tconn.lock.RLock()\n\t\t\tqueryAPI = conn.queryAPIs[selectedNode]\n\t\t\tconn.lock.RUnlock()\n\t\t}\n\n\t\tif query != \"\" {\n\t\t\trequest, err = prepareRequest(query, queryAPI, nil, txParams)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\tif requestValues != nil {\n\t\t\t\trequest, _ = http.NewRequest(\"POST\", queryAPI, bytes.NewBufferString(requestValues.Encode()))\n\t\t\t} else {\n\t\t\t\trequest, _ = http.NewRequest(\"POST\", queryAPI, nil)\n\t\t\t}\n\t\t\trequest.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t\t\tsetCBUserAgent(request)\n\t\t\tif hasUsernamePassword() {\n\t\t\t\trequest.SetBasicAuth(username, password)\n\t\t\t}\n\t\t}\n\n\t\tresp, err := conn.client.Do(request)\n\t\tif err != nil {\n\t\t\t// if this is the last node return with error\n\t\t\tif conn.txService != \"\" || numNodes == 1 {\n\t\t\t\tconn.SetTxValues(\"\", \"\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// remove the node that failed from the list of query nodes\n\t\t\tconn.lock.Lock()\n\t\t\tconn.queryAPIs = append(conn.queryAPIs[:selectedNode], conn.queryAPIs[selectedNode+1:]...)\n\t\t\tconn.lock.Unlock()\n\t\t\tcontinue\n\t\t} else {\n\t\t\tif stmtType == TX_START {\n\t\t\t\ttxid := getTxid(resp)\n\t\t\t\tif txid != \"\" {\n\t\t\t\t\tconn.SetTxValues(txid, queryAPI)\n\t\t\t\t}\n\t\t\t} else if stmtType == TX_COMMIT || stmtType == TX_ROLLBACK {\n\t\t\t\tconn.SetTxValues(\"\", \"\")\n\t\t\t}\n\t\t\treturn resp, nil\n\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"N1QL: Query nodes not responding\")\n}", "func RequestForAPI(req *http.Request)(*http.Response, error) {\n\t\tclient := &http.Client{}\n\n\tclient = &http.Client{\n\t\tTimeout: time.Second * time.Duration(1500),\n\t}\n\tresp, clientErr := client.Do(req)\n\tif clientErr != nil {\n\t\tlogger.WithField(\"error from api\", clientErr.Error()).Error(\"Get Request Failed\")\n\t\treturn nil, clientErr\n\t}\n\tif resp.StatusCode != 200 {\n\t\tlogger.WithField(\"error from api\", resp).Error(\"Get Request Failed\")\n\t\treturn nil, clientErr\n\t}\n\treturn resp, clientErr\n}", "func (r *request) run(path string) {\n\tfmt.Println(\"run: \", path)\n\t//notebook\n\tread(path, r)\n\tbyteArray, err := json.Marshal(*r)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t//Wait for API is ready\n\tfor i := 0; i < 30; i++ {\n\t\tresponse, err := http.Post(\"http://localhost:\"+r.port+\"/api/v1/job\", \"application/json\", bytes.NewReader(byteArray))\n\t\tif err == nil {\n\t\t\tfmt.Println(r.port, response.StatusCode)\n\t\t\tbreak\n\t\t} else {\n\t\t\tfmt.Println(r.port, \"Wait for API is ready.\")\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n}", "func main() {\n\t//TODO:Add support similar to GNU getopts, http://goo.gl/Cp6cIg\n\tif len(os.Args) < 2{\n\t\tfmt.Println(\"Usage: go run LedgerStressTwoCliOnePeer.go Utils.go <http://IP:PORT>\")\n\t\treturn;\n\t}\n\t//TODO: Have a regular expression to check if the give argument is correct format\n\tif !strings.Contains(os.Args[1], \"http://\") {\n\t\tfmt.Println(\"Error: Argument submitted is not right format ex: http://127.0.0.1:5000 \")\n\t\treturn;\n\t}\n\t//Get the URL\n\turl := os.Args[1]\n\n\t// time to messure overall execution of the testcase\n\tdefer TimeTracker(time.Now(), \"Total execution time for LedgerStressTwoCliTwoPeer.go \")\n\n\tInit()\n\tInvokeLoop()\n\ttearDown(url);\n}", "func main() {\n\n\tconst tpl = `<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n\t<list response=\"get_list\" type=\"pb\" reqid=\"22AB2\" total=\"{{.Nb_item}}\" first=\"1\" last=\"{{.Nb_item}}\">\n\t <entry id=\"{{.Record.Id}}\">\n\t <ln>{{.Record.Firstname}}</ln>\n\t <fn>{{.Record.Lastname}}</fn>\n\t <hm>{{.Record.Phonenumber}}</hm>\n\t </entry>\n\t</list>\n`\n\n\tphonebook := readCsv(os.Args[1])\n\n\t// phonebook service\n\thttp.HandleFunc(\"/\", func (w http.ResponseWriter, r *http.Request) {\n\n fmt.Printf(html.EscapeString(r.URL.Path))\n\n a := [3]string{\"command\", \"type\", \"hm\"}\n\n params, err:= checkParameter(a, r)\n if err == nil {\n if params[\"command\"] == \"get_list\" && params[\"type\"] == \"pb\" {\n\t\t\t\trecord,err := getRecord(params[\"hm\"], phonebook)\n\t\t\t\tif err == nil {\n\t\t\t\t\tdata := Tpldata{ Record: record, Nb_item: len(phonebook) }\n\t\t\t\t\tt := template.New(\"tpl\")\n\t\t\t\t\tt, err := t.Parse(tpl)\n\t\t\t\t\tif err == nil{\n\t\t\t\t\t\t err := t.Execute(w, data)\n\t\t\t\t\t\t if err != nil{\n\t\t\t\t\t\t\t log.Fatal(\"==> can't execute template\", err)\n\t\t\t\t\t\t }\n\t\t\t\t\t}else{\n\t\t\t\t\t\tlog.Fatal(\"==> can't create template\", err)\n\t\t\t\t\t}\n\t\t\t\t}else{\n \tlog.Fatal(\"==> number not found\")\n\t\t\t\t}\n }else{\n log.Fatal(\"==> params not handled\")\n }\n }\n\t})\n\n\t// launch deamon\n\terr := http.ListenAndServe(\":\"+os.Args[2], nil)\n if err != nil {\n fmt.Printf(\"ListenAndServe:\", err,\"\\n\")\n }\n}", "func processRequest(req *CustomProtocol.Request) {\n\n\tpayload := CustomProtocol.ParsePayload(req.Payload)\n\tswitch req.OpCode {\n\tcase CustomProtocol.ActivateGPS:\n\t\tflagStolen(\"gps\", payload[0])\n\t\tres := make([]byte, 2)\n\t\tres[0] = 1\n\t\treq.Response <- res\n\tcase CustomProtocol.FlagStolen:\n\t\tflagStolen(\"laptop\", payload[0])\n\t\tres := make([]byte, 2)\n\t\tres[0] = 1\n\t\treq.Response <- res\n\tcase CustomProtocol.FlagNotStolen:\n\t\t//TODO: temp fix < 12\n\t\tif len(payload[0]) < 12 {\n\t\t\tflagNotStolen(\"gps\", payload[0])\n\t\t} else {\n\t\t\tflagNotStolen(\"laptop\", payload[0])\n\t\t}\n\t\tres := make([]byte, 2)\n\t\tres[0] = 1 //TO DO CHANGE\n\t\treq.Response <- res\n\tcase CustomProtocol.NewAccount:\n\t\tSignUp(payload[0], payload[1], payload[2], payload[3], payload[4])\n\t\tres := make([]byte, 2)\n\t\tres[0] = 1\n\t\treq.Response <- res\n\tcase CustomProtocol.NewDevice:\n\t\tregisterNewDevice(payload[0], payload[1], payload[2], payload[3])\n\t\tres := make([]byte, 2)\n\t\tres[0] = 1\n\t\treq.Response <- res\n\tcase CustomProtocol.UpdateDeviceGPS:\n\t\tupdated := updateDeviceGps(payload[0], payload[1], payload[2])\n\t\tres := make([]byte, 2)\n\t\tif updated == true {\n\t\t\tres[0] = 1\n\t\t} else {\n\t\t\tres[0] = 0\n\t\t}\n\t\treq.Response <- res\n\tcase CustomProtocol.VerifyLoginCredentials:\n\t\taccountValid, passwordValid := VerifyAccountInfo(payload[0], payload[1])\n\t\tres := make([]byte, 2)\n\t\tif accountValid {\n\t\t\tres[0] = 1\n\t\t\tif passwordValid {\n\t\t\t\tres[1] = 1\n\t\t\t} else {\n\t\t\t\tres[0] = 0\n\t\t\t}\n\t\t} else {\n\t\t\tres[0] = 0\n\t\t\tres[1] = 0\n\t\t}\n\t\treq.Response <- res\n\tcase CustomProtocol.SetAccount:\n\t\taccSet := updateAccountInfo(payload[0], payload[1], payload[2])\n\t\tres := make([]byte, 1)\n\t\tif accSet == true {\n\t\t\tres[0] = 1\n\t\t} else {\n\t\t\tres[0] = 0\n\t\t}\n\t\treq.Response <- res\n\tcase CustomProtocol.GetDevice:\n\t\tres := make([]byte, 5)\n\n\t\tif payload[0] == \"gps\" {\n\t\t\tres = getGpsDevices(payload[1])\n\t\t} else if payload[0] == \"laptop\" {\n\t\t\tres = getLaptopDevices(payload[1])\n\t\t} else {\n\t\t\tfmt.Println(\"CustomProtocol.GetDevice payload[0] must be either gps or laptop\")\n\t\t}\n\t\treq.Response <- res\n\tcase CustomProtocol.SetDevice:\n\tcase CustomProtocol.GetDeviceList:\n\t\tres := []byte{}\n\t\tres = append(res, getLaptopDevices(payload[0])...)\n\t\tres = append(res, 0x1B)\n\t\tres = append(res, getGpsDevices(payload[0])...)\n\t\treq.Response <- res\n\tcase CustomProtocol.CheckDeviceStolen:\n\t\tisStolen := IsDeviceStolen(payload[0])\n\t\tres := make([]byte, 1)\n\t\tif isStolen == true {\n\t\t\tres[0] = 1\n\t\t} else {\n\t\t\tres[0] = 0\n\t\t}\n\t\treq.Response <- res\n\tcase CustomProtocol.UpdateUserKeylogData:\n\t\tboolResult := UpdateKeylog(payload[0], payload[1])\n\t\tres := make([]byte, 1)\n\t\tif boolResult == true {\n\t\t\tres[0] = 1\n\t\t} else {\n\t\t\tres[0] = 0\n\t\t}\n\t\treq.Response <- res\n\tcase CustomProtocol.UpdateUserIPTraceData:\n\t\tboolResult := UpdateTraceRoute(payload[0], payload[1])\n\t\tres := make([]byte, 1)\n\t\tif boolResult == true {\n\t\t\tres[0] = 1\n\t\t} else {\n\t\t\tres[0] = 0\n\t\t}\n\t\treq.Response <- res\n\tdefault:\n\t}\n}", "func (r *Runner) Request(req *http.Request, args *rpc.TestRequest, resp *rpc.RunTest) (err error) {\n\t//make sure its for the id we're managing\n\tif args.ID != r.task.ID {\n\t\terr = rpc.Errorf(\"unknown ID: %s\", args.ID)\n\t\treturn\n\t}\n\n\t//ensure the index is ok\n\tif args.Index < 0 || len(r.task.Tests) <= args.Index {\n\t\terr = rpc.Errorf(\"invalid index: %d not in [0, %d)\", args.Index, len(r.task.Tests))\n\t\treturn\n\t}\n\n\t//set the response\n\t*resp = r.task.Tests[args.Index]\n\treturn\n}", "func main() {\n\thandleRequests := func(w http.ResponseWriter, r *http.Request) {\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err == nil {\n\t\t\tbuf := bytes.NewBuffer(body).String()\n\n\t\t\tif handleMtSupporteMethods(buf, w) {\n\t\t\t\treturn\n\t\t\t} else if handleMetaWeblogGetRecentPosts(buf, w) {\n\t\t\t\treturn\n\t\t\t} else if handleMetaWeblogNewPost(buf, w) {\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Not a known method call %s\", buf)\n\t\t\t\t// return error\n\t\t\t\tio.WriteString(w, \"<?xml version=\\\"1.0\\\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>-32601</int></value></member><member><name>faultString</name><value><string>server error. requested method not found</string></value></member></struct></value></fault></methodResponse>\")\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(err)\n\t\t\tio.WriteString(w, \"<?xml version=\\\"1.0\\\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>-32601</int></value></member><member><name>faultString</name><value><string>server error. requested method not found</string></value></member></struct></value></fault></methodResponse>\")\n\t\t}\n\t}\n\n\thttp.HandleFunc(\"/xmlrpc.php\", handleRequests)\n\n\tlog.Println(\"Starting XML-RPC server on localhost:80/xmlrpc.php\")\n\tlog.Fatal(http.ListenAndServe(\":80\", nil))\n}", "func (c *Client) doRequest(method, api string, reqbody, out interface{}) error {\n\treq, err := c.createRequest(method, api, reqbody)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// request\n\tvar resp *http.Response\n\tif method == \"POST\" || method == \"PUT\" {\n\t\tresp, err = c.HttpClient.Do(req)\n\t} else {\n\t\tresp, err = c.doRequestWithRetries(req)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tre := regexp.MustCompile(`\\r?\\n`)\n\t\tout := re.ReplaceAllString(string(body), \" \")\n\t\treturn newError(resp.StatusCode, api, out)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If we got no body, by default let's just make an empty JSON dict.\n\tif len(body) == 0 {\n\t\tbody = []byte{'{', '}'}\n\t}\n\n\tif strings.Contains(api, \"JSSResource\") {\n\t\terr = xml.Unmarshal(body, out)\n\t} else {\n\t\terr = json.Unmarshal(body, out)\n\t}\n\n\treturn err\n}", "func makeGetRequest(subpath string, attempt int16) ([]byte, error) {\n\tresponse, httpErr := http.Get(BASE_URL + subpath)\n\n\tlog.Printf(\"URL is %s\", BASE_URL+subpath)\n\tif httpErr != nil {\n\t\treturn nil, httpErr\n\t} else {\n\t\tswitch response.StatusCode {\n\t\tcase 200:\n\t\t\treturn readBody(response)\n\t\tcase 400:\n\t\t\tbody, readErr := readBody(response)\n\t\t\tif readErr != nil {\n\t\t\t\treturn nil, readErr\n\t\t\t} else {\n\t\t\t\tbodyString := string(body)\n\t\t\t\terrMsg := fmt.Sprintf(\"API returned bad data: %s\", bodyString)\n\t\t\t\treturn nil, errors.New(errMsg)\n\t\t\t}\n\t\tcase 403:\n\t\t\tbody, readErr := readBody(response)\n\t\t\tif readErr != nil {\n\t\t\t\treturn nil, readErr\n\t\t\t} else {\n\t\t\t\tbodyString := string(body)\n\t\t\t\terrMsg := fmt.Sprintf(\"API returned permission denied: %s\", bodyString)\n\t\t\t\treturn nil, errors.New(errMsg)\n\t\t\t}\n\t\tcase 500:\n\t\tcase 502:\n\t\tcase 503:\n\t\tcase 504:\n\t\t\tbody, readErr := readBody(response)\n\t\t\tif readErr != nil {\n\t\t\t\treturn nil, readErr\n\t\t\t} else {\n\t\t\t\tbodyString := string(body)\n\t\t\t\tlog.Printf(\"{%d/%d}: API returned server error, retrying in 3s: %s\", attempt, MAX_ATTEMPTS, bodyString)\n\t\t\t\ttime.Sleep(3 * time.Second)\n\t\t\t\tif attempt >= MAX_ATTEMPTS {\n\t\t\t\t\treturn nil, errors.New(\"failed after exhausting retries\")\n\t\t\t\t}\n\t\t\t\treturn makeGetRequest(subpath, attempt+1)\n\t\t\t}\n\t\tdefault:\n\t\t\tbody, readErr := readBody(response)\n\t\t\tif readErr != nil {\n\t\t\t\treturn nil, readErr\n\t\t\t} else {\n\t\t\t\tbodyString := string(body)\n\t\t\t\terrMsg := fmt.Sprintf(\"API returned unexpected status %d: %s\", response.StatusCode, bodyString)\n\t\t\t\treturn nil, errors.New(errMsg)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, errors.New(\"internal error, should not reach this point\")\n}", "func sendRequest(cmd *cobra.Command, args []string) {\n\tswitch args[0] {\n\tcase \"item\":\n\t\turls := buildURLs(itemAddr, args[1:]...)\n\t\tdone := distributeRequests(urls...)\n\t\tfor i := 0; i < len(urls); i++ {\n\t\t\t<-done\n\t\t}\n\n\tcase \"order\":\n\t\turls := buildURLs(orderAddr, args[1:]...)\n\t\tdone := distributeRequests(urls...)\n\t\tfor i := 0; i < len(urls); i++ {\n\t\t\t<-done\n\t\t}\n\n\tcase \"all\":\n\t\turls := []string{}\n\t\turls = append(urls, buildURLs(itemAddr, args[1:]...)...)\n\t\turls = append(urls, buildURLs(orderAddr, args[1:]...)...)\n\t\trand.Shuffle(len(urls), func(i, j int) {\n\t\t\turls[i], urls[j] = urls[j], urls[i]\n\t\t})\n\n\t\tdone := distributeRequests(urls...)\n\t\tfor j := 0; j < len(urls); j++ {\n\t\t\t<-done\n\t\t}\n\t}\n}", "func main(){\n\tr := gin.Default()\n\tr.GET(\"/get/last/:n\", func (c* gin.Context){\n\t\ti, err := strconv.Atoi(c.Param(\"n\"))\n\t\tif err !=nil || i < 0 && i > 10 {\n\t\t\tc.JSON(400,\"Error: Invalid parameter\")\n\t\t\treturn\n\t\t}\n\t\tvar result string\n\t\tvar d1 int\n\t\tvar d2 int\n\t\tvar d3 int\n\t\tvar d4 int\n\t\tdb:=openDatabase()\n\t\trows, _ := db.Query(\"SELECT d1,d2,d3,d4 FROM simu_device ORDER BY id DESC limit ?;\",i)\n\t\tfor rows.Next(){\n\t\t\trows.Scan(&d1,&d2,&d3,&d4)\n\t\t\tresult = result + fmt.Sprintf(\"[%s,%s,%s,%s]\",strconv.Itoa(d1),strconv.Itoa(d2),strconv.Itoa(d3),strconv.Itoa(d4))\n\t\t}\n\t\tdb.Close()\n\t\tc.JSON(200,result)\n\t})\n\tr.GET(\"/get/lastv/:n\" , func (c* gin.Context){\n\t\ti, err := strconv.Atoi(c.Param(\"n\"))\n\t\tif err !=nil || i < 0 && i > 10 {\n\t\t\tc.JSON(400,\"Error: Invalid parameter\")\n\t\t\treturn\n\t\t}\n\t\tbody, err := ioutil.ReadAll(c.Request.Body)\n\t\targs:= strings.Split(string(body),\",\")\n\t\tdb:= openDatabase()\n\t\tvar result string\n\t\tvar val int\n\t\tfor v :=range args{\n\t\t\tif args[v] == \"d1\" ||args[v] == \"d2\" ||args[v] == \"d3\" || args[v] == \"d4\" {\n\t\t\t\tq := \"SELECT \" + args[v] + \" FROM simu_device ORDER BY id DESC limit ?;\"\n\t\t\t\trows, err := db.Query(q, i)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(400,\"Error: Query malformed\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tresult = result + fmt.Sprintf(\"[%s:\", args[v])\n\t\t\t\tfor rows.Next() {\n\t\t\t\t\trows.Scan(&val)\n\t\t\t\t\tresult = result + fmt.Sprintf(\"%d,\", val)\n\t\t\t\t}\n\t\t\t\tresult = result + fmt.Sprintf(\"] \")\n\t\t\t}\n\t\t}\n\t\tdb.Close()\n\t\tc.JSON(200,result)\n\t})\n\tr.GET(\"/get/avg\" , func (c* gin.Context){\n\t\tbody, err := ioutil.ReadAll(c.Request.Body)\n\t\tif err!=nil {\n\t\t\tc.JSON(400, \"Error: Body malformed\")\n\t\t\treturn\n\t\t}\n\t\targs:= strings.Split(string(body),\",\")\n\t\tdb:= openDatabase()\n\t\tvar result string\n\t\tvar avg float64\n\t\tfor v :=range args{\n\t\t\tif args[v] == \"d1\" ||args[v] == \"d2\" ||args[v] == \"d3\" || args[v] == \"d4\" {\n\t\t\t\trows, err := db.Query(\"SELECT avg(\"+args[v]+\") as avg_val FROM simu_device;\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.JSON(400,\"Error: Query malformed\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tresult = result + fmt.Sprintf(\"[Avg %s:\",args[v])\n\t\t\t\tfor rows.Next(){\n\t\t\t\t\trows.Scan(&avg)\n\t\t\t\t\tresult = result + fmt.Sprintf(\"%f] \",avg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdb.Close()\n\t\tc.JSON(200,result)\n\t})\n\tr.Run(\":8008\")\n}", "func processAPIReq(c net.Conn) {\n\tfor {\n\t\tbuf := make([]byte, 512)\n\t\tnr, err := c.Read(buf)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tdata := buf[0:nr]\n\n\t\t// deal with the command\n\t\tcmd := string(data)\n\t\tcmd = strings.TrimSpace(cmd)\n\t\terr = CmdHandler(cmd)\n\t\tCliPrintInfo(\"emp3r0r received %s\", strconv.Quote(cmd))\n\t\tif err != nil {\n\t\t\tCliPrintError(\"Command failed: %v\", err)\n\t\t}\n\t}\n}", "func request(client *http.Client, l interface{}, p interface{}) (*http.Response, error) {\n\n\tlj, err := json.Marshal(l)\n\tpj, err := json.Marshal(p)\n\t// goLog.Trace.Println(err, p, string(pj))\n\tif err == nil {\n\t\tmyreq := [][]byte{[]byte(AG), []byte(HELLO), []byte(V), lj, []byte(V), pj, []byte(AD)}\n\t\trequest := bytes.Join(myreq, []byte(\"\"))\n\t\tif !Test {\n\t\t\treturn PostRequest(client, request)\n\t\t} else {\n\t\t\treturn nil, errors.New(\"Post cancelled due to -test flag true\")\n\t\t}\n\t} else {\n\t\treturn nil, err\n\t}\n\n}", "func main() {\n\tvar argsLength int\n\tif len(os.Args) > 0 {\n\t\targsLength = len(os.Args)\n\t\targsContent := \"\"\n\t\tfor i := 0; i < argsLength; i++ {\n\t\t\targsContent += os.Args[i] + \" \"\n\t\t}\n\t\tfmt.Println(argsContent)\n\t}\n\n\t// parse flags\n\tflag.Parse()\n\n\t// if user does not supply flags, print usage\n\tif flag.NFlag() == 0 {\n\t\tprintUsage()\n\t}\n\tif publi != \"\" {\n\t\tDisplayPublications(publi)\n\t}\n\n\tif osTool != \"\" {\n\t\tListOSTools()\n\t}\n\n\tif docker == \"l\" || docker == \"list\" {\n\t\tListContainer()\n\t}\n\t// ReadSettingsFile()\n\tlistLocalAddresses(netw, ip)\n\n\tif proj != \"\" {\n\t\tproj := cleanQuotes(proj)\n\t\tfolders.currentFolder = \".\" + dir + \"/\" + proj + \"/\"\n\t\tfolders.connectors = folders.currentFolder + \"connectors/\"\n\t\tfolders.controllers = folders.currentFolder + \"controllers/\"\n\t\tfolders.models = folders.currentFolder + \"models/\"\n\t\tfolders.test = folders.currentFolder + \"test/\"\n\t\tfolders.public = folders.currentFolder + \"public/\"\n\n\t\tfilenames.gitignore = \".gitignore\"\n\t\tfilenames.abstractModelFile = \"AbstractModel.js\"\n\t\tfilenames.abstractControllerFile = \"Abstract.js\"\n\t\tfilenames.healthControllerFile = \"HealthController.js\"\n\t\tfilenames.indexFile = \"index.js\"\n\t\tfilenames.packageJSON = \"package.json\"\n\t\tfilenames.readme = \"README.md\"\n\t\tfilenames.serverFile = \"Server.js\"\n\t\tfilenames.storeMock = \"store-mock.json\"\n\t\tfilenames.testControllerFile = \"testController.js\"\n\t\tfilenames.apiTests = \"apiTests.js\"\n\t\tfilenames.empty = \"EMPTY\"\n\t\tfolders.write(proj)\n\t}\n\n\tif reddit != \"\" {\n\t\treddit := cleanQuotes(reddit)\n\t\tif com != \"\" {\n\t\t\tcom := cleanQuotes(com)\n\t\t\tcoms := getRedditComments(com)\n\t\t\tfmt.Printf(\"Searching reddit comments ID: %s\\n\", com)\n\t\t\tfor _, res := range coms {\n\t\t\t\tfor _, result := range res.Data.Children {\n\t\t\t\t\tif result.Data.Selftext != \"\" {\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfmt.Println(`Date: `, GetDateFromTimeStamp(result.Data.CreatedUTC))\n\t\t\t\t\t\t\tfmt.Println(`Author: `, result.Data.Author)\n\t\t\t\t\t\t\tfmt.Println(`PostId: `, result.Data.ID)\n\t\t\t\t\t\t\tfmt.Println(`PostContent: `, result.Data.Selftext)\n\t\t\t\t\t\t\tfmt.Println(`*************************** Post ***************************`)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if result.Data.Body != \"\" {\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfmt.Println(`Date: `, GetDateFromTimeStamp(result.Data.CreatedUTC))\n\t\t\t\t\t\t\tfmt.Println(`Author: `, result.Data.Author)\n\t\t\t\t\t\t\tfmt.Println(`PostId: `, result.Data.ID)\n\t\t\t\t\t\t\tfmt.Println(`CommentContent: `, result.Data.Body)\n\t\t\t\t\t\t\tfmt.Println(`************************ Comments **************************`)\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} else {\n\t\t\tfmt.Printf(\"Searching reddit post(s): %s\\n\", reddit)\n\t\t\tposts := getRedditPosts(reddit)\n\t\t\tfor _, result := range posts.Data.Children {\n\t\t\t\tif result.Data.Selftext != \"\" {\n\t\t\t\t\tfmt.Printf(\"Searching reddit post(s): %s\\n\", com)\n\t\t\t\t\t{\n\t\t\t\t\t\tfmt.Println(`Date: `, GetDateFromTimeStamp(result.Data.CreatedUTC))\n\t\t\t\t\t\tfmt.Println(`Author: `, result.Data.Author)\n\t\t\t\t\t\tfmt.Println(`PostId: `, result.Data.ID)\n\t\t\t\t\t\tfmt.Println(`PostContent: `, result.Data.Selftext)\n\t\t\t\t\t\tfmt.Println(`************************** Posts ***************************`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// if multiple users are passed separated by commas, store them in a \"users\" array\n\tif movie != \"\" {\n\t\tDisplayMoviesByName(movie)\n\t}\n\n\t// if multiple users are passed separated by commas, store them in a \"users\" array\n\tif user != \"\" {\n\t\tusers := strings.Split(user, \",\")\n\t\tif repo != \"\" {\n\t\t\tfmt.Printf(\"Searching [%s]'s repo(s): \\n\", user)\n\t\t\tres := getRepos(user)\n\t\t\tfor _, result := range res.Repos {\n\t\t\t\tfmt.Println(\"****************************************************\")\n\t\t\t\tfmt.Println(`Name: `, result.Name)\n\t\t\t\tfmt.Println(`Private: `, result.Private)\n\t\t\t\t// fmt.Println(`HTMLURL: `, result.HTMLURL)\n\t\t\t\tfmt.Println(`Description: `, result.Description)\n\t\t\t\t// fmt.Println(`Created_at: `, result.CreatedAt)\n\t\t\t\tfmt.Println(`Updated_at: `, result.UpdatedAt)\n\t\t\t\tfmt.Println(`Git_url: `, result.GitURL)\n\t\t\t\tfmt.Println(`Size: `, result.Size)\n\t\t\t\tfmt.Println(`Language: `, result.Language)\n\t\t\t\t// fmt.Println(`Open_issues_count: `, result.Open_issues_count)\n\t\t\t\t// fmt.Println(`Forks: `, result.Forks)\n\t\t\t\t// fmt.Println(`Watchers: `, result.Watchers)\n\t\t\t\t// fmt.Println(`DefaultBranch: `, result.DefaultBranch)\n\t\t\t\tfmt.Println(`ID: `, result.ID)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Printf(\"Searching user(s): %s\\n\", users)\n\t\t\tif len(users) > 0 {\n\t\t\t\tfor _, u := range users {\n\t\t\t\t\tresult := getUsers(u)\n\t\t\t\t\tfmt.Println(`Username: `, result.Login)\n\t\t\t\t\tfmt.Println(`Name: `, result.Name)\n\t\t\t\t\tfmt.Println(`Email: `, result.Email)\n\t\t\t\t\tfmt.Println(`Bio: `, result.Bio)\n\t\t\t\t\tfmt.Println(`Location: `, result.Location)\n\t\t\t\t\tfmt.Println(`CreatedAt: `, result.CreatedAt)\n\t\t\t\t\tfmt.Println(`UpdatedAt: `, result.UpdatedAt)\n\t\t\t\t\tfmt.Println(`ReposURL: `, result.ReposURL)\n\t\t\t\t\tfmt.Println(`Followers: `, result.Followers)\n\t\t\t\t\tfmt.Println(`GistsURL: `, result.GistsURL)\n\t\t\t\t\tfmt.Println(`Hireable: `, result.Hireable)\n\t\t\t\t\tfmt.Println(\"******************* Statistics *********************\")\n\t\t\t\t\tif len(result.Stats) > 0 {\n\t\t\t\t\t\tfor stat, i := range result.Stats {\n\t\t\t\t\t\t\tformatSpacedStringWithItoa(stat, i)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Println(\"****************************************************\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// if multiple users are passed separated by commas, store them in a \"users\" array\n\tif news != \"\" {\n\t\tDisplayNews(news, category, x)\n\t}\n\n\tif img != \"\" {\n\t\tDisplayASCIIFromLocalFile(img, x)\n\t}\n\n\tif city != \"\" {\n\t\tcity = cleanQuotes(city)\n\t\tDisplayWeather(city)\n\t}\n}", "func main() {\n\tfastestResponse := multipleQuery()\n\tfmt.Println(fastestResponse)\n}", "func RequestMultiple(hashes hornet.Hashes, msIndex milestone.Index, preventDiscard ...bool) int {\n\trequested := 0\n\tfor _, hash := range hashes {\n\t\tif Request(hash, msIndex, preventDiscard...) {\n\t\t\trequested++\n\t\t}\n\t}\n\treturn requested\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 Request(method string, body interface{}, isJSON bool, res interface{}, token string) error {\n\tvar data []byte\n\tvar err error\n\n\tif isJSON {\n\t\tdata, err = json.Marshal(body)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Request Failed, could not create JSON payload\")\n\t\t}\n\t} else {\n\t\tv, err := query.Values(body)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Request Failed, could not create URLEncoded payload\")\n\t\t}\n\n\t\tdata = []byte(v.Encode())\n\t}\n\n\turl := SLACK_API_ROOT + \"/\" + method\n\treq, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(data))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Request Failed, could not create request\")\n\t}\n\n\tif isJSON {\n\t\treq.Header.Add(\"Content-Type\", \"application/json;charset=utf8\")\n\t} else {\n\t\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t}\n\n\tif token != \"\" {\n\t\treq.Header.Add(\"Authorization\", \"Bearer \"+token)\n\t}\n\n\tapires, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Request Failed, could not send request\")\n\t}\n\n\tdefer apires.Body.Close()\n\n\trawres, err := ioutil.ReadAll(apires.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Request Failed, could not read response\")\n\t}\n\n\tstat := &status{}\n\n\tif err := json.Unmarshal(rawres, stat); err != nil {\n\t\treturn errors.Wrap(err, \"Request Failed, could not unmarshal received response type\")\n\t}\n\n\tif !stat.Ok {\n\t\tse := &Error{}\n\n\t\tif err := json.Unmarshal(rawres, se); err != nil {\n\t\t\treturn errors.Wrap(err, \"Request Failed, received response was not OK\")\n\t\t}\n\n\t\treturn se\n\t}\n\n\tif res != nil {\n\t\tif err := json.Unmarshal(rawres, res); err != nil {\n\t\t\treturn errors.Wrap(err, \"Request Failed, could not unmarshal received response\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func main() {\n\tif len(os.Args) < 2 {\n\t\tfmt.Println(\"usage : ./webscraper link1 link2 ...\")\n\t\treturn\n\t}\n\tinputURLs := os.Args[1:]\n\tgetLinks(inputURLs)\n\n}", "func checkRequest(httpClient *dphttp.ClienterMock, callIndex int, expectedMethod, expectedURI string, expectedIfMatch string) {\n\tSo(httpClient.DoCalls()[callIndex].Req.URL.RequestURI(), ShouldEqual, expectedURI)\n\tSo(httpClient.DoCalls()[callIndex].Req.Method, ShouldEqual, http.MethodPatch)\n\tSo(httpClient.DoCalls()[callIndex].Req.Header.Get(dprequest.AuthHeaderKey), ShouldEqual, \"Bearer \"+testServiceToken)\n\tactualIfMatch := httpClient.DoCalls()[callIndex].Req.Header.Get(\"If-Match\")\n\tSo(actualIfMatch, ShouldResemble, expectedIfMatch)\n}", "func Main(client *http.Client, opts Options) (err error) {\n\t// Load brigades.json\n\tbrigadeMap, err := loadBrigades(opts.Brigades, client)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Create other objects required by the Create function\n\tvar prevVehicles map[string]*Vehicle\n\tapi := VehicleAPI{Key: opts.Apikey, Client: client}\n\n\t// Call Create\n\t_, err = Create(api, brigadeMap, prevVehicles, opts)\n\treturn\n}", "func configRequest() {\n\t// if there are no other arguments then display help.\n\tif len(os.Args[1:]) == 1 {\n\t\t// Display help\n\t\tfmt.Println(_CONFIG_HELP_CONTENT)\n\t\treturn\n\t}\n\tswitch strings.ToLower(os.Args[2]) {\n\tcase \"--alias\", \"-a\":\n\t\tif len(os.Args[3:]) < 2 {\n\t\t\tfmt.Println(\"Error: Expecting additional arguments.\")\n\t\t\treturn\n\t\t}\n\t\tswitch strings.ToLower(os.Args[3]) {\n\t\tcase \"--set\", \"-s\":\n\t\t\tif len(os.Args[4:]) < 2 {\n\t\t\t\tfmt.Println(\"Error: Expecting additional argument: <value>\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetAlias(os.Args[4], os.Args[5])\n\t\tcase \"--get\", \"-g\":\n\t\t\tvalue, err := getAlias(os.Args[4])\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t} else {\n\t\t\t\tfmt.Println(value)\n\t\t\t}\n\t\tcase \"--list\", \"-l\":\n\t\t\tfmt.Println(\"Lists all aliases - Not implemented yet.\")\n\t\tdefault:\n\t\t\tfmt.Printf(\"'%s' is not a valid argument for %s %s %s\\n\", os.Args[3], filepath.Base(os.Args[0]), os.Args[1], os.Args[2])\n\t\t}\n\tcase \"--help\", \"-help\", \"-h\":\n\t\t// Display help\n\t\tfmt.Println(_CONFIG_HELP_CONTENT)\n\tcase \"--list\", \"-l\":\n\t\tfmt.Println()\n\t\tdisplayLocalConfigData()\n\t\tfmt.Println()\n\t\tdisplayGlobalConfigData()\n\t\tfmt.Println()\n\tcase \"--local\":\n\t\tif len(os.Args[2:]) == 1 {\n\t\t\t// only --local option, no third option\n\t\t\t// i.e., config --local\n\t\t\t// This is non-valid option\n\t\t\tfmt.Println(_CONFIG_HELP_CONTENT)\n\t\t\treturn\n\t\t}\n\t\t// Have at least arguments.\n\t\tswitch os.Args[3] {\n\t\tcase \"--list\", \"-l\":\n\t\t\tfmt.Println()\n\t\t\tdisplayLocalConfigData()\n\t\t\tfmt.Println()\n\t\tdefault:\n\t\t\tif len(os.Args[1:]) == 4 {\n\t\t\t\t// Request to assign a field (os.Args[3]) a new value (os.Args[4]).\n\t\t\t\t// Illegal fields will be detect in the setLocalConfigValue() routine.\n\t\t\t\tsetLocalConfigValue(os.Args[3], os.Args[4])\n\t\t\t} else {\n\t\t\t\t// need 4 arguments but num = 3 or > 4.\n\t\t\t\t// display help\n\t\t\t\tfmt.Println(_CONFIG_HELP_CONTENT)\n\t\t\t}\n\t\t}\n\tcase \"--global\":\n\t\tif len(os.Args[2:]) == 1 {\n\t\t\t// only have --global option, expected a third argument\n\t\t\t// i.e., sparts config --global <- this is not valid option\n\t\t\tfmt.Println(_CONFIG_HELP_CONTENT)\n\t\t\treturn\n\t\t}\n\t\t// We have at least three arguments.\n\t\tswitch os.Args[3] {\n\t\tcase \"--list\":\n\t\t\tfmt.Println()\n\t\t\tdisplayGlobalConfigData()\n\t\t\tfmt.Println()\n\t\tcase _ATLAS_ADDRESS_KEY,\n\t\t\t_USER_NAME_KEY,\n\t\t\t_USER_EMAIL_KEY:\n\t\t\tsetGlobalConfigValue(os.Args[3], os.Args[4])\n\t\tdefault:\n\t\t\tfmt.Printf(\" '%s' is not a validate global configuration value\\n\", os.Args[3])\n\t\t}\n\tdefault:\n\t\tfmt.Printf(\" '%s' is not a valid config option.\\n\", os.Args[2])\n\t}\n}", "func buildRequest(t Target) (http.Request, error) {\n\tif t.URL == \"\" {\n\t\treturn http.Request{}, errors.New(\"empty URL\")\n\t}\n\tif len(t.URL) < 8 {\n\t\treturn http.Request{}, errors.New(\"URL too short\")\n\t}\n\t//prepend \"http://\" if scheme not provided\n\t//maybe a cleaner way to do this via net.url?\n\tif t.URL[:7] != \"http://\" && t.URL[:8] != \"https://\" {\n\t\tt.URL = \"http://\" + t.URL\n\t}\n\tvar urlStr string\n\tvar err error\n\t//when regex set, generate urls\n\tif t.RegexURL {\n\t\turlStr, err = reggen.Generate(t.URL, 10)\n\t\tif err != nil {\n\t\t\treturn http.Request{}, fmt.Errorf(\"failed to parse regex: %w\", err)\n\t\t}\n\t} else {\n\t\turlStr = t.URL\n\t}\n\tURL, err := url.Parse(urlStr)\n\tif err != nil {\n\t\treturn http.Request{}, fmt.Errorf(\"failed to parse URL %s: %w\", urlStr, err)\n\t}\n\tif URL.Host == \"\" {\n\t\treturn http.Request{}, errors.New(\"empty hostname\")\n\t}\n\n\tif t.Options.DNSPrefetch {\n\t\taddrs, err := net.LookupHost(URL.Hostname())\n\t\tif err != nil {\n\t\t\treturn http.Request{}, fmt.Errorf(\"failed to prefetch host %s\", URL.Host)\n\t\t}\n\t\tif len(addrs) == 0 {\n\t\t\treturn http.Request{}, fmt.Errorf(\"no addresses found for %s\", URL.Host)\n\t\t}\n\t\tURL.Host = addrs[0]\n\t}\n\n\t//setup the request\n\tvar req *http.Request\n\tif t.Options.BodyFilename != \"\" {\n\t\tfileContents, fileErr := ioutil.ReadFile(t.Options.BodyFilename)\n\t\tif fileErr != nil {\n\t\t\treturn http.Request{}, fmt.Errorf(\"failed to read contents of file %s: %w\", t.Options.BodyFilename, fileErr)\n\t\t}\n\t\treq, err = http.NewRequest(t.Options.Method, URL.String(), bytes.NewBuffer(fileContents))\n\t} else if t.Options.Body != \"\" {\n\t\tbodyStr := t.Options.Body\n\t\tif t.Options.RegexBody {\n\t\t\tbodyStr, err = reggen.Generate(t.Options.Body, 10)\n\t\t\tif err != nil {\n\t\t\t\treturn http.Request{}, fmt.Errorf(\"failed to parse regex: %w\", err)\n\t\t\t}\n\t\t}\n\t\treq, err = http.NewRequest(t.Options.Method, URL.String(), bytes.NewBuffer([]byte(bodyStr)))\n\t} else {\n\t\treq, err = http.NewRequest(t.Options.Method, URL.String(), nil)\n\t}\n\tif err != nil {\n\t\treturn http.Request{}, fmt.Errorf(\"failed to create request: %w\", err)\n\t}\n\t//add headers\n\tif t.Options.Headers != \"\" {\n\t\theaderMap, err := parseKeyValString(t.Options.Headers, \",\", \":\")\n\t\tif err != nil {\n\t\t\treturn http.Request{}, fmt.Errorf(\"could not parse headers: %w\", err)\n\t\t}\n\t\tfor key, val := range headerMap {\n\t\t\treq.Header.Add(key, val)\n\t\t}\n\t}\n\n\treq.Header.Set(\"User-Agent\", t.Options.UserAgent)\n\n\t//add cookies\n\tif t.Options.Cookies != \"\" {\n\t\tcookieMap, err := parseKeyValString(t.Options.Cookies, \";\", \"=\")\n\t\tif err != nil {\n\t\t\treturn http.Request{}, fmt.Errorf(\"could not parse cookies: %w\", err)\n\t\t}\n\t\tfor key, val := range cookieMap {\n\t\t\treq.AddCookie(&http.Cookie{Name: key, Value: val})\n\t\t}\n\t}\n\n\tif t.Options.BasicAuth != \"\" {\n\t\tauthMap, err := parseKeyValString(t.Options.BasicAuth, \",\", \":\")\n\t\tif err != nil {\n\t\t\treturn http.Request{}, fmt.Errorf(\"could not parse basic auth: %w\", err)\n\t\t}\n\t\tfor key, val := range authMap {\n\t\t\treq.SetBasicAuth(key, val)\n\t\t\tbreak\n\t\t}\n\t}\n\treturn *req, nil\n}", "func Request(options *RequestOptions) (int, interface{}, error) {\n\n\t// attempt to convert the body to byte array\n\tvar data []byte\n\tif options.Body != nil {\n\t\tmarshalled, err := json.Marshal(options.Body)\n\t\tif err != nil {\n\t\t\treturn -1, nil, err\n\t\t}\n\t\tdata = marshalled\n\t}\n\n\t// build the url\n\turl := fmt.Sprintf(\"http://%s:%s/v1%s\", os.Getenv(\"API_HOST\"), os.Getenv(\"API_PORT\"), options.Path)\n\n\t// create the request\n\treq, err := http.NewRequest(options.Method, url, bytes.NewBuffer(data))\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn -1, nil, err\n\t}\n\n\t// set headers\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tfor key, value := range options.Headers {\n\t\treq.Header.Set(key, value)\n\t}\n\n\t// do the request\n\tresponse, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn -1, nil, err\n\t}\n\n\t// read the content in\n\tdata, err = ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn -1, nil, err\n\t}\n\n\tif len(data) == 0 || options.ResponseModel == true {\n\t\treturn response.StatusCode, data, nil\n\t}\n\n\terr = json.Unmarshal(data, options.ResponseModel)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn -1, nil, err\n\t}\n\n\treturn response.StatusCode, options.ResponseModel, nil\n}", "func parseRequest(bs []byte) ([]*Request, error) {\n\tmr := make([]*Request, 0, MaxMultiRequest)\n\tif err := json.Unmarshal(bs, &mr); err != nil {\n\t\t// println(\"ParseMultiReq err:\", err.Error())\n\t\tgoto ParseSingleReq\n\t}\n\treturn mr, nil\n\nParseSingleReq:\n\tr := new(Request)\n\tif err := json.Unmarshal(bs, r); err != nil {\n\t\terrmsg := \"ParseSingleReq err: \" + err.Error()\n\t\tprintln(errmsg)\n\t\treturn mr, errors.New(errmsg)\n\t}\n\tmr = append(mr, r)\n\treturn mr, nil\n}", "func main() {\n\tlog.Info().Msg(\"Starting http client\")\n\t// counter to stop the program after 10 calls\n\tcounter := 1\n\tfor {\n\t\tlog.Info().Int(\"Counter\", counter).Msg(\"Counter\")\n\t\tmakeHttpCall()\n\n\t\t// sleep for 5 second before making another call\n\t\ttime.Sleep(5 * time.Second)\n\n\t\tcounter++\n\t\tif counter == 10 {\n\t\t\tlog.Info().Msg(\"Stopping http client\")\n\t\t\tbreak\n\t\t}\n\t}\n}", "func sendRequests(cust custInfo){\n\n /*\n Scenario for Extending the Chain this is if you want to do at the starting of the process\n\n time.Sleep(30*time.Second)\n\n */\n fmt.Println(\"start client\")\n cliReqs := clientReqs[\"Requests\"]\n var count =0\n var opCode int\n var i int;\n var amt uint64\n fmt.Println(\"as\\n\")\n for i=0;i<len(cliReqs);i++ {\n cust.reqId = cliReqs[i].ReqId\n if(cliReqs[i].Amt != \"\"){\n amount,errReadingAmt := strconv.Atoi(cliReqs[i].Amt)\n amt = uint64(amount)\n\n if(errReadingAmt != nil){\n fmt.Println(\"error reading the amount from request\",errReadingAmt)\n }\n }\n op := cliReqs[i].Operation\n cust.accountNumber = cliReqs[i].AccountNumber\n fmt.Println(\"operation\",op)\n switch op {\n case \"Query\":\n fmt.Println(\"********\")\n go cust.getBalance(cust.reqId)\n opCode = 1\n break\n case \"Deposit\":\n go cust.doDeposit(amt)\n opCode = 2\n break\n case \"Withdrawal\":\n go cust.doWithdrawal(amt)\n opCode = 3\n break\n default:\n fmt.Println(\"Wrong input!!!!!!\",opCode)\n }\n /* For Internal We wont need delay here */\n time.Sleep(10*time.Second)\n select{\n case <-chn:\n fmt.Println(\"in Channel\\n\")\n continue\n case <- time.After(50*time.Second):\n logMessage(\"Status\",\"Opps time out\")\n fmt.Println(\"Time Out!!!!!!!!\")\n if(count < 3){\n count = count + 1\n i=i-1\n }\n }\n count = 0\n fmt.Println(\"pass\",i,os.Args[1])\n }\n\n}", "func doAPIRequest(httpClient *http.Client, httpUserAgentString string, apiURLString string, endpoint string, query url.Values) ([]byte, error) {\n\t// build the request\n\treq, err := http.NewRequest(\"GET\", apiURLString+endpoint, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif query != nil {\n\t\treq.URL.RawQuery = query.Encode()\n\t}\n\treq.Header.Set(\"User-Agent\", httpUserAgentString)\n\n\t// make the request, return error if error\n\t// TODO: handle errors like client side timeouts\n\tresp, err := httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check status code, return error if not 200\n\t// TODO: handle errors like server side timeouts, this is difficult because\n\t// the API is so sparsely documented.\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"%s: %s\", resp.Status, respBody)\n\t}\n\n\treturn respBody, nil\n}", "func Setup() {\n\tvar testbedParams lib.TestbedFields\n\tvar err error\n\ttimeout = os.Args[4]\n\ttestbedFileName = os.Args[5]\n\tnumGoRoutines, err = strconv.Atoi(os.Args[6])\n\tif err != nil {\n\t\tfmt.Println(\"Setting default value for number of Go routines to 20\")\n\t\tnumGoRoutines = 20\n\t}\n\tif numGoRoutines <= 0 {\n\t\tfmt.Println(\"ERROR : Number of Go Routines cannot be zero or negative.\")\n\t\tos.Exit(0)\n\t}\n\tnumOfLBSvc, err = strconv.Atoi(os.Args[7])\n\tif err != nil {\n\t\tfmt.Println(\"ERROR : Number of LB services not provided\")\n\t\tos.Exit(0)\n\t}\n\tnumOfIng, err = strconv.Atoi(os.Args[8])\n\tif err != nil {\n\t\tfmt.Println(\"ERROR : Number of ingresses not provided\")\n\t\tos.Exit(0)\n\t}\n\ttestbed, er := os.Open(testbedFileName)\n\tif er != nil {\n\t\tfmt.Println(\"ERROR : Error opening testbed file \", testbedFileName, \" with error : \", er)\n\t\tos.Exit(0)\n\t}\n\tdefer testbed.Close()\n\tbyteValue, err := ioutil.ReadAll(testbed)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR : Failed to read the testbed file with error : \", err)\n\t\tos.Exit(0)\n\t}\n\terr = json.Unmarshal(byteValue, &testbedParams)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR : Failed to unmarshal testbed file as : \", err)\n\t\tos.Exit(0)\n\t}\n\tnamespace = testbedParams.TestParams.Namespace\n\tappName = testbedParams.TestParams.AppName\n\tserviceNamePrefix = testbedParams.TestParams.ServiceNamePrefix\n\tingressNamePrefix = testbedParams.TestParams.IngressNamePrefix\n\tclusterName = testbedParams.AkoParam.Clusters[0].ClusterName\n\tdnsVSUUID = testbedParams.TestParams.DnsVSUUID\n\takoPodName = testbedParams.TestParams.AkoPodName\n\tos.Setenv(\"CTRL_USERNAME\", testbedParams.Vm[0].UserName)\n\tos.Setenv(\"CTRL_PASSWORD\", testbedParams.Vm[0].Password)\n\tos.Setenv(\"CTRL_IPADDRESS\", testbedParams.Vm[0].IP)\n\tlib.KubeInit(testbedParams.AkoParam.Clusters[0].KubeConfigFilePath)\n\tAviClients, err = lib.SharedAVIClients(2)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR : Creating Avi Client : \", err)\n\t\tos.Exit(0)\n\t}\n\terr = lib.CreateApp(appName, namespace, 1)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR : Creation of Deployment \"+appName+\" failed due to the error : \", err)\n\t\tos.Exit(0)\n\t}\n\tlistOfServicesCreated, err = lib.CreateService(serviceNamePrefix, appName, namespace, 2)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR : Creation of Services failed due to the error : \", err)\n\t\tos.Exit(0)\n\t}\n}", "func apihandler(w http.ResponseWriter, r *http.Request) {\n\tcatalogMatch := catalogRequestRegex.FindStringSubmatch(r.RequestURI)\n\tcoreMatch := coreRequestRegex.FindStringSubmatch(r.RequestURI)\n\n\tif len(catalogMatch) == 0 && len(coreMatch) == 0 {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(fmt.Sprintf(\"unexpected request %s %s doesn't match %q or %q\", r.Method, r.RequestURI, catalogRequestRegex, coreRequestRegex)))\n\t\treturn\n\t}\n\n\tif r.Method != http.MethodGet {\n\t\t// Anything more interesting than a GET, i.e. it relies upon server behavior\n\t\t// probably should be an integration test instead\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(fmt.Sprintf(\"unallowed method for request %s %s\", r.Method, r.RequestURI)))\n\t\treturn\n\t}\n\n\tvar match string\n\tif len(catalogMatch) > 0 {\n\t\tmatch = filepath.Join(\"catalog\", catalogMatch[1])\n\t} else {\n\t\tmatch = filepath.Join(\"core\", coreMatch[1])\n\t}\n\n\trelpath, err := url.PathUnescape(match)\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(fmt.Sprintf(\"could not unescape path %s (%s)\", match, err)))\n\t\treturn\n\t}\n\tresponseFile := filepath.Join(\"responses\", relpath+\".json\")\n\t_, response, err := test.GetTestdata(responseFile)\n\tif err != nil {\n\t\tw.WriteHeader(500)\n\t\tw.Write([]byte(fmt.Sprintf(\"request %s has no matching testdata at %s (%s)\", r.RequestURI, responseFile, err)))\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(response)\n}", "func Main(cookie, etag string, gzip, ignoreBody bool, urls ...string) error {\n\tfor i, url := range urls {\n\t\t// Separate subsequent lookups with newline\n\t\tif i > 0 {\n\t\t\tfmt.Println()\n\t\t}\n\t\tif err := getHeaders(cookie, etag, gzip, ignoreBody, url); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (a GeneralDataProtectionRegulationApi) GetGdprRequests(pageSize int, pageNumber int) (*Gdprrequestentitylisting, *APIResponse, error) {\n\tvar httpMethod = \"GET\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/api/v2/gdpr/requests\"\n\tdefaultReturn := new(Gdprrequestentitylisting)\n\tif true == false {\n\t\treturn defaultReturn, nil, errors.New(\"This message brought to you by the laws of physics being broken\")\n\t}\n\n\n\theaderParams := make(map[string]string)\n\tqueryParams := make(map[string]string)\n\tformParams := url.Values{}\n\tvar postBody interface{}\n\tvar postFileName string\n\tvar fileBytes []byte\n\t// authentication (PureCloud OAuth) required\n\n\t// oauth required\n\tif a.Configuration.AccessToken != \"\"{\n\t\theaderParams[\"Authorization\"] = \"Bearer \" + a.Configuration.AccessToken\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\t\n\tqueryParams[\"pageSize\"] = a.Configuration.APIClient.ParameterToString(pageSize, \"\")\n\t\n\tqueryParams[\"pageNumber\"] = a.Configuration.APIClient.ParameterToString(pageNumber, \"\")\n\t\n\n\t// Find an replace keys that were altered to avoid clashes with go keywords \n\tcorrectedQueryParams := make(map[string]string)\n\tfor k, v := range queryParams {\n\t\tif k == \"varType\" {\n\t\t\tcorrectedQueryParams[\"type\"] = v\n\t\t\tcontinue\n\t\t}\n\t\tcorrectedQueryParams[k] = v\n\t}\n\tqueryParams = correctedQueryParams\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload *Gdprrequestentitylisting\n\tresponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, postFileName, fileBytes)\n\tif err != nil {\n\t\t// Nothing special to do here, but do avoid processing the response\n\t} else if err == nil && response.Error != nil {\n\t\terr = errors.New(response.ErrorMessage)\n\t} else if response.HasBody {\n\t\tif \"Gdprrequestentitylisting\" == \"string\" {\n\t\t\tcopy(response.RawBody, &successPayload)\n\t\t} else {\n\t\t\terr = json.Unmarshal(response.RawBody, &successPayload)\n\t\t}\n\t}\n\treturn successPayload, response, err\n}", "func RunAPI(server *Server, quit qu.C) {\n\tnrh := RPCHandlers\n\tgo func() {\n\t\tD.Ln(\"starting up node cAPI\")\n\t\tvar e error\n\t\tvar res interface{}\n\t\tfor {\n\t\t\tselect { \n\t\t\tcase msg := <-nrh[\"addnode\"].Call:\n\t\t\t\tif res, e = nrh[\"addnode\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.AddNodeCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(None); ok { \n\t\t\t\t\tmsg.Ch.(chan AddNodeRes) <-AddNodeRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"createrawtransaction\"].Call:\n\t\t\t\tif res, e = nrh[\"createrawtransaction\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.CreateRawTransactionCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan CreateRawTransactionRes) <-CreateRawTransactionRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"decoderawtransaction\"].Call:\n\t\t\t\tif res, e = nrh[\"decoderawtransaction\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.DecodeRawTransactionCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.TxRawDecodeResult); ok { \n\t\t\t\t\tmsg.Ch.(chan DecodeRawTransactionRes) <-DecodeRawTransactionRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"decodescript\"].Call:\n\t\t\t\tif res, e = nrh[\"decodescript\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.DecodeScriptCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.DecodeScriptResult); ok { \n\t\t\t\t\tmsg.Ch.(chan DecodeScriptRes) <-DecodeScriptRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"estimatefee\"].Call:\n\t\t\t\tif res, e = nrh[\"estimatefee\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.EstimateFeeCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(float64); ok { \n\t\t\t\t\tmsg.Ch.(chan EstimateFeeRes) <-EstimateFeeRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"generate\"].Call:\n\t\t\t\tif res, e = nrh[\"generate\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.([]string); ok { \n\t\t\t\t\tmsg.Ch.(chan GenerateRes) <-GenerateRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getaddednodeinfo\"].Call:\n\t\t\t\tif res, e = nrh[\"getaddednodeinfo\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetAddedNodeInfoCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.([]btcjson.GetAddedNodeInfoResultAddr); ok { \n\t\t\t\t\tmsg.Ch.(chan GetAddedNodeInfoRes) <-GetAddedNodeInfoRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getbestblock\"].Call:\n\t\t\t\tif res, e = nrh[\"getbestblock\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.GetBestBlockResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetBestBlockRes) <-GetBestBlockRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getbestblockhash\"].Call:\n\t\t\t\tif res, e = nrh[\"getbestblockhash\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetBestBlockHashRes) <-GetBestBlockHashRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getblock\"].Call:\n\t\t\t\tif res, e = nrh[\"getblock\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetBlockCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.GetBlockVerboseResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetBlockRes) <-GetBlockRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getblockchaininfo\"].Call:\n\t\t\t\tif res, e = nrh[\"getblockchaininfo\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.GetBlockChainInfoResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetBlockChainInfoRes) <-GetBlockChainInfoRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getblockcount\"].Call:\n\t\t\t\tif res, e = nrh[\"getblockcount\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(int64); ok { \n\t\t\t\t\tmsg.Ch.(chan GetBlockCountRes) <-GetBlockCountRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getblockhash\"].Call:\n\t\t\t\tif res, e = nrh[\"getblockhash\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetBlockHashCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetBlockHashRes) <-GetBlockHashRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getblockheader\"].Call:\n\t\t\t\tif res, e = nrh[\"getblockheader\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetBlockHeaderCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.GetBlockHeaderVerboseResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetBlockHeaderRes) <-GetBlockHeaderRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getblocktemplate\"].Call:\n\t\t\t\tif res, e = nrh[\"getblocktemplate\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetBlockTemplateCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetBlockTemplateRes) <-GetBlockTemplateRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getcfilter\"].Call:\n\t\t\t\tif res, e = nrh[\"getcfilter\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetCFilterCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetCFilterRes) <-GetCFilterRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getcfilterheader\"].Call:\n\t\t\t\tif res, e = nrh[\"getcfilterheader\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetCFilterHeaderCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetCFilterHeaderRes) <-GetCFilterHeaderRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getconnectioncount\"].Call:\n\t\t\t\tif res, e = nrh[\"getconnectioncount\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(int32); ok { \n\t\t\t\t\tmsg.Ch.(chan GetConnectionCountRes) <-GetConnectionCountRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getcurrentnet\"].Call:\n\t\t\t\tif res, e = nrh[\"getcurrentnet\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetCurrentNetRes) <-GetCurrentNetRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getdifficulty\"].Call:\n\t\t\t\tif res, e = nrh[\"getdifficulty\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetDifficultyCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(float64); ok { \n\t\t\t\t\tmsg.Ch.(chan GetDifficultyRes) <-GetDifficultyRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getgenerate\"].Call:\n\t\t\t\tif res, e = nrh[\"getgenerate\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetHeadersCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(bool); ok { \n\t\t\t\t\tmsg.Ch.(chan GetGenerateRes) <-GetGenerateRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"gethashespersec\"].Call:\n\t\t\t\tif res, e = nrh[\"gethashespersec\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(float64); ok { \n\t\t\t\t\tmsg.Ch.(chan GetHashesPerSecRes) <-GetHashesPerSecRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getheaders\"].Call:\n\t\t\t\tif res, e = nrh[\"getheaders\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetHeadersCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.([]string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetHeadersRes) <-GetHeadersRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getinfo\"].Call:\n\t\t\t\tif res, e = nrh[\"getinfo\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.InfoChainResult0); ok { \n\t\t\t\t\tmsg.Ch.(chan GetInfoRes) <-GetInfoRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getmempoolinfo\"].Call:\n\t\t\t\tif res, e = nrh[\"getmempoolinfo\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.GetMempoolInfoResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetMempoolInfoRes) <-GetMempoolInfoRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getmininginfo\"].Call:\n\t\t\t\tif res, e = nrh[\"getmininginfo\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.GetMiningInfoResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetMiningInfoRes) <-GetMiningInfoRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getnettotals\"].Call:\n\t\t\t\tif res, e = nrh[\"getnettotals\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.GetNetTotalsResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetNetTotalsRes) <-GetNetTotalsRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getnetworkhashps\"].Call:\n\t\t\t\tif res, e = nrh[\"getnetworkhashps\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetNetworkHashPSCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.([]btcjson.GetPeerInfoResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetNetworkHashPSRes) <-GetNetworkHashPSRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getpeerinfo\"].Call:\n\t\t\t\tif res, e = nrh[\"getpeerinfo\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.([]btcjson.GetPeerInfoResult); ok { \n\t\t\t\t\tmsg.Ch.(chan GetPeerInfoRes) <-GetPeerInfoRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getrawmempool\"].Call:\n\t\t\t\tif res, e = nrh[\"getrawmempool\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetRawMempoolCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.([]string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetRawMempoolRes) <-GetRawMempoolRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"getrawtransaction\"].Call:\n\t\t\t\tif res, e = nrh[\"getrawtransaction\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetRawTransactionCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetRawTransactionRes) <-GetRawTransactionRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"gettxout\"].Call:\n\t\t\t\tif res, e = nrh[\"gettxout\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.GetTxOutCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan GetTxOutRes) <-GetTxOutRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"help\"].Call:\n\t\t\t\tif res, e = nrh[\"help\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.HelpCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan HelpRes) <-HelpRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"node\"].Call:\n\t\t\t\tif res, e = nrh[\"node\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.NodeCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(None); ok { \n\t\t\t\t\tmsg.Ch.(chan NodeRes) <-NodeRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"ping\"].Call:\n\t\t\t\tif res, e = nrh[\"ping\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(None); ok { \n\t\t\t\t\tmsg.Ch.(chan PingRes) <-PingRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"resetchain\"].Call:\n\t\t\t\tif res, e = nrh[\"resetchain\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(None); ok { \n\t\t\t\t\tmsg.Ch.(chan ResetChainRes) <-ResetChainRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"restart\"].Call:\n\t\t\t\tif res, e = nrh[\"restart\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(None); ok { \n\t\t\t\t\tmsg.Ch.(chan RestartRes) <-RestartRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"searchrawtransactions\"].Call:\n\t\t\t\tif res, e = nrh[\"searchrawtransactions\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.SearchRawTransactionsCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.([]btcjson.SearchRawTransactionsResult); ok { \n\t\t\t\t\tmsg.Ch.(chan SearchRawTransactionsRes) <-SearchRawTransactionsRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"sendrawtransaction\"].Call:\n\t\t\t\tif res, e = nrh[\"sendrawtransaction\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.SendRawTransactionCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(None); ok { \n\t\t\t\t\tmsg.Ch.(chan SendRawTransactionRes) <-SendRawTransactionRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"setgenerate\"].Call:\n\t\t\t\tif res, e = nrh[\"setgenerate\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.SetGenerateCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(None); ok { \n\t\t\t\t\tmsg.Ch.(chan SetGenerateRes) <-SetGenerateRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"stop\"].Call:\n\t\t\t\tif res, e = nrh[\"stop\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(None); ok { \n\t\t\t\t\tmsg.Ch.(chan StopRes) <-StopRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"submitblock\"].Call:\n\t\t\t\tif res, e = nrh[\"submitblock\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.SubmitBlockCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(string); ok { \n\t\t\t\t\tmsg.Ch.(chan SubmitBlockRes) <-SubmitBlockRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"uptime\"].Call:\n\t\t\t\tif res, e = nrh[\"uptime\"].\n\t\t\t\t\tFn(server, msg.Params.(*None), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.GetMempoolInfoResult); ok { \n\t\t\t\t\tmsg.Ch.(chan UptimeRes) <-UptimeRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"validateaddress\"].Call:\n\t\t\t\tif res, e = nrh[\"validateaddress\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.ValidateAddressCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(btcjson.ValidateAddressChainResult); ok { \n\t\t\t\t\tmsg.Ch.(chan ValidateAddressRes) <-ValidateAddressRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"verifychain\"].Call:\n\t\t\t\tif res, e = nrh[\"verifychain\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.VerifyChainCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(bool); ok { \n\t\t\t\t\tmsg.Ch.(chan VerifyChainRes) <-VerifyChainRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"verifymessage\"].Call:\n\t\t\t\tif res, e = nrh[\"verifymessage\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.VerifyMessageCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(bool); ok { \n\t\t\t\t\tmsg.Ch.(chan VerifyMessageRes) <-VerifyMessageRes{&r, e} } \n\t\t\tcase msg := <-nrh[\"version\"].Call:\n\t\t\t\tif res, e = nrh[\"version\"].\n\t\t\t\t\tFn(server, msg.Params.(*btcjson.VersionCmd), nil); E.Chk(e) {\n\t\t\t\t}\n\t\t\t\tif r, ok := res.(map[string]btcjson.VersionResult); ok { \n\t\t\t\t\tmsg.Ch.(chan VersionRes) <-VersionRes{&r, e} } \n\t\t\tcase <-quit.Wait():\n\t\t\t\tD.Ln(\"stopping wallet cAPI\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}" ]
[ "0.6644718", "0.6372502", "0.61876494", "0.61371124", "0.61044574", "0.6081842", "0.6022942", "0.5953721", "0.5951159", "0.5951089", "0.59170794", "0.5904697", "0.5890247", "0.5870842", "0.5866545", "0.5783277", "0.5732452", "0.5727227", "0.5726936", "0.5726187", "0.5726061", "0.5720784", "0.5710005", "0.5709587", "0.5672084", "0.56446654", "0.56372803", "0.5630788", "0.56138754", "0.56131655", "0.5610228", "0.5599285", "0.55944145", "0.5586705", "0.5585133", "0.5572728", "0.55510366", "0.554312", "0.5533998", "0.5522397", "0.55130166", "0.5511868", "0.5491474", "0.5484452", "0.5484185", "0.54744905", "0.54434013", "0.5431902", "0.5426887", "0.5389775", "0.53828835", "0.53813", "0.5379286", "0.53701085", "0.5360811", "0.53559357", "0.53557307", "0.53430355", "0.53381705", "0.5335224", "0.53309196", "0.53273803", "0.5318358", "0.53179365", "0.5315695", "0.5310705", "0.5310343", "0.53099024", "0.53037316", "0.53005296", "0.5299107", "0.52974623", "0.5287688", "0.52867156", "0.5281465", "0.527653", "0.52724046", "0.5271215", "0.52673775", "0.5264671", "0.52635694", "0.52579165", "0.5255249", "0.5243134", "0.5232794", "0.52277225", "0.52273726", "0.5223748", "0.52212024", "0.52135", "0.5213077", "0.52088916", "0.5203394", "0.5202409", "0.52014595", "0.5201047", "0.51981163", "0.5195807", "0.5194857", "0.5191594" ]
0.62286013
2
Check availability of resource
func checkResource(url *string, channel chan RetData, cl *http.Client) { ret := RetData{} ret.startTime = time.Now() resp, err := cl.Get(*url) ret.finishTime = time.Now() if err != nil { ret.bad = true if terr, ok := err.(net.Error); ok && terr.Timeout() { ret.timeOut = true } } else { if resp.StatusCode < 200 || resp.StatusCode > 299 { ret.bad = true } defer resp.Body.Close() } channel <- ret }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Manager) IsAvailableResource(item interface{}) bool {\n\tif v, ok := item.(BinConfig); ok {\n\t\treturn utils.FileExists(v.Path) || utils.DirectoryExists(v.Path)\n\t}\n\tif v, ok := item.(WeightConfig); ok {\n\t\treturn utils.FileExists(v.Path)\n\t}\n\tif v, ok := item.(ConfigConfig); ok {\n\t\treturn utils.FileExists(v.Path)\n\t}\n\treturn false\n}", "func isResourceReady(dynamicClient dynamic.Interface, obj *MetaResource) (bool, error) {\n\t// get the resource's name, namespace and gvr\n\tname := obj.Name\n\tnamespace := obj.Namespace\n\tgvk := obj.GroupVersionKind()\n\tgvr, _ := meta.UnsafeGuessKindToResource(gvk)\n\t// use the helper functions to convert the resource to a KResource duck\n\ttif := &duck.TypedInformerFactory{Client: dynamicClient, Type: &duckv1alpha1.KResource{}}\n\t_, lister, err := tif.Get(gvr)\n\tif err != nil {\n\t\t// Return error to stop the polling.\n\t\treturn false, err\n\t}\n\tuntyped, err := lister.ByNamespace(namespace).Get(name)\n\tif k8serrors.IsNotFound(err) {\n\t\t// Return false as we are not done yet.\n\t\t// We swallow the error to keep on polling.\n\t\t// It should only happen if we wait for the auto-created resources, like default Broker.\n\t\treturn false, nil\n\t} else if err != nil {\n\t\t// Return error to stop the polling.\n\t\treturn false, err\n\t}\n\tkr := untyped.(*duckv1alpha1.KResource)\n\treturn kr.Status.GetCondition(duckv1alpha1.ConditionReady).IsTrue(), nil\n}", "func ServiceAvailable(ctx *Context, url string, timeout time.Duration) bool {\n\n\tLog(INFO, ctx, \"ServiceAvailable\", \"url\", url)\n\n\tclient := &http.Client{Timeout: timeout}\n\tresp, err := client.Get(url)\n\tif err != nil {\n\t\tLog(INFO, ctx, \"ServiceAvailable\", \"url\", url, \"error\", err, \"available\", false)\n\t\tLog(ERROR, ctx, \"ServiceAvailable\", \"url\", url, \"error\", err, \"available\", false)\n\t\treturn false\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\tLog(INFO, ctx, \"ServiceAvailable\", \"url\", url, \"code\", resp.StatusCode, \"available\", false)\n\t\treturn false\n\t}\n\n\tLog(INFO, ctx, \"ServiceAvailable\", \"url\", url, \"available\", true)\n\treturn true\n}", "func CheckResource(nsId string, resourceType string, resourceId string) (bool, error) {\n\n\t// Check parameters' emptiness\n\tif nsId == \"\" {\n\t\terr := fmt.Errorf(\"CheckResource failed; nsId given is null.\")\n\t\treturn false, err\n\t} else if resourceType == \"\" {\n\t\terr := fmt.Errorf(\"CheckResource failed; resourceType given is null.\")\n\t\treturn false, err\n\t} else if resourceId == \"\" {\n\t\terr := fmt.Errorf(\"CheckResource failed; resourceId given is null.\")\n\t\treturn false, err\n\t}\n\n\t// Check resourceType's validity\n\tif resourceType == common.StrImage ||\n\t\tresourceType == common.StrSSHKey ||\n\t\tresourceType == common.StrSpec ||\n\t\tresourceType == common.StrVNet ||\n\t\tresourceType == common.StrSecurityGroup {\n\t\t//resourceType == \"subnet\" ||\n\t\t//resourceType == \"publicIp\" ||\n\t\t//resourceType == \"vNic\" {\n\t\t// continue\n\t} else {\n\t\terr := fmt.Errorf(\"invalid resource type\")\n\t\treturn false, err\n\t}\n\n\terr := common.CheckString(nsId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn false, err\n\t}\n\n\terr = common.CheckString(resourceId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn false, err\n\t}\n\n\tfmt.Println(\"[Check resource] \" + resourceType + \", \" + resourceId)\n\n\tkey := common.GenResourceKey(nsId, resourceType, resourceId)\n\t//fmt.Println(key)\n\n\tkeyValue, err := common.CBStore.Get(key)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn false, err\n\t}\n\tif keyValue != nil {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n\n}", "func (d downloader) IsAvailable() bool {\n\treturn len(d.urls) != 0\n}", "func (q *Queue) CheckResourceConnectionStatus(res *Resource) bool {\n\tvar reply int64\n\terr := res.Client.Call(\"Queue.Ping\", 12345, &reply)\n\tif err == rpc.ErrShutdown || err == io.EOF || err == io.ErrUnexpectedEOF {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func hasResource(client discovery.DiscoveryInterface, resource schema.GroupVersionResource) bool {\n\tresources, err := client.ServerResourcesForGroupVersion(resource.GroupVersion().String())\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tfor _, serverResource := range resources.APIResources {\n\t\tif serverResource.Name == resource.Resource {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func isAppAvailable(t *testing.T, healthCheckEndPoint string) bool {\n\tclient := &http.Client{}\n\tresp, err := client.Get(healthCheckEndPoint)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to get a response from health probe: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\treturn resp.StatusCode == http.StatusNoContent\n}", "func (p *ResourcePool) getAvailable(timeout <-chan time.Time) (ResourceWrapper, error) {\n\n\t//Wait for an object, or a timeout\n\tselect {\n\tcase <-timeout:\n\t\treturn ResourceWrapper{p: p, e: ResourceTimeoutError}, ResourceTimeoutError\n\n\tcase wrapper, ok := <-p.resources:\n\n\t\t//pool is closed\n\t\tif !ok {\n\t\t\treturn ResourceWrapper{p: p, e: PoolClosedError}, PoolClosedError\n\t\t}\n\n\t\t//decriment the number of available resources\n\t\tatomic.AddUint32(&p.nAvailable, ^uint32(0))\n\n\t\t//if the resource fails the test, close it and wait to get another resource\n\t\tif p.resTest(wrapper.Resource) != nil {\n\t\t\tp.resClose(wrapper.Resource)\n\t\t\twrapper.Close()\n\t\t\treturn ResourceWrapper{p: p, e: ResourceTestError}, ResourceTestError\n\t\t}\n\n\t\t//we got a valid resource to return\n\t\t//signal the filler that we need to fill\n\t\treturn wrapper, wrapper.e\n\n\t//we don't have a resource available\n\t//lets create one if we can\n\tdefault:\n\n\t\t//try to obtain a lock for a new resource\n\t\tif n_open := atomic.AddUint32(&p.open, 1); n_open > p.Cap() {\n\t\t\t//decriment\n\t\t\tatomic.AddUint32(&p.open, ^uint32(0))\n\t\t\treturn ResourceWrapper{p: p, e: ResourceExhaustedError}, ResourceExhaustedError\n\t\t}\n\n\t\tresource, err := p.resOpen()\n\t\tif err != nil {\n\t\t\t//decriment\n\t\t\tatomic.AddUint32(&p.open, ^uint32(0))\n\t\t\treturn ResourceWrapper{p: p, e: ResourceCreationError}, ResourceCreationError\n\t\t}\n\n\t\treturn ResourceWrapper{p: p, Resource: resource}, nil\n\t}\n}", "func IsResourceTypeNameAvail(w http.ResponseWriter, r *http.Request) (interface{}, error) {\n\ttypename := r.Form.Get(\"typename\")\n\texists := false\n\tdb := GetDBHandle()\n\terr := db.QueryRow(\"SELECT exists (SELECT resourcetype FROM resourcetypes WHERE resourcetype=$1)\", typename).Scan(&exists)\n\n\treturn exists, err\n}", "func (pr *Provider) IsAvailable() bool {\n\treturn pr.available\n}", "func isResourceBestEffort(container *v1.Container, resource v1.ResourceName) bool {\n\t// A container resource is best-effort if its request is unspecified or 0.\n\t// If a request is specified, then the user expects some kind of resource guarantee.\n\treq, hasReq := container.Resources.Requests[resource]\n\treturn !hasReq || req.Value() == 0\n}", "func IsAvailable() bool {\n\tvar kernel32Err, ntdllErr, rtlCopyMemErr, vAllocErr error\n\tkernel32, kernel32Err = syscall.LoadDLL(\"kernel32.dll\")\n\tntdll, ntdllErr = syscall.LoadDLL(\"ntdll.dll\")\n\tVirtualAlloc, vAllocErr = kernel32.FindProc(\"VirtualAlloc\")\n\tRtlCopyMemory, rtlCopyMemErr = ntdll.FindProc(\"RtlCopyMemory\")\n\tif kernel32Err != nil && ntdllErr != nil && rtlCopyMemErr != nil && vAllocErr != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func isResourceBestEffort(container *api.Container, resource api.ResourceName) bool {\n\t// A container resource is best-effort if its request is unspecified or 0.\n\t// If a request is specified, then the user expects some kind of resource guarantee.\n\treq, hasReq := container.Resources.Requests[resource]\n\treturn !hasReq || req.Value() == 0\n}", "func (r Result) HasResource() bool {\n\treturn r.Resource.UID != \"\"\n}", "func (rp *ResolverPool) Available() (bool, error) {\n\treturn true, nil\n}", "func (rp *ResolverPool) Available() (bool, error) {\n\treturn true, nil\n}", "func (m *mountPoint) hasResource(absolutePath string) bool {\n\trelPath, err := filepath.Rel(m.Destination, absolutePath)\n\n\treturn err == nil && relPath != \"..\" && !strings.HasPrefix(relPath, fmt.Sprintf(\"..%c\", filepath.Separator))\n}", "func isAvailable(name string) bool {\n\tregion := os.Getenv(\"REGION\")\n\n\tsvc := neptune.New(session.New(&aws.Config{\n\t\tRegion: aws.String(region),\n\t}))\n\n\trparams := &neptune.DescribeDBInstancesInput{\n\t\tDBInstanceIdentifier: aws.String(name),\n\t\tMaxRecords: aws.Int64(20),\n\t}\n\trresp, rerr := svc.DescribeDBInstances(rparams)\n\tif rerr != nil {\n\t\tfmt.Println(rerr)\n\t}\n\n\tfmt.Println(\"Checking to see if \" + name + \" is available...\")\n\tfmt.Println(\"Current Status: \" + *rresp.DBInstances[0].DBInstanceStatus)\n\tstatus := *rresp.DBInstances[0].DBInstanceStatus\n\tif status == \"available\" {\n\t\treturn true\n\t}\n\treturn false\n}", "func (s *EcsService) ResourceAvailable(zone ecs.Zone, resourceType ResourceType) error {\n\tfor _, res := range zone.AvailableResourceCreation.ResourceTypes {\n\t\tif res == string(resourceType) {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn WrapError(Error(\"%s is not available in %s zone of %s region\", resourceType, zone.ZoneId, s.client.Region))\n}", "func (client *ClientImpl) CheckAvailability(ctx context.Context, args CheckAvailabilityArgs) error {\n\tlocationId, _ := uuid.Parse(\"97c893cc-e861-4ef4-8c43-9bad4a963dee\")\n\t_, err := client.Client.Send(ctx, http.MethodGet, locationId, \"6.0-preview.1\", nil, nil, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func ResourceExists(dc discovery.DiscoveryInterface, apiGroupVersion, kind string) (bool, error) {\n\n\t_, apiLists, err := dc.ServerGroupsAndResources()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor _, apiList := range apiLists {\n\t\tif apiList.GroupVersion == apiGroupVersion {\n\t\t\tfor _, r := range apiList.APIResources {\n\t\t\t\tif r.Kind == kind {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false, nil\n}", "func ResourceExists(dc discovery.DiscoveryInterface, apiGroupVersion, kind string) (bool, error) {\n\n\t_, apiLists, err := dc.ServerGroupsAndResources()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tfor _, apiList := range apiLists {\n\t\tif apiList.GroupVersion == apiGroupVersion {\n\t\t\tfor _, r := range apiList.APIResources {\n\t\t\t\tif r.Kind == kind {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false, nil\n}", "func (p LeclercParser) IsAvailable() (bool, error) {\n\tproductResponse, err := p.getJSON(p.URL)\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif len(productResponse.Items) > 0 {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func Available() bool {\n\treturn available()\n}", "func (s *SyncStorage) CheckResource(ns string, resource string) (time.Duration, error) {\n\tresult, err := s.getDbBackend(ns).PTTL(getNsPrefix(ns) + resource)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif result == time.Duration(-1) {\n\t\treturn 0, errors.New(\"invalid resource given, no expiration time attached\")\n\t}\n\treturn result, nil\n}", "func (_OracleMgr *OracleMgrCaller) HasAvailability(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _OracleMgr.contract.Call(opts, out, \"_hasAvailability\")\n\treturn *ret0, err\n}", "func (host *Server) Available() bool {\n\tif host.Spec.ConsumerRef != nil {\n\t\treturn false\n\t}\n\tif host.GetDeletionTimestamp() != nil {\n\t\treturn false\n\t}\n\tif host.HasError() {\n\t\treturn false\n\t}\n\treturn true\n}", "func (p *DeliveryConfigProcessor) ResourceExists(search *ExportableResource) bool {\n\tfor eix := range p.deliveryConfig.Environments {\n\t\trix := p.findResourceIndex(search, eix)\n\t\tif rix >= 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (d *IPFSStore) HasResource(resourceId ResourceId) bool {\n //TODO:\n // - Should we return local cache presence through refs local?\n // . Maybe we can add HasLocalResource(resourceId ResourceId) method. \n return resourceId.GetStorageId() == d.TypeId()\n}", "func (q *QueryGVR) resourceExists(resources []*metav1.APIResourceList) bool {\n\tif len(resources) == 0 {\n\t\treturn false\n\t}\n\tfor i := range resources {\n\t\tif resources[i] != nil {\n\t\t\tfor j := range resources[i].APIResources {\n\t\t\t\tif resources[i].APIResources[j].Name == q.resource.String {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func (s *Server) CheckAvailability(ctx context.Context, req *pb.Request) (*pb.Result, error) {\n\tres := new(pb.Result)\n\tres.HotelId = make([]string, 0)\n\n\t// session, err := mgo.Dial(\"mongodb-reservation\")\n\t// if err != nil {\n\t// \tpanic(err)\n\t// }\n\t// defer session.Close()\n\tsession := s.MongoSession.Copy()\n\tdefer session.Close()\n\n\tc1 := session.DB(\"reservation-db\").C(\"number\")\n\n\thotelMemKeys := []string{}\n\tkeysMap := make(map[string]struct{})\n\tresMap := make(map[string]bool)\n\t// cache capacity since it will not change\n\tfor _, hotelId := range req.HotelId {\n\t\thotelMemKeys = append(hotelMemKeys, hotelId+\"_cap\")\n\t\tresMap[hotelId] = true\n\t\tkeysMap[hotelId+\"_cap\"] = struct{}{}\n\t}\n\tcapMemSpan, _ := opentracing.StartSpanFromContext(ctx, \"memcached_capacity_get_multi_number\")\n\tcapMemSpan.SetTag(\"span.kind\", \"client\")\n\tcacheMemRes, err := s.MemcClient.GetMulti(hotelMemKeys)\n\tcapMemSpan.Finish()\n\tmisKeys := []string{}\n\t// gather cache miss key to query in mongodb\n\tif err == memcache.ErrCacheMiss {\n\t\tfor key := range keysMap {\n\t\t\tif _, ok := cacheMemRes[key]; !ok {\n\t\t\t\tmisKeys = append(misKeys, key)\n\t\t\t}\n\t\t}\n\t} else if err != nil {\n\t\tlog.Panic().Msgf(\"Tried to get memc_cap_key [%v], but got memmcached error = %s\", hotelMemKeys, err)\n\t}\n\t// store whole capacity result in cacheCap\n\tcacheCap := make(map[string]int)\n\tfor k, v := range cacheMemRes {\n\t\thotelCap, _ := strconv.Atoi(string(v.Value))\n\t\tcacheCap[k] = hotelCap\n\t}\n\tif len(misKeys) > 0 {\n\t\tqueryMissKeys := []string{}\n\t\tfor _, k := range misKeys {\n\t\t\tqueryMissKeys = append(queryMissKeys, strings.Split(k, \"_\")[0])\n\t\t}\n\t\tnums := []number{}\n\t\tcapMongoSpan, _ := opentracing.StartSpanFromContext(ctx, \"mongodb_capacity_get_multi_number\")\n\t\tcapMongoSpan.SetTag(\"span.kind\", \"client\")\n\t\terr = c1.Find(bson.M{\"hotelId\": bson.M{\"$in\": queryMissKeys}}).All(&nums) \n\t\tcapMongoSpan.Finish()\n\t\tif err != nil {\n\t\t\tlog.Panic().Msgf(\"Tried to find hotelId [%v], but got error\", misKeys, err.Error())\n\t\t}\n\t\tfor _, num := range nums {\n\t\t\tcacheCap[num.HotelId] = num.Number\n\t\t\t// we don't care set successfully or not\n\t\t\tgo s.MemcClient.Set(&memcache.Item{Key: num.HotelId + \"_cap\", Value: []byte(strconv.Itoa(num.Number))})\n\t\t}\n\t}\n\n\treqCommand := []string{}\n\tqueryMap := make(map[string]map[string]string)\n\tfor _, hotelId := range req.HotelId {\n\t\tlog.Trace().Msgf(\"reservation check hotel %s\", hotelId)\n\t\tinDate, _ := time.Parse(\n\t\t\ttime.RFC3339,\n\t\t\treq.InDate+\"T12:00:00+00:00\")\n\t\toutDate, _ := time.Parse(\n\t\t\ttime.RFC3339,\n\t\t\treq.OutDate+\"T12:00:00+00:00\")\n\t\tfor inDate.Before(outDate) {\n\t\t\tindate := inDate.String()[:10]\n\t\t\tinDate = inDate.AddDate(0, 0, 1)\n\t\t\toutDate := inDate.String()[:10]\n\t\t\tmemcKey := hotelId + \"_\" + outDate + \"_\" + outDate\n\t\t\treqCommand = append(reqCommand, memcKey)\n\t\t\tqueryMap[memcKey] = map[string]string{\n\t\t\t\t\"hotelId\": hotelId,\n\t\t\t\t\"startDate\": indate,\n\t\t\t\t\"endDate\": outDate,\n\t\t\t}\n\t\t}\n\t}\n\n\ttype taskRes struct {\n\t\thotelId string\n\t\tcheckRes bool\n\t}\n\treserveMemSpan, _ := opentracing.StartSpanFromContext(ctx, \"memcached_reserve_get_multi_number\")\n\tch := make(chan taskRes)\n\treserveMemSpan.SetTag(\"span.kind\", \"client\")\n\t// check capacity in memcached and mongodb\n\tif itemsMap, err := s.MemcClient.GetMulti(reqCommand); err != nil && err != memcache.ErrCacheMiss {\n\t\treserveMemSpan.Finish()\n\t\tlog.Panic().Msgf(\"Tried to get memc_key [%v], but got memmcached error = %s\", reqCommand, err)\n\t} else {\n\t\treserveMemSpan.Finish()\n\t\t// go through reservation count from memcached\n\t\tgo func() {\n\t\t\tfor k, v := range itemsMap {\n\t\t\t\tid := strings.Split(k, \"_\")[0]\n\t\t\t\tval, _ := strconv.Atoi(string(v.Value))\n\t\t\t\tvar res bool\n\t\t\t\tif val+int(req.RoomNumber) <= cacheCap[id] {\n\t\t\t\t\tres = true\n\t\t\t\t}\n\t\t\t\tch <- taskRes{\n\t\t\t\t\thotelId: id,\n\t\t\t\t\tcheckRes: res,\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err == nil {\n\t\t\t\tclose(ch)\n\t\t\t}\n\t\t}()\n\t\t// use miss reservation to get data from mongo\n\t\t// rever string to indata and outdate\n\t\tif err == memcache.ErrCacheMiss {\n\t\t\tvar wg sync.WaitGroup\n\t\t\tfor k := range itemsMap {\n\t\t\t\tdelete(queryMap, k)\n\t\t\t}\n\t\t\twg.Add(len(queryMap))\n\t\t\tgo func() {\n\t\t\t\twg.Wait()\n\t\t\t\tclose(ch)\n\t\t\t}()\n\t\t\tfor command := range queryMap {\n\t\t\t\tgo func(comm string) {\n\t\t\t\t\tdefer wg.Done()\n\t\t\t\t\treserve := []reservation{}\n\t\t\t\t\ttmpSess := s.MongoSession.Copy()\n\t\t\t\t\tdefer tmpSess.Close()\n\t\t\t\t\tqueryItem := queryMap[comm]\n\t\t\t\t\tc := tmpSess.DB(\"reservation-db\").C(\"reservation\")\n\t\t\t\t\treserveMongoSpan, _ := opentracing.StartSpanFromContext(ctx, \"mongodb_capacity_get_multi_number\"+comm)\n\t\t\t\t\treserveMongoSpan.SetTag(\"span.kind\", \"client\")\n\t\t\t\t\terr := c.Find(&bson.M{\"hotelId\": queryItem[\"hotelId\"], \"inDate\": queryItem[\"startDate\"], \"outDate\": queryItem[\"endDate\"]}).All(&reserve)\n\t\t\t\t\treserveMongoSpan.Finish()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Panic().Msgf(\"Tried to find hotelId [%v] from date [%v] to date [%v], but got error\",\n\t\t\t\t\t\t\tqueryItem[\"hotelId\"], queryItem[\"startDate\"], queryItem[\"endDate\"], err.Error())\n\t\t\t\t\t}\n\t\t\t\t\tvar count int\n\t\t\t\t\tfor _, r := range reserve {\n\t\t\t\t\t\tlog.Trace().Msgf(\"reservation check reservation number = %d\", queryItem[\"hotelId\"])\n\t\t\t\t\t\tcount += r.Number\n\t\t\t\t\t}\n\t\t\t\t\t// update memcached\n\t\t\t\t\tgo s.MemcClient.Set(&memcache.Item{Key: comm, Value: []byte(strconv.Itoa(count))})\n\t\t\t\t\tvar res bool\n\t\t\t\t\tif count+int(req.RoomNumber) <= cacheCap[queryItem[\"hotelId\"]] {\n\t\t\t\t\t\tres = true\n\t\t\t\t\t}\n\t\t\t\t\tch <- taskRes{\n\t\t\t\t\t\thotelId: queryItem[\"hotelId\"],\n\t\t\t\t\t\tcheckRes: res,\n\t\t\t\t\t}\n\t\t\t\t}(command)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor task := range ch {\n\t\tif !task.checkRes {\n\t\t\tresMap[task.hotelId] = false\n\t\t}\n\t}\n\tfor k, v := range resMap {\n\t\tif v {\n\t\t\tres.HotelId = append(res.HotelId, k)\n\t\t}\n\t}\n\n\treturn res, nil\n}", "func (c *Clients) CheckPendingResources(r *ReleaseData) (bool, error) {\n\tlog.Printf(\"Checking pending resources in %s\", r.Name)\n\tvar err error\n\tvar errCount int\n\tvar pArray []bool\n\tif r.Manifest == \"\" {\n\t\treturn true, errors.New(\"Manifest not provided in the request\")\n\t}\n\tinfos, err := c.getManifestDetails(r)\n\tif err != nil {\n\t\t// Retry if resources not found\n\t\t// todo: Need to have retry count\n\t\tre := regexp.MustCompile(\"not found\")\n\t\tif re.MatchString(err.Error()) {\n\t\t\tlog.Println(err.Error())\n\t\t\treturn true, nil\n\t\t}\n\t\treturn true, err\n\t}\n\tfor _, info := range infos {\n\t\tif errCount >= retryCount*2 {\n\t\t\treturn true, fmt.Errorf(\"couldn't get the resources\")\n\t\t}\n\t\tswitch value := kube.AsVersioned(info).(type) {\n\t\tcase *appsv1.Deployment, *appsv1beta1.Deployment, *appsv1beta2.Deployment, *extensionsv1beta1.Deployment:\n\t\t\tcurrentDeployment, err := c.ClientSet.AppsV1().Deployments(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\terrCount++\n\t\t\t\tlog.Printf(\"Warning: Got error getting deployment %s\", err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// If paused deployment will never be ready\n\t\t\tif currentDeployment.Spec.Paused {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !deploymentReady(currentDeployment) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *corev1.PersistentVolumeClaim:\n\t\t\tif !volumeReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *corev1.Service:\n\t\t\tif !serviceReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *extensionsv1beta1.DaemonSet, *appsv1.DaemonSet, *appsv1beta2.DaemonSet:\n\t\t\tds, err := c.ClientSet.AppsV1().DaemonSets(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting daemonset %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !daemonSetReady(ds) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *appsv1.StatefulSet, *appsv1beta1.StatefulSet, *appsv1beta2.StatefulSet:\n\t\t\tsts, err := c.ClientSet.AppsV1().StatefulSets(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting statefulset %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !statefulSetReady(sts) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *extensionsv1beta1.Ingress:\n\t\t\tif !ingressReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *networkingv1beta1.Ingress:\n\t\t\tif !ingressNReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *apiextv1beta1.CustomResourceDefinition:\n\t\t\tif err := info.Get(); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tcrd := &apiextv1beta1.CustomResourceDefinition{}\n\t\t\tif err := scheme.Scheme.Convert(info.Object, crd, nil); err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting CRD %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !crdBetaReady(crd) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *apiextv1.CustomResourceDefinition:\n\t\t\tif err := info.Get(); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tcrd := &apiextv1.CustomResourceDefinition{}\n\t\t\tif err := scheme.Scheme.Convert(info.Object, crd, nil); err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting CRD %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !crdReady(crd) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\t}\n\t}\n\tif len(pArray) > 0 || errCount != 0 {\n\t\treturn true, err\n\t}\n\treturn false, err\n}", "func (s *Storage) IsAvailable() error {\n\tif err := s.db.Ping(); err != nil {\n\t\treturn err\n\t}\n\n\t// This is necessary because once a database connection is initiallly\n\t// established subsequent calls to the Ping method return success even if the\n\t// database goes down.\n\t//\n\t// https://github.com/lib/pq/issues/533\n\tif _, err := s.db.Exec(\"SELECT 1\"); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Client) IsOK() bool {\n\turl := fmt.Sprintf(\"%s/v1/sys/health\", c.addr)\n\n\tr, _ := http.NewRequest(http.MethodGet, url, nil)\n\t//r.Header.Add(\"X-Vault-Token\", \"root\")\n\n\tresp, err := http.DefaultClient.Do(r)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (c *Client) CheckAvailability(ctx context.Context, p *CheckAvailabilityPayload) (res *CheckAvailabilityResponse, err error) {\n\tvar ires interface{}\n\tires, err = c.CheckAvailabilityEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*CheckAvailabilityResponse), nil\n}", "func (m *MountPoint) HasResource(absolutePath string) bool {\n\trelPath, err := filepath.Rel(m.Destination, absolutePath)\n\treturn err == nil && relPath != \"..\" && !strings.HasPrefix(relPath, fmt.Sprintf(\"..%c\", filepath.Separator))\n}", "func IsAvailable() bool {\n\tif kernel32, kernel32Err := syscall.LoadDLL(\"kernel32.dll\"); kernel32Err == nil {\n\t\tif _, vAllocErr := kernel32.FindProc(\"VirtualAlloc\"); vAllocErr != nil {\n\t\t\tfmt.Printf(\"[-] VirtualAlloc error: %s\", vAllocErr.Error())\n\t\t\treturn false\n\t\t}\n\t\tif ntdll, ntdllErr := syscall.LoadDLL(\"ntdll.dll\"); ntdllErr == nil {\n\t\t\tif _, rtlCopyMemErr := ntdll.FindProc(\"RtlCopyMemory\"); rtlCopyMemErr == nil {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"[-] RtlCopyMemory error: %s\", rtlCopyMemErr.Error())\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfmt.Printf(\"[-] LoadDLL error: %s\", kernel32Err.Error())\n\t}\n\treturn false\n}", "func checkAPIResourceIsPresent(available []*meta_v1.APIResourceList, resource meta_v1_unstruct.Unstructured) (*meta_v1.APIResource, bool) {\n\tfor _, rList := range available {\n\t\tif rList == nil {\n\t\t\tcontinue\n\t\t}\n\t\tgroup := rList.GroupVersion\n\t\tfor _, r := range rList.APIResources {\n\t\t\tif group == resource.GroupVersionKind().GroupVersion().String() && r.Kind == resource.GetKind() {\n\t\t\t\tr.Group = rList.GroupVersion\n\t\t\t\tr.Kind = rList.Kind\n\t\t\t\treturn &r, true\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, false\n}", "func (s *Slot) IsAvailable() bool {\n\treturn s.Car == nil\n}", "func (p FnacParser) IsAvailable() (bool, error) {\n\tchromeURL, err := getRemoteDebuggerURL()\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 15 * time.Second)\n\n\tdefer cancel()\n\n\t// create allocator context for use with creating a browser context later\n\tallocatorContext, cancel := chromedp.NewRemoteAllocator(ctx, chromeURL)\n\tdefer cancel()\n\n\t// create context\n\tctxt, cancel := chromedp.NewContext(allocatorContext)\n\tdefer cancel()\n\n\t// run task list\n\tvar nodes []*cdp.Node\n\tif err := chromedp.Run(ctxt,\n\t\tchromedp.Navigate(p.URL),\n\t\tchromedp.WaitVisible(\".f-productHeader-Title\"),\n\t\tchromedp.Nodes(`.f-buyBox-infos>.f-buyBox-availabilityStatus-unavailable`, &nodes, chromedp.ByQuery),\n\t); err != nil {\n\t\tctxt.Done()\n\t\tallocatorContext.Done()\n\n\t\treturn false, err\n\t}\n\n\tctxt.Done()\n\tallocatorContext.Done()\n\n\tif len(nodes) != 2 {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (r pciResource) valid() bool {\n\treturn r.flags != 0 && r.start != 0 && r.end != 0\n}", "func (d *DiscoveryClient) HasResource(apiVersion, kind string) (bool, error) {\n\t// Get supported groups and resources API list.\n\t_, apiLists, err := d.ServerGroupsAndResources()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\t// Compare the API list with the target resource API version and kind.\n\tfor _, apiList := range apiLists {\n\t\tif apiList.GroupVersion == apiVersion {\n\t\t\tfor _, r := range apiList.APIResources {\n\t\t\t\tif r.Kind == kind {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false, nil\n}", "func (r *PackageRow) HasValidAvailable() bool { return r.Data.Available != nil }", "func (s *Synk) crdAvailable(ucrd *unstructured.Unstructured) (bool, error) {\n\tvar crd apiextensions.CustomResourceDefinition\n\tif err := convert(ucrd, &crd); err != nil {\n\t\treturn false, err\n\t}\n\n\t// Get a list of versions to check for.\n\tvar versions []string\n\tfor _, v := range crd.Spec.Versions {\n\t\tif v.Served {\n\t\t\tversions = append(versions, v.Name)\n\t\t}\n\t}\n\n\tfor _, v := range versions {\n\t\tlist, err := s.discovery.ServerResourcesForGroupVersion(crd.Spec.Group + \"/\" + v)\n\t\tif err != nil {\n\t\t\t// We'd like to detect \"not found\" vs network errors here. But unfortunately\n\t\t\t// there's no canonical error being used.\n\t\t\tlog.Printf(\"ServerResourcesForGroupVersion(%s/%s) failed: %v\", crd.Spec.Group, v, err)\n\t\t\treturn false, nil\n\t\t}\n\t\tfound := false\n\t\tfor _, r := range list.APIResources {\n\t\t\tif r.Name == crd.Spec.Names.Plural {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\treturn true, nil\n}", "func isResourceGuaranteed(container *v1.Container, resource v1.ResourceName) bool {\n\t// A container resource is guaranteed if its request == limit.\n\t// If request == limit, the user is very confident of resource consumption.\n\treq, hasReq := container.Resources.Requests[resource]\n\tlimit, hasLimit := container.Resources.Limits[resource]\n\tif !hasReq || !hasLimit {\n\t\treturn false\n\t}\n\treturn req.Cmp(limit) == 0 && req.Value() != 0\n}", "func isResourceGuaranteed(container *api.Container, resource api.ResourceName) bool {\n\t// A container resource is guaranteed if its request == limit.\n\t// If request == limit, the user is very confident of resource consumption.\n\treq, hasReq := container.Resources.Requests[resource]\n\tlimit, hasLimit := container.Resources.Limits[resource]\n\tif !hasReq || !hasLimit {\n\t\treturn false\n\t}\n\treturn req.Cmp(limit) == 0 && req.Value() != 0\n}", "func (ac *azureClient) GetByResource(ctx context.Context, resourceURI string) (resourcehealth.AvailabilityStatus, error) {\n\tctx, _, done := tele.StartSpanWithLogger(ctx, \"resourcehealth.AzureClient.GetByResource\")\n\tdefer done()\n\n\treturn ac.availabilityStatuses.GetByResource(ctx, resourceURI, \"\", \"\")\n}", "func (m *Resource) IsOK() bool {\n\tswitch {\n\tcase len(m.name) == 0:\n\t\treturn false\n\tcase len(m.description) == 0:\n\t\treturn false\n\tcase m.schema == nil:\n\t\treturn false\n\tcase m.model == nil:\n\t\treturn false\n\tcase m.store == nil:\n\t\treturn false\n\tcase len(m.methods) == 0:\n\t\treturn false\n\tdefault:\n\t\treturn true\n\t}\n}", "func isUnavailable(r *reconcilable) bool {\n\treturn !r.entry.Plan.InSync || isInDrain(r.entry) || (!r.change && !r.minorChange && !r.entry.Plan.Healthy)\n}", "func IsAvailable() bool {\n\tif isAvailable_ < 0 {\n\t\ttoolName_ = \"\"\n\t\tisAvailable_ = 0\n\n\t\tcandidates := []string{\n\t\t\t\"gvfs-trash\",\n\t\t\t\"trash\",\n\t\t}\n\n\t\tfor _, candidate := range candidates {\n\t\t\terr := exec.Command(\"type\", candidate).Run()\n\t\t\tok := false\n\t\t\tif err == nil {\n\t\t\t\tok = true\n\t\t\t} else {\n\t\t\t\terr = exec.Command(\"sh\", \"-c\", \"type \"+candidate).Run()\n\t\t\t\tif err == nil {\n\t\t\t\t\tok = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ok {\n\t\t\t\ttoolName_ = candidate\n\t\t\t\tisAvailable_ = 1\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t} else if isAvailable_ == 1 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsAvailable() (bool, error) {\n\terr := modwevtapi.Load()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "func (r *Resource) Valid() bool {\n\tif r.Spec == nil {\n\t\tfmt.Println(\"no resource spec\")\n\t\treturn false\n\t}\n\n\treturn r.Spec.Valid()\n}", "func WaitUntilHealthy(ctx context.Context, client client.Client, namespace, name string) error {\n\tobj := &resourcesv1alpha1.ManagedResource{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t}\n\n\treturn retry.Until(ctx, IntervalWait, func(ctx context.Context) (done bool, err error) {\n\t\tif err := client.Get(ctx, kutil.Key(namespace, name), obj); err != nil {\n\t\t\treturn retry.SevereError(err)\n\t\t}\n\n\t\tif err := health.CheckManagedResource(obj); err != nil {\n\t\t\treturn retry.MinorError(fmt.Errorf(\"managed resource %s/%s is not healthy\", namespace, name))\n\t\t}\n\n\t\treturn retry.Ok()\n\t})\n}", "func check_if_open(url string) bool {\n\n client := http.Client{Timeout: time.Duration(5 * time.Second)} // Create a custom client\n resp, err := client.Get(\"https://\" + url + \"/about\"); // Request the instance with the custom client\n\n ans := false; // Always assume it's closed\n\n if err == nil {\n raw_body, err := ioutil.ReadAll(resp.Body); // Parse the body to bytes\n if err == nil {\n if !strings.Contains(string(raw_body), \"closed-registrations-message\") {\n ans = true;\n }\n }\n defer resp.Body.Close(); // Close the connection\n }\n return ans;\n}", "func (o *ResourcepoolPoolMember) HasResource() bool {\n\tif o != nil && o.Resource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func checkResource(config interface{}, resource *unstructured.Unstructured) (bool, error) {\n\n\t// we are checking if config is a subset of resource with default pattern\n\tpath, err := validateResourceWithPattern(resource.Object, config)\n\tif err != nil {\n\t\tglog.V(4).Infof(\"config not a subset of resource. failed at path %s: %v\", path, err)\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "func (_OracleMgr *OracleMgrSession) HasAvailability() (bool, error) {\n\treturn _OracleMgr.Contract.HasAvailability(&_OracleMgr.CallOpts)\n}", "func (b *Box) Available() bool {\n\treturn b.Status == StatusDeploying ||\n\t\tb.Status == StatusCreating ||\n\t\tb.Status == StatusError\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 checkVaultHealth() (error) {\n\n // execute ping request to docker socket\n response, err := http.Head(vaultUrl(\"sys/health\"))\n\n // fail if an error occurs during transport\n if err != nil {\n return fmt.Errorf(\"Failed to connect to vault at %s\", err)\n }\n\n // fail if vault did not respond with 200 response code\n if response.StatusCode != 200 {\n return fmt.Errorf(\"Found unhealthy or sealed vault at %s\", config.VaultAddr)\n }\n\n return nil\n}", "func IsAvailableHealthyReplica(r *longhorn.Replica) bool {\n\tif r == nil {\n\t\treturn false\n\t}\n\tif r.DeletionTimestamp != nil {\n\t\treturn false\n\t}\n\tif r.Spec.FailedAt != \"\" || r.Spec.HealthyAt == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func (r resourceFactory) getResourceDataOKExists(schemaDefinitionPropertyName string, resourceLocalData *schema.ResourceData) (interface{}, bool) {\n\tresourceSchema, _ := r.openAPIResource.getResourceSchema()\n\tschemaDefinitionProperty, err := resourceSchema.getProperty(schemaDefinitionPropertyName)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\treturn resourceLocalData.GetOkExists(schemaDefinitionProperty.getTerraformCompliantPropertyName())\n}", "func (c *Client) IsAvailable() bool {\n\tc.muForCall.Lock()\n\tdefer c.muForCall.Unlock()\n\n\treturn !c.closing && !c.shutdown\n}", "func NamespaceForResourceIsReady(resource common.ComponentResource) (bool, error) {\n\t// create a stub namespace resource to pass to the NamespaceIsReady method\n\tnamespace := &Resource{\n\t\tReconciler: resource.GetReconciler(),\n\t}\n\n\t// insert the inherited fields\n\tnamespace.Name = resource.GetNamespace()\n\tnamespace.Group = \"\"\n\tnamespace.Version = \"v1\"\n\tnamespace.Kind = NamespaceKind\n\n\treturn NamespaceIsReady(namespace)\n}", "func (_OracleMgr *OracleMgrCallerSession) HasAvailability() (bool, error) {\n\treturn _OracleMgr.Contract.HasAvailability(&_OracleMgr.CallOpts)\n}", "func (m *Repository) Availability(w http.ResponseWriter, r *http.Request) {\n\trender2.RenderTemplate(w, \"search-availability.page.tmpl\", &models2.TemplateData{}, r)\n}", "func (reg *ResourceRegistry) IsSupported(resourceType string) bool {\n\t_, ok := reg.headers[resourceType]\n\treturn ok\n}", "func (r *Repository) IsURLBusy(ctx context.Context, url string) (bool, error) {\r\n\tcount, err := r.officeCollection.CountDocuments(\r\n\t\tctx,\r\n\t\tbson.M{\r\n\t\t\t\"url\": url,\r\n\t\t})\r\n\tif err != nil {\r\n\t\treturn false, err\r\n\t}\r\n\tif count > 0 {\r\n\t\treturn false, err\r\n\t}\r\n\r\n\treturn true, nil\r\n}", "func (s *State) ensureResource(address, provider, typ string, skipped bool) {\n\tif _, ok := s.Resources[address]; !ok {\n\t\tres := Resource{\n\t\t\tProvider: provider,\n\t\t\tType: typ,\n\t\t\tSkipped: skipped,\n\t\t}\n\n\t\tif !skipped {\n\t\t\tres.Components = make(map[string]Component)\n\t\t}\n\n\t\ts.Resources[address] = res\n\t}\n}", "func (i *TiFlashInstance) Ready(ctx context.Context, e ctxt.Executor, timeout uint64, tlsCfg *tls.Config) error {\n\t// FIXME: the timeout is applied twice in the whole `Ready()` process, in the worst\n\t// case it might wait double time as other components\n\tif err := PortStarted(ctx, e, i.GetServicePort(), timeout); err != nil {\n\t\treturn err\n\t}\n\n\tscheme := \"http\"\n\tif i.topo.BaseTopo().GlobalOptions.TLSEnabled {\n\t\tscheme = \"https\"\n\t}\n\taddr := fmt.Sprintf(\"%s://%s/tiflash/store-status\", scheme, utils.JoinHostPort(i.GetManageHost(), i.GetStatusPort()))\n\treq, err := http.NewRequest(\"GET\", addr, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq = req.WithContext(ctx)\n\n\tretryOpt := utils.RetryOption{\n\t\tDelay: time.Second,\n\t\tTimeout: time.Second * time.Duration(timeout),\n\t}\n\tvar queryErr error\n\tif err := utils.Retry(func() error {\n\t\tclient := utils.NewHTTPClient(statusQueryTimeout, tlsCfg)\n\t\tres, err := client.Client().Do(req)\n\t\tif err != nil {\n\t\t\tqueryErr = err\n\t\t\treturn err\n\t\t}\n\t\tdefer res.Body.Close()\n\t\tbody, err := io.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\tqueryErr = err\n\t\t\treturn err\n\t\t}\n\t\tif res.StatusCode == http.StatusNotFound || string(body) == \"Running\" {\n\t\t\treturn nil\n\t\t}\n\n\t\terr = fmt.Errorf(\"tiflash store status is '%s', not fully running yet\", string(body))\n\t\tqueryErr = err\n\t\treturn err\n\t}, retryOpt); err != nil {\n\t\treturn perrs.Annotatef(queryErr, \"timed out waiting for tiflash %s:%d to be ready after %ds\",\n\t\t\ti.Host, i.Port, timeout)\n\t}\n\treturn nil\n}", "func (c *Client) IsAvailable() bool {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\treturn !c.shutdown && !c.closing\n}", "func (h *ProxyHealth) IsAvailable() bool {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\treturn h.isAvailable\n}", "func (c *ETHController) IsAvailable(domain string) (bool, error) {\n\tname, err := UnqualifiedName(domain, c.domain)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"invalid name %s\", domain)\n\t}\n\treturn c.Contract.Available(nil, name)\n}", "func (f *azurePostgresFlexServerFetcher) isAvailable(server *armpostgresqlflexibleservers.Server, log logrus.FieldLogger) bool {\n\tstate := armpostgresqlflexibleservers.ServerState(azure.StringVal(server.Properties.State))\n\tswitch state {\n\tcase armpostgresqlflexibleservers.ServerStateReady, armpostgresqlflexibleservers.ServerStateUpdating:\n\t\treturn true\n\tcase armpostgresqlflexibleservers.ServerStateDisabled,\n\t\tarmpostgresqlflexibleservers.ServerStateDropping,\n\t\tarmpostgresqlflexibleservers.ServerStateStarting,\n\t\tarmpostgresqlflexibleservers.ServerStateStopped,\n\t\tarmpostgresqlflexibleservers.ServerStateStopping:\n\t\t// server state is known and it's not available.\n\t\treturn false\n\t}\n\tlog.Warnf(\"Unknown status type: %q. Assuming Azure PostgreSQL Flexible server %q is available.\",\n\t\tstate,\n\t\tazure.StringVal(server.Name))\n\treturn true\n}", "func isAvailable(algo string) (bool, error) {\n\tc, ok := stringToHash[algo]\n\tif !ok {\n\t\treturn false, fmt.Errorf(\"no match for %q\", algo)\n\t}\n\tif isForbiddenHash(c) {\n\t\treturn false, fmt.Errorf(\"forbidden hash type in %q\", algo)\n\t}\n\treturn c.Available(), nil\n}", "func (w *Strap) checkResource(req *Request) (*Resource, error) {\n\n\tfor key, r := range w.resources {\n\t\tfor _, rr := range *r {\n\t\t\tif key == req.Name && rr.Method == strings.ToUpper(req.Method) {\n\t\t\t\treturn rr, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, errors.New(\"Invalid resource or method\")\n}", "func (as *AppServant) IsReady() bool {\n\treturn as.RetIsReady\n}", "func IsUnavailable(err error) bool {\r\n\tvar t Unavailable\r\n\treturn errors.As(err, &t)\r\n}", "func (c *Client) IsAvailable() bool {\n\tclient, _, err := c.selectSession(c.addr)\n\treturn err == nil &&\n\t\t// defensive check\n\t\tclient != nil\n}", "func (r *Reddit) IsAvailable(name string) (bool, error) {\n\treturn fetch.IsNotFound(r.client, fmt.Sprintf(\"https://www.reddit.com/user/%s\", url.QueryEscape(name)))\n}", "func (r *Resource) Poll() string {\n\tresp, err := http.Head(r.url)\n\tif err != nil {\n\t\tlog.Println(\"Error\", r.url, err)\n\t\tr.errCount++\n\t\treturn err.Error()\n\t}\n\tr.errCount = 0\n\treturn resp.Status\n}", "func isHealthMonitorRefValid(refName string, gdp bool, fullSync bool) bool {\n\tif fullSync && isHealthMonitorRefPresentInCache(refName) {\n\t\tgslbutils.Debugf(\"health monitor %s present in hm cache\", refName)\n\t\treturn true\n\t}\n\taviClient := avictrl.SharedAviClients().AviClient[0]\n\turi := \"api/healthmonitor?name=\" + refName\n\n\tresult, err := gslbutils.GetUriFromAvi(uri, aviClient, gdp)\n\tif err != nil {\n\t\tgslbutils.Errf(\"Error in getting uri %s from Avi: %v\", uri, err)\n\t\treturn false\n\t}\n\tif result.Count == 0 {\n\t\tgslbutils.Errf(\"Health Monitor %s does not exist\", refName)\n\t\treturn false\n\t}\n\tgslbutils.Logf(\"health monitor %s fetched from controller\", refName)\n\telems := make([]json.RawMessage, result.Count)\n\terr = json.Unmarshal(result.Results, &elems)\n\tif err != nil {\n\t\tgslbutils.Errf(\"failed to unmarshal health monitor data for ref %s: %v\", refName, err)\n\t\treturn false\n\t}\n\thm := models.HealthMonitor{}\n\terr = json.Unmarshal(elems[0], &hm)\n\tif err != nil {\n\t\tgslbutils.Errf(\"failed to unmarshal the first health monitor element: %v\", err)\n\t\treturn false\n\t}\n\tif hm.IsFederated != nil && *hm.IsFederated {\n\t\treturn true\n\t} else {\n\t\tgslbutils.Errf(\"health monitor ref %s is not federated, can't add\", refName)\n\t}\n\treturn false\n}", "func (client *Client) IsAvailable() bool {\n\tclient.mu.Lock()\n\tdefer client.mu.Unlock()\n\treturn !client.shutdown && !client.closing\n}", "func check() *v1.CustomResourceDefinition {\n\tconfig := getConfig()\n\tapiExtClient, err := apiextv1.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcrdInfo, err := apiExtClient.CustomResourceDefinitions().Get(context.TODO(), postgresConstants.PostgresCRDResouceName, metav1.GetOptions{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif crdInfo.Name == postgresConstants.PostgresCRDResouceName {\n\t\tfmt.Printf(\"Postgres Operator is installed in the k8s cluster.\\n\")\n\t} else {\n\t\tfmt.Printf(\"Postgres Operator is not installed in the k8s cluster.\\n\")\n\t}\n\treturn crdInfo\n}", "func isEsxRechable(esxIP string) bool {\n\tCommand := sshToLandingMachine + \"'ping -c 1 \" + esxIP + \" > /dev/null && echo true || echo false'\"\n\toutput, _ := exec.Command(\"/bin/sh\", \"-c\", Command).Output()\n\tcommandOutput := (string(output))\n\tif strings.Contains(string(commandOutput), \"false\") {\n\t\tfmt.Printf(getTime()+\" ESX-%s is not reachable\\n\", esxIP)\n\t\treturn false\n\t}\n\tfmt.Printf(getTime()+\" ESX-%s is reachable\\n\", esxIP)\n\treturn true\n\n}", "func isBasicResource(name v1.ResourceName) bool {\n\tswitch name {\n\tcase v1.ResourceCPU, v1.ResourceMemory, v1.ResourcePods:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func (o *User) HasResource() bool {\n\tif o != nil && o.Resource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (client IotHubResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "func (r *Release) remoteExist() error {\n\tvar (\n\t\turl string = fmt.Sprintf(PathTerraform.toString(), r.Version, r.Version, runtime.GOOS, runtime.GOARCH)\n\t\tresp *http.Response\n\t\terr error\n\t)\n\n\tif resp, err = r.HTTPclient.Get(url); err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\t// Verify code equal 200\n\tif resp.StatusCode == http.StatusOK {\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func (client IotHubResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result IotHubNameAvailabilityInfo, 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 (cli *KodderClient) Ready() (bool, error) {\n\treq, err := http.NewRequest(\"GET\", \"http://localhost/ready\", nil)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tresp, err := cli.HTTPDo(req)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer resp.Body.Close()\n\treturn resp.StatusCode == http.StatusOK, nil\n}", "func (r *PackageRow) GetAvailable() bool { return *r.Data.Available }", "func (fs *Fs) IsDeviceOrResourceBusy(err error) bool {\n\treturn errors.Unwrap(err) == syscall.EBUSY\n}", "func (h *Handler) checkAccessToRegisteredResource(w http.ResponseWriter, r *http.Request, p httprouter.Params, c *SessionContext, site reversetunnel.RemoteSite) (interface{}, error) {\n\t// Get a client to the Auth Server with the logged in user's identity. The\n\t// identity of the logged in user is used to fetch the list of resources.\n\tclt, err := c.GetUserClient(site)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tresourceKinds := []string{types.KindNode, types.KindDatabaseServer, types.KindAppServer, types.KindKubeService, types.KindWindowsDesktop}\n\tfor _, kind := range resourceKinds {\n\t\tres, err := clt.ListResources(r.Context(), proto.ListResourcesRequest{\n\t\t\tResourceType: kind,\n\t\t\tLimit: 1,\n\t\t})\n\n\t\tif err != nil {\n\t\t\t// Access denied error is returned when user does not have permissions\n\t\t\t// to read/list a resource kind which can be ignored as this function is not\n\t\t\t// about checking if user has the right perms.\n\t\t\tif trace.IsAccessDenied(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\tif len(res.Resources) > 0 {\n\t\t\treturn checkAccessToRegisteredResourceResponse{\n\t\t\t\tHasResource: true,\n\t\t\t}, nil\n\t\t}\n\t}\n\n\treturn checkAccessToRegisteredResourceResponse{\n\t\tHasResource: false,\n\t}, nil\n}", "func (ro *ResourceOperations) CheckExistence(resourceGroupName string, identity *ResourceIdentity) (*ResourceExistsResult, *AzureOperationResponse, error) {\n\t_, azureOperationResponse, err := ro.Get(resourceGroupName, identity)\n\n\tresult := ResourceExistsResult{Exists: true}\n\n\tif err != nil {\n\t\tswitch err.(type) {\n\t\tcase Error:\n\t\t\terror := err.(Error)\n\t\t\tif error.StatusCode == 404 {\n\t\t\t\tresult.Exists = false\n\t\t\t\treturn &result, error.AzureOperationResponse, nil\n\t\t\t} else {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\treturn &result, azureOperationResponse, nil\n}", "func (tc *E2ETestFramework) WaitForResourceCondition(namespace, kind, name, selector, jsonPath string, maxtimes int, isSatisfied func(string) (bool, error)) error {\n\ttimes := 0\n\treturn wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, defaultTimeout, true, func(cxt context.Context) (done bool, err error) {\n\t\tout, err := oc.Get().WithNamespace(namespace).Resource(kind, name).Selector(selector).OutputJsonpath(jsonPath).Run()\n\t\tclolog.V(3).Error(err, \"Error returned from retrieving resources\")\n\t\tif err == nil {\n\t\t\tmet, err := isSatisfied(out)\n\t\t\tif err != nil {\n\t\t\t\ttimes = 0\n\t\t\t\tclolog.V(3).Error(err, \"Error returned from condition check\")\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tif met {\n\t\t\t\ttimes++\n\t\t\t\tclolog.V(3).Info(\"Condition met\", \"success\", times, \"need\", maxtimes)\n\t\t\t} else {\n\t\t\t\ttimes = 0\n\t\t\t}\n\t\t\tif times == maxtimes {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t\treturn false, nil\n\t})\n}", "func getAvailableResources(clientBuilder corecontroller.ClientBuilder) (map[schema.GroupVersionResource]bool, error) {\n\tvar discoveryClient discovery.DiscoveryInterface\n\n\tvar healthzContent string\n\t// If apiserver is not running we should wait for some time and fail only then. This is particularly\n\t// important when we start apiserver and controller manager at the same time.\n\terr := wait.PollImmediate(time.Second, 10*time.Second, func() (bool, error) {\n\t\tclient, err := clientBuilder.Client(\"controller-discovery\")\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Failed to get api versions from server: %v\", err)\n\t\t\treturn false, nil\n\t\t}\n\n\t\thealthStatus := 0\n\t\tresp := client.Discovery().RESTClient().Get().AbsPath(\"/healthz\").Do(context.TODO()).StatusCode(&healthStatus)\n\t\tif healthStatus != http.StatusOK {\n\t\t\tklog.Errorf(\"Server isn't healthy yet. Waiting a little while.\")\n\t\t\treturn false, nil\n\t\t}\n\t\tcontent, _ := resp.Raw()\n\t\thealthzContent = string(content)\n\n\t\tdiscoveryClient = client.Discovery()\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get api versions from server: %v: %v\", healthzContent, err)\n\t}\n\n\tresourceMap, err := discoveryClient.ServerResources()\n\tif err != nil {\n\t\tutilruntime.HandleError(fmt.Errorf(\"unable to get all supported resources from server: %v\", err))\n\t}\n\tif len(resourceMap) == 0 {\n\t\treturn nil, fmt.Errorf(\"unable to get any supported resources from server\")\n\t}\n\n\tallResources := map[schema.GroupVersionResource]bool{}\n\tfor _, apiResourceList := range resourceMap {\n\t\tversion, err := schema.ParseGroupVersion(apiResourceList.GroupVersion)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, apiResource := range apiResourceList.APIResources {\n\t\t\tallResources[version.WithResource(apiResource.Name)] = true\n\t\t}\n\t}\n\n\treturn allResources, nil\n}", "func (o *ReconciliationTarget) HasResource() bool {\n\tif o != nil && o.Resource != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func waitForAwsResource(name, event string, c *client.Client) error {\n\ttick := time.Tick(time.Second * 2)\n\ttimeout := time.After(time.Minute * 5)\n\tfmt.Printf(\"Waiting for %s \", name)\n\tfailedEv := event + \"_FAILED\"\n\tcompletedEv := event + \"_COMPLETE\"\nLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-tick:\n\t\t\trs, err := c.GetResource(name)\n\t\t\tif err != nil {\n\t\t\t\tif event == \"DELETE\" {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Print(\".\")\n\t\t\tif rs.Status == failedEv {\n\t\t\t\treturn fmt.Errorf(\"%s failed because of \\\"%s\\\"\", event, rs.StatusReason)\n\t\t\t}\n\t\t\tif rs.Status == completedEv {\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\tcase <-timeout:\n\t\t\tfmt.Print(\"timeout (5 minutes). Skipping\")\n\t\t\tbreak Loop\n\t\t}\n\t}\n\n\treturn nil\n}" ]
[ "0.6957629", "0.65660626", "0.6525871", "0.6500754", "0.63357186", "0.6233591", "0.6208432", "0.62077105", "0.61648816", "0.61453456", "0.6126107", "0.61117184", "0.6087532", "0.60803294", "0.6074985", "0.6069196", "0.6069196", "0.6064944", "0.60560715", "0.6051149", "0.60148805", "0.5991744", "0.5991744", "0.5976544", "0.5956051", "0.595348", "0.59422565", "0.59126973", "0.58969665", "0.5892281", "0.58914316", "0.5889376", "0.58779925", "0.58687305", "0.5867567", "0.58578914", "0.5850784", "0.5850639", "0.5850622", "0.5843006", "0.58393", "0.58275664", "0.5772423", "0.57722807", "0.5757965", "0.57577795", "0.5756747", "0.57487446", "0.57423234", "0.5735431", "0.5725544", "0.571582", "0.5678388", "0.56682837", "0.56627196", "0.5654789", "0.5649467", "0.56220686", "0.5617031", "0.5608795", "0.5592545", "0.55841863", "0.55798405", "0.5578086", "0.557426", "0.55718094", "0.55696183", "0.5559915", "0.5550951", "0.5540522", "0.5540405", "0.55388886", "0.5515", "0.55107236", "0.5505985", "0.5501621", "0.54845047", "0.54801434", "0.54737425", "0.5472707", "0.5469815", "0.54547805", "0.54539204", "0.54465324", "0.5441602", "0.5440554", "0.54369324", "0.54294974", "0.5423441", "0.54223096", "0.54187495", "0.5413653", "0.54127073", "0.54102343", "0.5408023", "0.5393811", "0.53912336", "0.53898287", "0.5388258", "0.53876126" ]
0.6669036
1
NewLocalCollector returns a Collector that writes directly to a Store.
func NewLocalCollector(s Store) Collector { return s }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCollector(store *store.MemoryStore) *Collector {\n\treturn &Collector{\n\t\tstore: store,\n\t\tstopChan: make(chan struct{}),\n\t\tdoneChan: make(chan struct{}),\n\t}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &storageCollector{}\n}", "func NewCollector() Collector {\n\treturn make(Collector)\n}", "func New() *Collector { return &Collector{} }", "func NewCollector(period time.Duration, collectFunc func() []Measurement) *Collector {\n\tcollector := &Collector{\n\t\tperiod: period,\n\t\tcollectFunc: collectFunc,\n\t\tlastSendingDate: -1,\n\t}\n\n\tif sources == nil {\n\t\tsources = make([]DataSource, 0)\n\t\tgo sendingLoop()\n\t}\n\n\tif UseGlobalEngine {\n\t\tcollector.Engine = Engine\n\t} else {\n\t\tcollector.Engine = &req.Engine{}\n\t}\n\n\tsources = append(sources, collector)\n\n\treturn collector\n}", "func NewLocalRouterCollector(ctx context.Context, logger *slog.Logger, errors *prometheus.CounterVec, client platform.LocalRouterClient) *LocalRouterCollector {\n\terrors.WithLabelValues(\"local_router\").Add(0)\n\n\tlocalRouterLabels := []string{\"id\", \"name\"}\n\tlocalRouterInfoLabels := append(localRouterLabels, \"tags\", \"description\")\n\tlocalRouterSwitchInfoLabels := append(localRouterLabels, \"category\", \"code\", \"zone_id\")\n\tlocalRouterServerNetworkInfoLabels := append(localRouterLabels, \"vip\", \"ipaddress1\", \"ipaddress2\", \"nw_mask_len\", \"vrid\")\n\tlocalRouterPeerLabels := append(localRouterLabels, \"peer_index\", \"peer_id\")\n\tlocalRouterPeerInfoLabels := append(localRouterPeerLabels, \"enabled\", \"description\")\n\tlocalRouterStaticRouteInfoLabels := append(localRouterLabels, \"route_index\", \"prefix\", \"next_hop\")\n\n\treturn &LocalRouterCollector{\n\t\tctx: ctx,\n\t\tlogger: logger,\n\t\terrors: errors,\n\t\tclient: client,\n\t\tUp: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_up\",\n\t\t\t\"If 1 the LocalRouter is available, 0 otherwise\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t\tLocalRouterInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_info\",\n\t\t\t\"A metric with a constant '1' value labeled by localRouter information\",\n\t\t\tlocalRouterInfoLabels, nil,\n\t\t),\n\t\tSwitchInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_switch_info\",\n\t\t\t\"A metric with a constant '1' value labeled by localRouter connected switch information\",\n\t\t\tlocalRouterSwitchInfoLabels, nil,\n\t\t),\n\t\tNetworkInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_network_info\",\n\t\t\t\"A metric with a constant '1' value labeled by network information of the localRouter\",\n\t\t\tlocalRouterServerNetworkInfoLabels, nil,\n\t\t),\n\t\tPeerInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_peer_info\",\n\t\t\t\"A metric with a constant '1' value labeled by peer information\",\n\t\t\tlocalRouterPeerInfoLabels, nil,\n\t\t),\n\t\tPeerUp: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_peer_up\",\n\t\t\t\"If 1 the Peer is available, 0 otherwise\",\n\t\t\tlocalRouterPeerLabels, nil,\n\t\t),\n\t\tStaticRouteInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_static_route_info\",\n\t\t\t\"A metric with a constant '1' value labeled by static route information\",\n\t\t\tlocalRouterStaticRouteInfoLabels, nil,\n\t\t),\n\t\tReceiveBytesPerSec: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_receive_per_sec\",\n\t\t\t\"Receive bytes per seconds\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t\tSendBytesPerSec: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_send_per_sec\",\n\t\t\t\"Send bytes per seconds\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t}\n}", "func New() *LocalStore {\n\treturn &LocalStore{}\n}", "func NewCollector(storageLocation v1.StorageLocation, gitter gits.Gitter, gitKind string) (Collector, error) {\n\tclassifier := storageLocation.Classifier\n\tif classifier == \"\" {\n\t\tclassifier = \"default\"\n\t}\n\tgitURL := storageLocation.GitURL\n\tif gitURL != \"\" {\n\t\treturn NewGitCollector(gitter, gitURL, storageLocation.GetGitBranch(), gitKind)\n\t}\n\tbucketProvider, err := factory.NewBucketProviderFromTeamSettingsConfigurationOrDefault(clients.NewFactory(), storageLocation)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"there was a problem obtaining the bucket provider from cluster configuratio\")\n\t}\n\treturn NewBucketCollector(storageLocation.BucketURL, classifier, bucketProvider)\n}", "func NewCollector(config *CollectorConfig) (Collector, error) {\n\tc := &standardCollector{\n\t\trunning: true,\n\t\tevents: make(chan Event, config.EventBufferSize),\n\t\tconfig: config,\n\t\tneighbors: make(map[string]neighbor),\n\t\tRWMutex: &sync.RWMutex{},\n\t}\n\n\treturn c, nil\n}", "func NewLocalStore() *LocalStore {\n\treturn &LocalStore{\n\t\tstore: make(map[string]string),\n\t\tlock: &sync.RWMutex{},\n\t}\n}", "func NewCollector(ctx context.Context, cc *collector.CollectorContext, collectDuration prometheus.Observer) prometheus.Collector {\n\treturn &StorageDomainCollector{\n\t\trootCtx: ctx,\n\t\tcc: cc,\n\t\tcollectDuration: collectDuration,\n\t}\n}", "func NewCollector() Collector {\n\treturn Collector{client: NewClient(time.Second * 5)}\n}", "func NewCollector(store *forensicstore.ForensicStore, tempDir string, definitions []goartifacts.ArtifactDefinition) (*LiveCollector, error) {\n\tprovidesMap := map[string][]goartifacts.Source{}\n\n\tdefinitions = goartifacts.FilterOS(definitions)\n\n\tfor _, definition := range definitions {\n\t\tfor _, source := range definition.Sources {\n\t\t\tfor _, provide := range source.Provides {\n\t\t\t\tkey := strings.TrimPrefix(provide.Key, \"environ_\")\n\t\t\t\tif providingSources, ok := providesMap[key]; !ok {\n\t\t\t\t\tprovidesMap[key] = []goartifacts.Source{source}\n\t\t\t\t} else {\n\t\t\t\t\tprovidesMap[key] = append(providingSources, source)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsourceFS, err := systemfs.New()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"system fs creation failed: %w\", err)\n\t}\n\n\treturn &LiveCollector{\n\t\tSourceFS: sourceFS,\n\t\tregistryfs: registryfs.New(),\n\t\tStore: store,\n\t\tTempDir: tempDir,\n\t\tprovidesMap: providesMap,\n\t\tknowledgeBase: map[string][]string{},\n\t}, nil\n}", "func New() Collector {\n\treturn &collector{\n\t\tinner: sigar.ConcreteSigar{},\n\t}\n}", "func NewLocalAmboyStatsCollector(env cedar.Environment, id string) amboy.Job {\n\tj := makeAmboyStatsCollector()\n\tj.ExcludeRemote = true\n\tj.env = env\n\tj.SetID(fmt.Sprintf(\"%s-%s\", amboyStatsCollectorJobName, id))\n\treturn j\n}", "func NewCollector() *Collector {\n\twg := &sync.WaitGroup{}\n\tevtCh := make(chan *eventsapi.ClientEvent, collChanBufferSize)\n\n\tc := &Collector{&atomic.Value{}, wg, evtCh}\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\n\t\tvar events []*eventsapi.ClientEvent\n\t\tfor evt := range evtCh {\n\t\t\tevents = append(events, evt)\n\t\t}\n\n\t\tc.val.Store(events)\n\t}()\n\n\treturn c\n}", "func NewCollector() *Collector {\n\tcollector := &Collector{\n\t\tresults: make(chan interface{}, 100),\n\t\tdone: make(chan interface{}),\n\t}\n\tgo collector.process()\n\treturn collector\n}", "func NewLocalStore() (Store, error) {\n\t_, address := utils.StartLocalNode()\n\treturn newLocalStore(address)\n}", "func NewCollector(cl client.Client) prometheus.Collector {\n\treturn &collector{\n\t\tcl: cl,\n\t}\n}", "func NewCollector(brokerURL string, s storage.Storage) *Collector {\n\tbroker, err := NewBroker(brokerURL)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tch, err := broker.Channel()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_, err = ch.QueueDeclare(\n\t\tspecsQueueName, // name\n\t\ttrue, // durable\n\t\tfalse, // delete when usused\n\t\tfalse, // exclusive\n\t\tfalse, // noWait\n\t\tnil, // arguments\n\t)\n\n\tdc, _ := ch.Consume(\n\t\tspecsQueueName, // queue\n\t\t\"\", // consumer\n\t\ttrue, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\n\treturn &Collector{broker, ch, dc, s}\n}", "func NewCollector(api API) *Collector {\n\treturn &Collector{api: api}\n}", "func NewLocal() build_remote.ExecutionCacheServiceServer {\n\tstore, err := action.NewOnDisk()\n\tif err != nil {\n\t\tlog.Fatalf(\"could not initialise ExecutionCacheService: %v\", err)\n\t}\n\treturn &local{store}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &interfaceCollector{}\n}", "func NewCollector() (prometheus.Collector, error) {\n\treturn &collector{}, nil\n}", "func NewCollector(\n\tlogger *log.Logger, server lxd.InstanceServer) prometheus.Collector {\n\treturn &collector{logger: logger, server: server}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &environmentCollector{}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &environmentCollector{}\n}", "func New(logger logrus.FieldLogger, conf Config) (*Collector, error) {\n\tproducer, err := sarama.NewSyncProducer(conf.Brokers, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Collector{\n\t\tProducer: producer,\n\t\tConfig: conf,\n\t\tlogger: logger,\n\t}, nil\n}", "func NewCollector(config *Config) (coll *Collector, err error) {\n\tvar gelfWriter *gelf.Writer\n\n\tif gelfWriter, err = gelf.NewWriter(config.Graylog.Address); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcoll = new(Collector)\n\tcoll.writer = gelfWriter\n\tcoll.host = config.Collector.Hostname\n\n\treturn coll, nil\n}", "func NewUseCollector() *Use {\n\treturn &Use{}\n}", "func NewCollector(cfg *config.AgentConfig) TelemetryCollector {\n\tif !cfg.TelemetryConfig.Enabled {\n\t\treturn &noopTelemetryCollector{}\n\t}\n\n\tvar endpoints []config.Endpoint\n\tfor _, endpoint := range cfg.TelemetryConfig.Endpoints {\n\t\tu, err := url.Parse(endpoint.Host)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tu.Path = \"/api/v2/apmtelemetry\"\n\t\tendpointWithPath := *endpoint\n\t\tendpointWithPath.Host = u.String()\n\n\t\tendpoints = append(endpoints, endpointWithPath)\n\t}\n\n\treturn &telemetryCollector{\n\t\tclient: cfg.NewHTTPClient(),\n\t\tendpoints: endpoints,\n\t\tuserAgent: fmt.Sprintf(\"Datadog Trace Agent/%s/%s\", cfg.AgentVersion, cfg.GitCommit),\n\n\t\tcfg: cfg,\n\t\tcollectedStartupError: &atomic.Bool{},\n\t}\n}", "func NewCollector(client *api.Client, collectSnaphots, collectNetwork bool) prometheus.Collector {\n\treturn &VMCollector{client: client, collectSnapshots: collectSnaphots, collectNetwork: collectNetwork}\n}", "func NewCollector(cfg *config.AgentConfig, ctx context.Context) (Collector, error) {\n\tsysInfo, err := checks.CollectSystemInfo(cfg)\n\tif err != nil {\n\t\treturn Collector{}, err\n\t}\n\n\tenabledChecks := make([]checks.Check, 0)\n\tfor _, c := range checks.All {\n\t\tif cfg.CheckIsEnabled(c.Name()) {\n\t\t\tc.Init(cfg, sysInfo)\n\t\t\tenabledChecks = append(enabledChecks, c)\n\t\t}\n\t}\n\n\treturn NewCollectorWithChecks(cfg, enabledChecks, ctx), nil\n}", "func NewCollector(username string, token string, source string, timeout time.Duration, waitGroup *sync.WaitGroup) Collector {\n\treturn &collector{\n\t\turl: metricsEndpont,\n\t\tusername: username,\n\t\ttoken: token,\n\t\tsource: source,\n\t\ttimeout: timeout,\n\n\t\thttpClient: &http.Client{\n\t\t\tTimeout: time.Second * 30,\n\t\t},\n\t\twaitGroup: waitGroup,\n\t\tstop: make(chan bool),\n\t\tbuffer: make(chan gauge, 10000),\n\t}\n}", "func newLocalStore(address net.Address) (Store, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\tsession, err := primitive.NewSession(ctx, primitive.Partition{ID: 1, Address: address})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tupdatesName := primitive.Name{\n\t\tNamespace: \"local\",\n\t\tName: primitiveName,\n\t}\n\tupdates, err := _map.New(context.Background(), updatesName, []*primitive.Session{session})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &atomixStore{\n\t\tupdates: updates,\n\t}, nil\n}", "func New(ctx context.Context, local bool) (*store, error) {\n\tts, err := google.DefaultTokenSource(ctx, auth.ScopeFullControl)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Problem setting up client OAuth: %s\", err)\n\t}\n\tclient := httputils.DefaultClientConfig().WithTokenSource(ts).With2xxOnly().Client()\n\tstorageClient, err := storage.NewClient(context.Background(), option.WithHTTPClient(client))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Problem creating storage client: %s\", err)\n\t}\n\tcache, err := lru.New(LRU_CACHE_SIZE)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed creating cache: %s\", err)\n\t}\n\treturn &store{\n\t\tbucket: storageClient.Bucket(FIDDLE_STORAGE_BUCKET),\n\t\tcache: cache,\n\t}, nil\n}", "func NewRemoteCollector(addr string) *RemoteCollector {\n\treturn &RemoteCollector{\n\t\taddr: addr,\n\t\tdial: func() (net.Conn, error) {\n\t\t\treturn net.Dial(\"tcp\", addr)\n\t\t},\n\t}\n}", "func NewLocal(label string) *Local {\n\treturn &Local{Root: configdir.LocalCache(label)}\n}", "func New(client *statsd.Client, interval time.Duration) *Collector {\n\treturn &Collector{\n\t\tinterval: interval,\n\t\tclient: client,\n\t\tdone: make(chan struct{}),\n\t}\n}", "func NewSystemCollector() Collector {\n\treturn &SystemCollector{}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &vpwsCollector{}\n}", "func New(computeAPI ComputeAPI, dnsAPI DNSAPI, removalPredicate IPAddressRemovalPredicate) *Collector {\n\treturn &Collector{computeAPI, dnsAPI, removalPredicate}\n}", "func NewCollector(rcClientId string, kubernetesClusterId string) TelemetryCollector {\n\treturn &telemetryCollector{\n\t\tclient: httputils.NewResetClient(httpClientResetInterval, httpClientFactory(httpClientTimeout)),\n\t\thost: utils.GetMainEndpoint(config.Datadog, mainEndpointPrefix, mainEndpointUrlKey),\n\t\tuserAgent: \"Datadog Cluster Agent\",\n\t\trcClientId: rcClientId,\n\t\tkubernetesClusterId: kubernetesClusterId,\n\t}\n}", "func NewCollector(l *logrus.Entry, updateInterval time.Duration) *Collector {\n\tcol := &Collector{\n\t\tMsgEvtChan: make(chan *discordgo.Message, 1000),\n\t\tinterval: updateInterval,\n\t\tl: l,\n\t\tchannels: make(map[int64]*entry),\n\t}\n\n\tgo col.run()\n\n\treturn col\n}", "func NewCollector() collector.RPCCollector {\n\treturn &accountingCollector{}\n}", "func NewCollector(logicalSystem string) collector.RPCCollector {\n\treturn &bgpCollector{LogicalSystem: logicalSystem}\n}", "func New(capacity int64) chainstore.Store {\n\tmemStore := &memStore{\n\t\tdata: make(map[string][]byte, 1000),\n\t}\n\tstore := lrumgr.New(capacity, memStore)\n\treturn store\n}", "func Local() Storage {\n\treturn local.New()\n}", "func NewLocal() Local {\n\treturn Local{}\n}", "func NewLocalCollection(path string, pattern string) Collection {\n\tr, _ := regexp.Compile(pattern)\n\treturn LocalCollection{\n\t\tPath: path,\n\t\tFilterable: Filterable{r}}\n}", "func NewCollector(cm *clientmanager.ClientManager) prometheus.Collector {\n\treturn &grpcClientManagerCollector{\n\t\tcm: cm,\n\t}\n}", "func NewCollector(defaultGroup string) *MemoryMetricsCollector {\n\treturn &MemoryMetricsCollector{defaultGroup: defaultGroup, metrics: make([]operation.MetricOperation, 0)}\n}", "func NewStatsCollector(cliContext *cli.Context) (*StatsCollector, error) {\n\n\t// fill the Collector struct\n\tcollector := &StatsCollector{\n\t\tcliContext: cliContext,\n\t\tsocketPath: cliContext.String(\"socketPath\"),\n\t\tkamailioHost: cliContext.String(\"host\"),\n\t\tkamailioPort: cliContext.Int(\"port\"),\n\t}\n\n\t// fine, return the created object struct\n\treturn collector, nil\n}", "func NewStringCollector(name, help string) *StringCollector {\n\treturn &StringCollector{\n\t\tname: name,\n\t\thelp: help,\n\t\tvalue: \"\",\n\t}\n}", "func NewVMwareCollector(ctx *pulumi.Context,\n\tname string, args *VMwareCollectorArgs, opts ...pulumi.ResourceOption) (*VMwareCollector, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ProjectName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ProjectName'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:migrate:VMwareCollector\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:migrate/v20191001:VMwareCollector\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:migrate/v20191001:VMwareCollector\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource VMwareCollector\n\terr := ctx.RegisterResource(\"azure-native:migrate:VMwareCollector\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (s StructuredSyslog) New() cue.Collector {\n\tif s.App == \"\" {\n\t\tlog.Warn(\"StructuredSyslog.New called to created a collector, but App param is empty. Returning nil collector.\")\n\t\treturn nil\n\t}\n\n\tvar err error\n\tif s.Network == \"\" || s.Address == \"\" {\n\t\ts.Network, s.Address, err = localSyslog()\n\t}\n\tif err != nil {\n\t\tlog.Warn(\"StructuredSyslog.New called to created a collector, but Network or Address param is empty. Couldn't find a local syslog socket either. Returning nil collector.\")\n\t\treturn nil\n\t}\n\n\treturn &structuredCollector{\n\t\tStructuredSyslog: s,\n\t\tsocket: Socket{\n\t\t\tFormatter: structuredFormatter(s.Facility, s.App, s.MessageFormatter, s.StructuredFormatter, s.ID, s.WriteBOM),\n\t\t\tNetwork: s.Network,\n\t\t\tAddress: s.Address,\n\t\t\tTLS: s.TLS,\n\t\t}.New(),\n\t}\n}", "func NewLocalStore(meta Container, storage LocalStorage, pd Prophet) LocalStore {\n\treturn &defaultLocalStore{\n\t\tmeta: meta,\n\t\tdb: &defaultLocalDB{storage: storage},\n\t\tpd: pd,\n\t}\n}", "func NewDirCollector() DirCollector {\n\treturn make(DirCollector)\n}", "func NewLocal(clientProvider context.ClientProvider) (*Local, error) {\n\tclient, err := clientProvider()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed to get client context to create local context\")\n\t}\n\n\tdiscoveryService, err := client.LocalDiscoveryProvider().CreateLocalDiscoveryService(client.Identifier().MSPID)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed to create local discovery service\")\n\t}\n\n\tlocal := &Local{\n\t\tClient: client,\n\t\tlocalDiscovery: discoveryService,\n\t}\n\n\tif ci, ok := discoveryService.(localServiceInit); ok {\n\t\tif err := ci.Initialize(local); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn local, nil\n}", "func New(log log.Logger, c *Config) (integrations.Integration, error) {\n\tconfigMap := exporter.GenerateConfigs()\n\tc.applyConfig(configMap)\n\twc, err := exporter.NewWindowsCollector(c.Name(), c.EnabledCollectors, configMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_ = level.Info(log).Log(\"msg\", \"Enabled windows_exporter collectors\")\n\treturn integrations.NewCollectorIntegration(c.Name(), integrations.WithCollectors(wc)), nil\n}", "func NewSynchronizedCollector(coll Collector) Collector {\n\treturn &synchronizedCollector{\n\t\tCollector: coll,\n\t}\n}", "func New(options ...LocalCacheOption) *LocalCache {\n\tc := LocalCache{\n\t\tData: make(map[interface{}]*Value),\n\t\tLRU: NewLRUQueue(),\n\t}\n\tc.Sweeper = async.NewInterval(c.Sweep, 500*time.Millisecond)\n\tfor _, opt := range options {\n\t\topt(&c)\n\t}\n\treturn &c\n}", "func NewLocalProvider(t []string) Provider {\n\treturn newLocalProviderWithClock(t, clock.New())\n}", "func NewMetricCollector(logger *zap.SugaredLogger) *MetricCollector {\n\tcollector := &MetricCollector{\n\t\tlogger: logger,\n\t\tcollections: make(map[string]*collection),\n\t}\n\n\treturn collector\n}", "func New() *CPUCollector {\n\tcpuMetrics := newCPUMetrics()\n\tcpuStats := cpuclient.New()\n\n\treturn &CPUCollector{\n\t\tcpuMetrics: cpuMetrics,\n\t\tcpuStats: cpuStats,\n\t}\n}", "func NewSyncCollector() *SyncCollector {\n\tso := SyncCollector{c: make(Collector)}\n\treturn &so\n}", "func NewCollector() collector.RPCCollector {\n\treturn &isisCollector{}\n}", "func NewServer(l net.Listener, c Collector) *CollectorServer {\n\tcs := &CollectorServer{c: c, l: l}\n\treturn cs\n}", "func GetCollector() *Collector {\n\tif collector == nil {\n\t\tlogger.Errorf(\"Collector need to be init correctly\")\n\t\treturn collector\n\t}\n\n\treturn collector\n}", "func (c *ClusterScalingScheduleCollectorPlugin) NewCollector(hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (Collector, error) {\n\treturn NewClusterScalingScheduleCollector(c.store, c.defaultScalingWindow, c.defaultTimeZone, c.rampSteps, c.now, hpa, config, interval)\n}", "func NewStorageCollector(config []byte) (Collector, error) {\n\tslaunch.Debug(\"New Storage Collector initialized\\n\")\n\tsc := new(StorageCollector)\n\terr := json.Unmarshal(config, &sc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sc, nil\n}", "func MakeContextCollector(shipper ContextShipper, defaultTTL time.Duration) *ContextCollector {\n\tc := &ContextCollector{\n\t\tLogger: log.WithFields(log.Fields{\n\t\t\t\"domain\": \"context\",\n\t\t}),\n\t\tCache: cache.New(defaultTTL, defaultTTL),\n\t\tMarked: make(map[string]struct{}),\n\t\ti: 0,\n\t\tShip: shipper,\n\t\tFlowListeners: make([]chan types.Entry, 0),\n\t}\n\tc.Logger.Debugf(\"created cache with default TTL %v\", defaultTTL)\n\treturn c\n}", "func NewLocalFetcher() *LocalFetcher {\n\treturn &LocalFetcher{\n\t\tdata: make(map[string]*asset.Asset),\n\t}\n}", "func NewFileLocalStore(dir string) FileStore {\n\treturn &fileLocalStore{\n\t\tdir: dir,\n\t\tname: make(map[string]string),\n\t}\n}", "func New(domains []string, outputLocation string, prefix string) *provider.Provider {\n\tloc := &Local{\n\t\tdomains: domains,\n\t\tprefix: prefix,\n\t\toutputLocation: outputLocation,\n\t}\n\tprov := provider.Provider(loc)\n\treturn &prov\n}", "func NewFileCollector() FileCollector {\n\treturn make(FileCollector)\n}", "func (m *LocalManager) New(ctx context.Context, id string) (linker.Storage, error) {\n\tdb, err := NewLocalStorage(ctx, fmt.Sprintf(\"%s/db-%s\", m.path, id))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func NewLibvirtCollector() *Libvirt {\n\treturn &Libvirt{}\n\n}", "func NewNFSCollector(g getNFSStats) *nfsCollector {\n\treturn &nfsCollector{\n\t\tg,\n\t}\n}", "func NewCollector(config CollectorConfig, rawConfig *common.Config) (*Collector, error) {\n\n\t// Compile the configured pattern\n\tpattern, err := regexp.Compile(config.Pattern)\n\tif err != nil {\n\t\tlogp.Warn(\"Unable to parse regular expression: %s\", err)\n\t\treturn nil, err\n\t}\n\n\t// Create our Collector with its channel signals\n\tcollector := Collector{\n\t\tPattern: pattern,\n\t\tconfig: config,\n\n\t\tprospectorDone: make(chan struct{}),\n\t\tlines: make(chan string),\n\t\tDone: make(chan struct{}),\n\t\tStopped: make(chan struct{}),\n\t}\n\n\t// Initialize our ticker for handling timeouts\n\tif config.Timeout.Interval > 0 {\n\t\t// If a timeout is set then create a new ticker and save wrap its channel with a variable\n\t\tcollector.ticker = time.NewTicker(config.Timeout.Interval)\n\t\tcollector.timeoutChannel = collector.ticker.C\n\t} else {\n\t\t// If a timeout is not set then create just a generic channel that will never return.\n\t\t// It just makes generalizing the code easier.\n\t\tcollector.timeoutChannel = make(chan time.Time)\n\t}\n\n\t// Configure a new FileBeat Prospector with our rawConfig that will send it's data to a\n\t// CollectorOutleter\n\tp, err := prospector.NewProspector(\n\t\trawConfig,\n\t\tcollector.collectorOutleterFactory,\n\t\tcollector.prospectorDone,\n\t\t[]file.State{},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcollector.prospector = p\n\treturn &collector, nil\n}", "func NewLocalDelivery(st mailstore.Store, fpath string) DeliverJob {\n\treturn &LocalDeliverJob{\n\t\tst: st,\n\t\tresult: make(chan bool),\n\t\tfpath: fpath,\n\t}\n}", "func NewLocalSnapStore(prefix string) (*LocalSnapStore, error) {\n\tif len(prefix) != 0 {\n\t\terr := os.MkdirAll(prefix, 0700)\n\t\tif err != nil && !os.IsExist(err) {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &LocalSnapStore{\n\t\tprefix: prefix,\n\t}, nil\n}", "func NewCollector(bindIP, port string) (*SyslogCollector, error) {\n\tdefer TRA(CE())\n\tchannel := make(syslog.LogPartsChannel)\n\tsysServ := syslog.NewServer()\n\tsysServ.SetHandler(syslog.NewChannelHandler(channel))\n\t// uses RFC3164 because it is default for rsyslog\n\tsysServ.SetFormat(syslog.RFC3164)\n\terr := sysServ.ListenUDP(fmt.Sprintf(\"%s:%s\", bindIP, port))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func(channel syslog.LogPartsChannel) {\n\t\tfor logEntry := range channel {\n\t\t\tinfo, err := ctl.NewHostInfo()\n\t\t\tif err != nil {\n\t\t\t\tinfo = &ctl.HostInfo{}\n\t\t\t}\n\t\t\tevent, err := ctl.NewEvent(logEntry, *info)\n\t\t\tif err != nil {\n\t\t\t\tErrorLogger.Printf(\"cannot format syslog entry: %s\\n\", err)\n\t\t\t}\n\t\t\terr = event.Save(SubmitPath())\n\t\t\tif err != nil {\n\t\t\t\tErrorLogger.Printf(\"cannot save syslog entry to file: %s\\n\", err)\n\t\t\t}\n\t\t}\n\t}(channel)\n\treturn &SyslogCollector{\n\t\tserver: sysServ,\n\t\tport: port,\n\t}, nil\n}", "func New(cf Config) cache.Cache {\n\treturn &localCache{\n\t\tcacheEngine: freecache.NewCache(cf.Size),\n\t\tcf: cf,\n\t}\n}", "func NewCollector(url, token, xSecret string) (*Collector, error) {\n\tc := Collector{}\n\n\tif url == \"\" {\n\t\treturn nil, fmt.Errorf(\"URL should not be empty\")\n\t}\n\tc.dadataAPIURL = url\n\tif token == \"\" {\n\t\treturn nil, fmt.Errorf(\"Token should not be empty. Please specify it via DADATA_TOKEN env var\")\n\t}\n\tc.dadataToken = token\n\tif xSecret == \"\" {\n\t\treturn nil, fmt.Errorf(\"X-Secret should not be empty. Please specify it via DADATA_X_SECRET env var\")\n\t}\n\tc.dadataXSecret = xSecret\n\n\terr := c.dadataCheck()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.totalScrapes = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tName: \"exporter_scrapes_total\",\n\t\tHelp: \"Count of total scrapes\",\n\t})\n\n\tc.failedBalanceScrapes = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tName: \"exporter_failed_balance_scrapes_total\",\n\t\tHelp: \"Count of failed balance scrapes\",\n\t})\n\n\tc.failedStatsScrapes = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tName: \"exporter_failed_stats_scrapes_total\",\n\t\tHelp: \"Count of failed stats scrapes\",\n\t})\n\n\tc.CurrentBalance = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tName: \"current_balance\",\n\t\tHelp: \"Current balance on Dadata\",\n\t})\n\n\tc.ServicesMerging = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: \"services\",\n\t\tName: \"merging_total\",\n\t\tHelp: \"Merging count for today\",\n\t})\n\n\tc.ServicesSuggestions = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: \"services\",\n\t\tName: \"suggestions_total\",\n\t\tHelp: \"Suggestions count for today\",\n\t})\n\n\tc.ServicesClean = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: \"services\",\n\t\tName: \"clean_total\",\n\t\tHelp: \"Clean count for today\",\n\t})\n\n\treturn &c, nil\n}", "func New(cfg Collector, nodeInfo collectors.NodeInfo, rels *ContainerTaskRels) (Collector, chan producers.MetricsMessage) {\n\tc := cfg\n\tc.log = logrus.WithFields(logrus.Fields{\"collector\": \"mesos-agent\"})\n\tc.nodeInfo = nodeInfo\n\tc.metricsChan = make(chan producers.MetricsMessage)\n\tc.ContainerTaskRels = rels\n\treturn c, c.metricsChan\n}", "func newPoolCollector(config monitoring.MetricsConfig, logger *zap.Logger,\n\tspectrumClient spectrumservice.Client) (Collector, error) {\n\n\tlabelPool := []string{\"pool_name\", \"storage_system\"}\n\n\tproperties := make(map[string]*prometheus.Desc)\n\n\tfor _, p := range config.Metrics.Pools.Properties {\n\t\tproperties[p.PropertyName] = prometheus.NewDesc(p.PrometheusName, p.PrometheusHelp, labelPool, nil)\n\t}\n\n\treturn &poolCollector{\n\t\tibmSpectrumClient: spectrumClient,\n\t\tlogger: logger.Sugar(),\n\t\tproperties: properties,\n\t}, nil\n}", "func NewLocal() ILocal {\n\treturn &Local{}\n}", "func NewCollector(dyno *Dynomite) *Collector {\n\treturn &Collector{\n\t\tdyno: dyno,\n\t\tstate: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_state\",\n\t\t\t\t\"State as reported by Dynomite.\",\n\t\t\t\t[]string{\"state\", \"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tdbSize: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_db_size\",\n\t\t\t\t\"Key database size as reported by the Redis backend.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tuptime: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_uptime\",\n\t\t\t\t\"Uptime as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tclientConnections: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_client_connections\",\n\t\t\t\t\"Client connections as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tclientReadRequests: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_client_read_requests\",\n\t\t\t\t\"Client read requests as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tclientWriteRequests: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_client_write_requests\",\n\t\t\t\t\"Client write requests as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tclientDroppedRequests: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_client_dropped_requests\",\n\t\t\t\t\"Client dropped requests as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t}\n}", "func NewCollector(m Metric) (prometheus.Collector, error) {\n\tif len(m.Name) == 0 {\n\t\treturn nil, errors.New(\"A name is required for a metric\")\n\t}\n\n\tvar (\n\t\tnamespace = m.Namespace\n\t\tsubsystem = m.Subsystem\n\t\thelp = m.Help\n\t)\n\n\tif len(namespace) == 0 {\n\t\tnamespace = DefaultNamespace\n\t}\n\n\tif len(subsystem) == 0 {\n\t\tsubsystem = DefaultSubsystem\n\t}\n\n\tif len(help) == 0 {\n\t\thelp = m.Name\n\t}\n\n\tswitch m.Type {\n\tcase CounterType:\n\t\treturn prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: m.Name,\n\t\t\tHelp: help,\n\t\t\tConstLabels: prometheus.Labels(m.ConstLabels),\n\t\t}, m.LabelNames), nil\n\n\tcase GaugeType:\n\t\treturn prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: m.Name,\n\t\t\tHelp: help,\n\t\t\tConstLabels: prometheus.Labels(m.ConstLabels),\n\t\t}, m.LabelNames), nil\n\n\tcase HistogramType:\n\t\treturn prometheus.NewHistogramVec(prometheus.HistogramOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: m.Name,\n\t\t\tHelp: help,\n\t\t\tBuckets: m.Buckets,\n\t\t\tConstLabels: prometheus.Labels(m.ConstLabels),\n\t\t}, m.LabelNames), nil\n\n\tcase SummaryType:\n\t\treturn prometheus.NewSummaryVec(prometheus.SummaryOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: m.Name,\n\t\t\tHelp: help,\n\t\t\tObjectives: m.Objectives,\n\t\t\tMaxAge: m.MaxAge,\n\t\t\tAgeBuckets: m.AgeBuckets,\n\t\t\tBufCap: m.BufCap,\n\t\t\tConstLabels: prometheus.Labels(m.ConstLabels),\n\t\t}, m.LabelNames), nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unsupported metric type: %s\", m.Type)\n\t}\n}", "func NewLocalUploader(\n\tbackupStoreDAL *dal.IntelligentStoreDAL,\n\tbackupBucketName,\n\tbackupFromLocation string,\n\tincludeMatcher,\n\texcludeMatcher patternmatcher.Matcher,\n\tbackupDryRun bool,\n) *LocalUploader {\n\n\treturn &LocalUploader{\n\t\tbackupStoreDAL,\n\t\tbackupBucketName,\n\t\tbackupFromLocation,\n\t\tincludeMatcher,\n\t\texcludeMatcher,\n\t\tgofs.NewOsFs(),\n\t\tbackupDryRun,\n\t}\n}", "func NewDfCollector() *DfCollector {\n\treturn &DfCollector{}\n}", "func NewTLSRemoteCollector(addr string, tlsConfig *tls.Config) *RemoteCollector {\n\treturn &RemoteCollector{\n\t\taddr: addr,\n\t\tdial: func() (net.Conn, error) {\n\t\t\treturn tls.Dial(\"tcp\", addr, tlsConfig)\n\t\t},\n\t}\n}", "func NewLocalFileStore(baseDir OsPath) (FileStore, error) {\n\tbase, err := checkIsDir(string(baseDir))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &fileStore{base}, nil\n}", "func (c *ScalingScheduleCollectorPlugin) NewCollector(hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (Collector, error) {\n\treturn NewScalingScheduleCollector(c.store, c.defaultScalingWindow, c.defaultTimeZone, c.rampSteps, c.now, hpa, config, interval)\n}", "func New(chromePerf anomalies.Store) (*store, error) {\n\tcache, err := lru.New(cacheSize)\n\tif err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"Failed to create anomaly store cache.\")\n\t}\n\n\t// cleanup the lru cache periodically.\n\tgo func() {\n\t\tfor range time.Tick(cacheCleanupPeriod) {\n\t\t\tcleanupCache(cache)\n\t\t}\n\t}()\n\n\tret := &store{\n\t\tcache: cache,\n\t\tnumEntriesInCache: metrics2.GetInt64Metric(\"anomaly_store_num_entries_in_cache\"),\n\t\tChromePerf: chromePerf,\n\t}\n\treturn ret, nil\n}", "func registerCollector(name string, factory func() (Collector, error)) {\n\tcollectorFactories[name] = factory\n}", "func NewStaticCollector(m map[string]string) func() sstable.TablePropertyCollector {\n\treturn func() sstable.TablePropertyCollector { return &staticCollector{m} }\n}", "func NewCollectorCache(collector Collector) Collector {\n\treturn &collectorCache{\n\t\tcollector: collector,\n\t\tcache: NewCache(cacheGCInterval),\n\t}\n}", "func NewFileCollector(name string, limit Size, pipe bool) File {\n\treturn &FileCollector{Name: name, Limit: limit, Pipe: pipe}\n}" ]
[ "0.7043134", "0.6845503", "0.6701996", "0.6606692", "0.6517277", "0.6481328", "0.63933116", "0.6308921", "0.62407637", "0.62237227", "0.6169103", "0.6142803", "0.6077568", "0.60701793", "0.60639817", "0.6062933", "0.60500205", "0.6038892", "0.5981425", "0.59649676", "0.5927517", "0.5884676", "0.5883424", "0.5869342", "0.58594537", "0.5856504", "0.5856504", "0.5850362", "0.58215505", "0.5789103", "0.57841337", "0.5781289", "0.5766688", "0.5732893", "0.57091516", "0.5677057", "0.5668884", "0.56606346", "0.5658218", "0.56494427", "0.5642903", "0.5592421", "0.5578773", "0.5561492", "0.5549838", "0.5547447", "0.55441517", "0.5532109", "0.5489043", "0.546016", "0.54344803", "0.5426006", "0.54166794", "0.5413834", "0.54102", "0.5406808", "0.5404807", "0.5383488", "0.53774095", "0.53678614", "0.5365773", "0.5359167", "0.53506106", "0.533421", "0.5324231", "0.5292647", "0.5270657", "0.52583665", "0.5254834", "0.5248841", "0.52475256", "0.5244337", "0.52362895", "0.5209069", "0.5207019", "0.5206861", "0.52012616", "0.5190359", "0.5186415", "0.51676637", "0.5162739", "0.5158268", "0.51528925", "0.5136553", "0.5135053", "0.513181", "0.5122861", "0.509565", "0.5092019", "0.5090524", "0.50827634", "0.5078538", "0.5059154", "0.50563496", "0.5052611", "0.50418246", "0.49995375", "0.4985796", "0.49830183", "0.497285" ]
0.8576599
0
newCollectPacket returns an initialized wire.CollectPacket given a span and set of annotations.
func newCollectPacket(s SpanID, as Annotations) *wire.CollectPacket { return &wire.CollectPacket{ Spanid: s.wire(), Annotation: as.wire(), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cc *ChunkedCollector) Collect(span SpanID, anns ...Annotation) error {\n\tcc.mu.Lock()\n\tdefer cc.mu.Unlock()\n\n\tif cc.stopped {\n\t\treturn errors.New(\"ChunkedCollector is stopped\")\n\t}\n\tif !cc.started {\n\t\tcc.start()\n\t}\n\n\tif cc.pendingBySpanID == nil {\n\t\tcc.pendingBySpanID = map[SpanID]*wire.CollectPacket{}\n\t}\n\n\tif p, present := cc.pendingBySpanID[span]; present {\n\t\tif len(anns) > 0 {\n\t\t\tp.Annotation = append(p.Annotation, Annotations(anns).wire()...)\n\t\t}\n\t} else {\n\t\tcc.pendingBySpanID[span] = newCollectPacket(span, anns)\n\t\tcc.pending = append(cc.pending, span)\n\t}\n\n\tif err := cc.lastErr; err != nil {\n\t\tcc.lastErr = nil\n\t\treturn err\n\t}\n\treturn nil\n}", "func (rc *RemoteCollector) Collect(span SpanID, anns ...Annotation) error {\n\treturn rc.collectAndRetry(newCollectPacket(span, anns))\n}", "func New() *Collector { return &Collector{} }", "func New(computeAPI ComputeAPI, dnsAPI DNSAPI, removalPredicate IPAddressRemovalPredicate) *Collector {\n\treturn &Collector{computeAPI, dnsAPI, removalPredicate}\n}", "func NewCollect() *cobra.Command {\n\tcollectOptions := newCollectOptions()\n\n\tcmd := &cobra.Command{\n\t\tUse: \"collect\",\n\t\tShort: \"Obtain all the data of the current node\",\n\t\tLong: edgecollectLongDescription,\n\t\tExample: edgecollectExample,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\terr := ExecuteCollect(collectOptions)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t},\n\t}\n\tcmd.AddCommand()\n\taddCollectOtherFlags(cmd, collectOptions)\n\treturn cmd\n}", "func NewCreateCollectInfoRequestWithoutParam() *CreateCollectInfoRequest {\n\n return &CreateCollectInfoRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/logtopics/{logtopicUID}/collectinfos\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "func New(token string, collectionID string) *SpanListener {\n\treturn &SpanListener{\n\t\tToken: token,\n\t\tCollectionID: collectionID,\n\t\tmeasurementCh: make(chan *apipb.CarrierModuleMeasurements),\n\t}\n}", "func New() Collector {\n\treturn &collector{\n\t\tinner: sigar.ConcreteSigar{},\n\t}\n}", "func NewUnReportStatsCollect(storeID uint64, regionIDs map[uint64]struct{}, interval uint64) *FlowItem {\n\treturn &FlowItem{\n\t\tpeerInfo: nil,\n\t\tregionInfo: nil,\n\t\texpiredStat: nil,\n\t\tunReportStatsCollect: &unReportStatsCollect{\n\t\t\tstoreID: storeID,\n\t\t\tregionIDs: regionIDs,\n\t\t\tinterval: interval,\n\t\t},\n\t}\n}", "func NewPacket(data []byte, len uint32) *Packet {\n\treturn &Packet{\n\t\tTime: time.Now(),\n\t\tCaplen: len,\n\t\tLen: len,\n\t\tData: data,\n\t}\n}", "func NewSpan(name errors.Op) (*Metric, *Span) {\n\tm := New(name)\n\treturn m, m.StartSpan(name)\n}", "func NewCollector(period time.Duration, collectFunc func() []Measurement) *Collector {\n\tcollector := &Collector{\n\t\tperiod: period,\n\t\tcollectFunc: collectFunc,\n\t\tlastSendingDate: -1,\n\t}\n\n\tif sources == nil {\n\t\tsources = make([]DataSource, 0)\n\t\tgo sendingLoop()\n\t}\n\n\tif UseGlobalEngine {\n\t\tcollector.Engine = Engine\n\t} else {\n\t\tcollector.Engine = &req.Engine{}\n\t}\n\n\tsources = append(sources, collector)\n\n\treturn collector\n}", "func newCollectionStatsCollector(ctx context.Context, client *mongo.Client, logger *logrus.Logger, compatible, discovery bool, topology labelsGetter, collections []string) *collstatsCollector {\n\treturn &collstatsCollector{\n\t\tctx: ctx,\n\t\tbase: newBaseCollector(client, logger),\n\n\t\tcompatibleMode: compatible,\n\t\tdiscoveringMode: discovery,\n\t\ttopologyInfo: topology,\n\n\t\tcollections: collections,\n\t}\n}", "func Collect(collectionLimit int) *sif.DataFrameOperation {\n\treturn &sif.DataFrameOperation{\n\t\tTaskType: sif.CollectTaskType,\n\t\tDo: func(d sif.DataFrame) (*sif.DataFrameOperationResult, error) {\n\t\t\tif d.GetDataSource().IsStreaming() {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot collect() from a streaming DataSource\")\n\t\t\t}\n\t\t\treturn &sif.DataFrameOperationResult{\n\t\t\t\tTask: &collectTask{collectionLimit: collectionLimit},\n\t\t\t\tDataSchema: d.GetSchema().Clone(),\n\t\t\t}, nil\n\t\t},\n\t}\n}", "func (t *Tracer) newSpan() *Span {\n\treturn t.spanAllocator.Get()\n}", "func (tr *tracer) newRecordingSpan(psc, sc trace.SpanContext, name string, sr SamplingResult, config *trace.SpanConfig) *recordingSpan {\n\tstartTime := config.Timestamp()\n\tif startTime.IsZero() {\n\t\tstartTime = time.Now()\n\t}\n\n\ts := &recordingSpan{\n\t\t// Do not pre-allocate the attributes slice here! Doing so will\n\t\t// allocate memory that is likely never going to be used, or if used,\n\t\t// will be over-sized. The default Go compiler has been tested to\n\t\t// dynamically allocate needed space very well. Benchmarking has shown\n\t\t// it to be more performant than what we can predetermine here,\n\t\t// especially for the common use case of few to no added\n\t\t// attributes.\n\n\t\tparent: psc,\n\t\tspanContext: sc,\n\t\tspanKind: trace.ValidateSpanKind(config.SpanKind()),\n\t\tname: name,\n\t\tstartTime: startTime,\n\t\tevents: newEvictedQueue(tr.provider.spanLimits.EventCountLimit),\n\t\tlinks: newEvictedQueue(tr.provider.spanLimits.LinkCountLimit),\n\t\ttracer: tr,\n\t}\n\n\tfor _, l := range config.Links() {\n\t\ts.addLink(l)\n\t}\n\n\ts.SetAttributes(sr.Attributes...)\n\ts.SetAttributes(config.Attributes()...)\n\n\treturn s\n}", "func NewPacket(opcode byte, payload []byte) *Packet {\n\treturn &Packet{opcode, payload, false, 0, 0, 0}\n}", "func NewPacket(payloadtype uint8,\n\tpayloaddata []byte,\n\tseqnr uint16,\n\ttimestamp uint32,\n\tssrc uint32,\n\tgotmarker bool,\n\tnumcsrcs uint8,\n\tcsrcs []uint32,\n\tgotextension bool,\n\textensionid uint16,\n\textensionlen uint16,\n\textensiondata []uint32) *RTPPacket {\n\tthis := &RTPPacket{}\n\n\tthis.receivetime = &RTPTime{0, 0}\n\tif err := this.BuildPacket(payloadtype,\n\t\tpayloaddata,\n\t\tseqnr,\n\t\ttimestamp,\n\t\tssrc,\n\t\tgotmarker,\n\t\tnumcsrcs,\n\t\tcsrcs,\n\t\tgotextension,\n\t\textensionid,\n\t\textensionlen,\n\t\textensiondata); err != nil {\n\t\treturn nil\n\t}\n\n\treturn this\n}", "func NewCollector(config *CollectorConfig) (Collector, error) {\n\tc := &standardCollector{\n\t\trunning: true,\n\t\tevents: make(chan Event, config.EventBufferSize),\n\t\tconfig: config,\n\t\tneighbors: make(map[string]neighbor),\n\t\tRWMutex: &sync.RWMutex{},\n\t}\n\n\treturn c, nil\n}", "func (s *Slave) newPacket(q Query) (pp *BinaryPacket, err error) {\n\tpp = packetPool.GetWithID(s.c.nextID())\n\tif err = pp.packMsg(q, s.c.packData); err != nil {\n\t\ts.c.releasePacket(pp)\n\t\treturn nil, err\n\t}\n\treturn\n}", "func NewCollector(bindIP, port string) (*SyslogCollector, error) {\n\tdefer TRA(CE())\n\tchannel := make(syslog.LogPartsChannel)\n\tsysServ := syslog.NewServer()\n\tsysServ.SetHandler(syslog.NewChannelHandler(channel))\n\t// uses RFC3164 because it is default for rsyslog\n\tsysServ.SetFormat(syslog.RFC3164)\n\terr := sysServ.ListenUDP(fmt.Sprintf(\"%s:%s\", bindIP, port))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func(channel syslog.LogPartsChannel) {\n\t\tfor logEntry := range channel {\n\t\t\tinfo, err := ctl.NewHostInfo()\n\t\t\tif err != nil {\n\t\t\t\tinfo = &ctl.HostInfo{}\n\t\t\t}\n\t\t\tevent, err := ctl.NewEvent(logEntry, *info)\n\t\t\tif err != nil {\n\t\t\t\tErrorLogger.Printf(\"cannot format syslog entry: %s\\n\", err)\n\t\t\t}\n\t\t\terr = event.Save(SubmitPath())\n\t\t\tif err != nil {\n\t\t\t\tErrorLogger.Printf(\"cannot save syslog entry to file: %s\\n\", err)\n\t\t\t}\n\t\t}\n\t}(channel)\n\treturn &SyslogCollector{\n\t\tserver: sysServ,\n\t\tport: port,\n\t}, nil\n}", "func NewPacket(data []byte, code byte, length int) (p *Packet) {\n\tp = &Packet{\n\t\tData: data,\n\t\tCode: code,\n\t\tLength: length,\n\t}\n\treturn p\n}", "func NewCollectServer(cfg *ServerConfig) *CollectServer {\n\tserver := &CollectServer{Config: cfg}\n\tlogger := logrus.New()\n\tlogger.Out = cfg.LogCfg.Output\n\tlogger.Level = cfg.LogCfg.Level\n\tlogger.Formatter = cfg.LogCfg.Format\n\tserver.Logger = logger\n\treturn server\n}", "func NewPacket(fields ...Field) (*Packet, error) {\n\tp := &Packet{b: make([]byte, 0, MaxEIRPacketLength)}\n\tfor _, f := range fields {\n\t\tif err := f(p); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn p, nil\n}", "func NewCollection(label string) *Collection {\n\treturn &Collection{\n\t\tItems: make(map[string]*APIResource),\n\t\tmanifests: make(map[string][]byte),\n\t\tResourceLabel: label,\n\t}\n}", "func makePacket(addr string, args []string) Packet {\n\tmsg := NewMessage(addr)\n\tfor _, arg := range args {\n\t\tmsg.Append(arg)\n\t}\n\treturn msg\n}", "func newSpanProcessor(config Config) (*spanProcessor, error) {\n\tskipExpr, err := filterspan.NewSkipExpr(&config.MatchConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsp := &spanProcessor{\n\t\tconfig: config,\n\t\tskipExpr: skipExpr,\n\t}\n\n\t// Compile ToAttributes regexp and extract attributes names.\n\tif config.Rename.ToAttributes != nil {\n\t\tfor _, pattern := range config.Rename.ToAttributes.Rules {\n\t\t\tre, err := regexp.Compile(pattern)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid regexp pattern %s\", pattern)\n\t\t\t}\n\n\t\t\trule := toAttributeRule{\n\t\t\t\tre: re,\n\t\t\t\t// Subexpression names will become attribute names during extraction.\n\t\t\t\tattrNames: re.SubexpNames(),\n\t\t\t}\n\n\t\t\tsp.toAttributeRules = append(sp.toAttributeRules, rule)\n\t\t}\n\t}\n\n\treturn sp, nil\n}", "func (p *Packet) AvNewPacket(s int) int {\n\treturn int(C.av_new_packet((*C.struct_AVPacket)(p), C.int(s)))\n}", "func NewCollector(config *Config) (coll *Collector, err error) {\n\tvar gelfWriter *gelf.Writer\n\n\tif gelfWriter, err = gelf.NewWriter(config.Graylog.Address); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcoll = new(Collector)\n\tcoll.writer = gelfWriter\n\tcoll.host = config.Collector.Hostname\n\n\treturn coll, nil\n}", "func NewVpcCollector(logger log.Logger) (Collector, error) {\n\treturn &vpcCollector{\n\t\tdesc: vpcDesc,\n\t\tlogger: logger,\n\t}, nil\n}", "func (m *MessageProcessor) Collect(srcPeerID string, packet []byte, respRingBuf *ring.Buffer, services protocol.ServiceFlag, metadata *message.Metadata) ([]bytes.Buffer, error) {\n\tif len(packet) == 0 {\n\t\treturn nil, errors.New(\"empty packet provided\")\n\t}\n\tdefer m.trace(\"collected\", srcPeerID, time.Now().UnixNano(), packet)\n\n\tb := bytes.NewBuffer(packet)\n\ttopic := topics.Topic(b.Bytes()[0])\n\n\tmsg, err := message.Unmarshal(b, metadata)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while unmarshaling: %s - topic: %s\", err, topic)\n\t}\n\n\treturn m.process(srcPeerID, msg, respRingBuf, services)\n}", "func newPoolCollector(config monitoring.MetricsConfig, logger *zap.Logger,\n\tspectrumClient spectrumservice.Client) (Collector, error) {\n\n\tlabelPool := []string{\"pool_name\", \"storage_system\"}\n\n\tproperties := make(map[string]*prometheus.Desc)\n\n\tfor _, p := range config.Metrics.Pools.Properties {\n\t\tproperties[p.PropertyName] = prometheus.NewDesc(p.PrometheusName, p.PrometheusHelp, labelPool, nil)\n\t}\n\n\treturn &poolCollector{\n\t\tibmSpectrumClient: spectrumClient,\n\t\tlogger: logger.Sugar(),\n\t\tproperties: properties,\n\t}, nil\n}", "func New(client *statsd.Client, interval time.Duration) *Collector {\n\treturn &Collector{\n\t\tinterval: interval,\n\t\tclient: client,\n\t\tdone: make(chan struct{}),\n\t}\n}", "func New(config Config) (*Collector, error) {\n\tif config.Logger == nil {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"%T.Logger must not be empty\", config)\n\t}\n\n\tif config.IFace == \"\" {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"%T.IFace must not be empty\", config)\n\t}\n\n\tcollector := &Collector{\n\t\tiface: config.IFace,\n\t}\n\n\tnicStats, err := ethtool.Stats(collector.iface)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tcollector.metrics = make(map[string]*prometheus.Desc)\n\tfor label, _ := range nicStats {\n\t\tfqName := prometheus.BuildFQName(nic_metric_namespace, \"\", label)\n\t\tcollector.metrics[label] = prometheus.NewDesc(fqName, fmt.Sprintf(\"Generated description for metric %#q\", label), []string{\"iface\"}, nil)\n\t}\n\n\treturn collector, nil\n}", "func newCollection(d driver.Collection) *Collection {\n\treturn &Collection{driver: d}\n}", "func newSpanParser(src []byte) *spanParser {\n\tp := &parser{\n\t\tsrc: src,\n\t}\n\tsp := &spanParser{parser: p, ref: make(map[string]*reference), spanChan: make(chan Span)}\n\tgo sp.run()\n\treturn sp\n}", "func New() servicespec.LayerCollection {\n\treturn &collection{}\n}", "func NewPacket(code, identifier uint8, data []byte, additionalCapacity ...uint) Packet {\n\tl := len(data) + EapHeaderLen\n\tpacketCap := l\n\tif len(additionalCapacity) > 0 && l < int(EapMaxLen) {\n\t\tac := additionalCapacity[0]\n\t\tpacketCap = l + int(ac)\n\t\tif packetCap > int(EapMaxLen) {\n\t\t\tpacketCap = int(EapMaxLen)\n\t\t}\n\t}\n\tp := make([]byte, EapHeaderLen, packetCap)\n\tif l > EapHeaderLen {\n\t\tp = append(p, data...)\n\t}\n\tp[EapMsgCode], p[EapMsgIdentifier], p[EapMsgLenLow], p[EapMsgLenHigh] = code, identifier, uint8(l), uint8(l>>8)\n\treturn p\n}", "func NewCollector(client *api.Client, collectSnaphots, collectNetwork bool) prometheus.Collector {\n\treturn &VMCollector{client: client, collectSnapshots: collectSnaphots, collectNetwork: collectNetwork}\n}", "func coveringFromSpans(spans []roachpb.Span, payload interface{}) intervalccl.Covering {\n\tvar covering intervalccl.Covering\n\tfor _, span := range spans {\n\t\tcovering = append(covering, intervalccl.Range{\n\t\t\tStart: []byte(span.Key),\n\t\t\tEnd: []byte(span.EndKey),\n\t\t\tPayload: payload,\n\t\t})\n\t}\n\treturn covering\n}", "func NewCollector(logicalSystem string) collector.RPCCollector {\n\treturn &bgpCollector{LogicalSystem: logicalSystem}\n}", "func (m *SpanManager) NewSpanFromRequest(name string, req Request) *Span {\n\tif req.Sampled != nil && !*req.Sampled {\n\t\treturn NewDisabledTrace()\n\t}\n\n\tflags := int64(0)\n\tif req.Flags != nil {\n\t\tflags = *req.Flags\n\t}\n\n\tif req.TraceId == nil || req.SpanId == nil {\n\t\tif req.Sampled != nil {\n\t\t\treturn m.NewSampledTrace(name, flags&1 > 0)\n\t\t}\n\t\treturn m.NewTrace(name)\n\t}\n\n\treturn &Span{\n\t\tdata: zipkin.Span{\n\t\t\tTraceId: *req.TraceId,\n\t\t\tName: name,\n\t\t\tId: *req.SpanId,\n\t\t\tParentId: req.ParentId,\n\t\t\tDebug: flags&1 > 0},\n\t\tserver: true,\n\t\tmanager: m}\n}", "func NewSpan(name string, linked ...*Span) (*Span, FinishFunc) {\n\tspan := &Span{\n\t\tID: client.NewSpan(nil),\n\t\tAnnotations: make(map[string][]byte),\n\t}\n\tstart := time.Now()\n\tfn := func() error {\n\t\treturn client.Finish(span.ID, name, spanIDs(linked), span.Annotations, start, time.Now())\n\t}\n\treturn span, fn\n}", "func (collector *Collector) Collect(ch chan<- prometheus.Metric) {\n\tch <- prometheus.MustNewConstMetric(collector.incidentsCreatedCount, prometheus.CounterValue, collector.storage.GetIncidentsCreatedCount())\n}", "func (s StructuredSyslog) New() cue.Collector {\n\tif s.App == \"\" {\n\t\tlog.Warn(\"StructuredSyslog.New called to created a collector, but App param is empty. Returning nil collector.\")\n\t\treturn nil\n\t}\n\n\tvar err error\n\tif s.Network == \"\" || s.Address == \"\" {\n\t\ts.Network, s.Address, err = localSyslog()\n\t}\n\tif err != nil {\n\t\tlog.Warn(\"StructuredSyslog.New called to created a collector, but Network or Address param is empty. Couldn't find a local syslog socket either. Returning nil collector.\")\n\t\treturn nil\n\t}\n\n\treturn &structuredCollector{\n\t\tStructuredSyslog: s,\n\t\tsocket: Socket{\n\t\t\tFormatter: structuredFormatter(s.Facility, s.App, s.MessageFormatter, s.StructuredFormatter, s.ID, s.WriteBOM),\n\t\t\tNetwork: s.Network,\n\t\t\tAddress: s.Address,\n\t\t\tTLS: s.TLS,\n\t\t}.New(),\n\t}\n}", "func NewCollector(l *logrus.Entry, updateInterval time.Duration) *Collector {\n\tcol := &Collector{\n\t\tMsgEvtChan: make(chan *discordgo.Message, 1000),\n\t\tinterval: updateInterval,\n\t\tl: l,\n\t\tchannels: make(map[int64]*entry),\n\t}\n\n\tgo col.run()\n\n\treturn col\n}", "func (t *TraceWrapper) newSpan(name string) *SpanWrapper {\n\tctx := t.ctx\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\n\ts, ok := ctx.Value(spanKey{}).(*SpanWrapper)\n\tif !ok {\n\t\ts = t.generateSpan(name)\n\t\tctx = context.WithValue(ctx, spanKey{}, s)\n\t\ts.ctx, t.ctx = ctx, ctx\n\t}\n\treturn s\n}", "func (c *libbeatCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n\t// output.type with dynamic label\n\tch <- prometheus.MustNewConstMetric(libbeatOutputType, prometheus.CounterValue, float64(1), c.stats.LibBeat.Output.Type)\n\n}", "func NewCollector(store *store.MemoryStore) *Collector {\n\treturn &Collector{\n\t\tstore: store,\n\t\tstopChan: make(chan struct{}),\n\t\tdoneChan: make(chan struct{}),\n\t}\n}", "func NewPacketCapture() *PacketCapture {\n\treturn &PacketCapture{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: KindPacketCapture,\n\t\t\tAPIVersion: GroupVersionCurrent,\n\t\t},\n\t}\n}", "func NewCollection(context, id string, members interface{}) *CollectionResource {\n\treturn &CollectionResource{\n\t\tResource: Resource{\n\t\t\tContext: context,\n\t\t\tNodeID: id,\n\t\t\tType: \"Collection\",\n\t\t},\n\t\tMembers: members,\n\t}\n}", "func newUnidataCollector(udtbin string) *unidataCollector {\n\treturn &unidataCollector{\n\t\tudtBinPath: udtbin,\n\t\tlicenseUsage: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"license\", \"usage\"),\n\t\t\t\"Unidata license usage.\",\n\t\t\t[]string{\"model\", \"src\"},\n\t\t\tnil,\n\t\t),\n\t\tlicenseLimit: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"license\", \"limit\"),\n\t\t\t\"Unidata license limits.\",\n\t\t\t[]string{\"model\"},\n\t\t\tnil,\n\t\t),\n\t\tup: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"\", \"up\"),\n\t\t\t\"Unidata exporter success.\",\n\t\t\tnil, nil,\n\t\t),\n\t}\n}", "func New(cfg Collector, nodeInfo collectors.NodeInfo, rels *ContainerTaskRels) (Collector, chan producers.MetricsMessage) {\n\tc := cfg\n\tc.log = logrus.WithFields(logrus.Fields{\"collector\": \"mesos-agent\"})\n\tc.nodeInfo = nodeInfo\n\tc.metricsChan = make(chan producers.MetricsMessage)\n\tc.ContainerTaskRels = rels\n\treturn c, c.metricsChan\n}", "func newCollectOptions() *common.CollectOptions {\n\topts := &common.CollectOptions{}\n\n\topts.Config = common.EdgecoreConfigPath\n\topts.OutputPath = \".\"\n\topts.Detail = false\n\treturn opts\n}", "func NewSpan(tracer *Tracing, name string) Span {\n\treturn newSpanWithStart(tracer, name, time.Now())\n}", "func (tlc *TLCMessage) CreatePacket() *GossipPacket {\n\treturn &GossipPacket{\n\t\tTLCMessage: tlc,\n\t}\n}", "func spanToRequestData(span *tracepb.Span) *contracts.RequestData {\n\t/*\n\t\tRequest type comes from a few attributes.\n\n\t\tHTTP\n\t\thttps://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-http.md\n\n\t\tRPC (gRPC)\n\t\thttps://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-rpc.md\n\n\t\tDatabase\n\t\thttps://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-database.md\n\t*/\n\n\t// https://github.com/microsoft/ApplicationInsights-Go/blob/master/appinsights/contracts/requestdata.go\n\t// Start with some reasonable default for server spans.\n\tdata := contracts.NewRequestData()\n\tdata.Id = idToHex(span.SpanId)\n\tdata.Name = span.Name.Value\n\tdata.Duration = formatSpanDuration(span)\n\tdata.Properties = make(map[string]string)\n\tdata.Measurements = make(map[string]float64)\n\tdata.ResponseCode = \"0\"\n\tdata.Success = true\n\n\tif span.Attributes != nil && span.Attributes.AttributeMap != nil {\n\t\tattributes := span.Attributes.AttributeMap\n\t\tcomponent := \"\"\n\t\tonAttributeStringValueExists(attributes, spanAttributeKeyComponent, func(val string) { component = val })\n\n\t\t// TODO remove this once the OpenTelemetry wire format protocol is adopted.\n\t\t// The specs indicate that component is a required tag\n\t\tonAttributeStringValueExists(attributes, spanAttributeKeyHTTPMethod, func(val string) { component = \"http\" })\n\n\t\tswitch component {\n\t\tcase \"\":\n\t\t\tfillRequestDataInternal(span, data)\n\t\tcase \"http\":\n\t\t\tfillRequestDataHTTP(span, data)\n\t\tcase \"grpc\":\n\t\t\tfillRequestDataGrpc(span, data)\n\t\tdefault:\n\t\t}\n\t}\n\n\treturn data\n}", "func (tb *Batch) newChildSpan(ctx context.Context) ddtrace.Span {\n\tp := tb.params\n\topts := []ddtrace.StartSpanOption{\n\t\ttracer.SpanType(ext.SpanTypeCassandra),\n\t\ttracer.ServiceName(p.config.serviceName),\n\t\ttracer.ResourceName(p.config.resourceName),\n\t\ttracer.Tag(ext.CassandraConsistencyLevel, tb.Cons.String()),\n\t\ttracer.Tag(ext.CassandraKeyspace, tb.Keyspace()),\n\t\ttracer.Tag(ext.Component, componentName),\n\t\ttracer.Tag(ext.SpanKind, ext.SpanKindClient),\n\t\ttracer.Tag(ext.DBSystem, ext.DBSystemCassandra),\n\t}\n\tif !math.IsNaN(p.config.analyticsRate) {\n\t\topts = append(opts, tracer.Tag(ext.EventSampleRate, p.config.analyticsRate))\n\t}\n\tif tb.clusterContactPoints != \"\" {\n\t\topts = append(opts, tracer.Tag(ext.CassandraContactPoints, tb.clusterContactPoints))\n\t}\n\tfor k, v := range tb.config.customTags {\n\t\topts = append(opts, tracer.Tag(k, v))\n\t}\n\tspan, _ := tracer.StartSpanFromContext(ctx, p.config.batchSpanName, opts...)\n\treturn span\n}", "func (t *Trace) NewSpan(name string) platform.Span {\n\ts := NewSpan(name).(*Span)\n\ts.logger = t.logger\n\treturn s\n}", "func newWarnEvent(pkg *pkg) (*WarnEvent, error) {\n\tvar result WarnEvent\n\terr := msgpack.Unmarshal(pkg.data, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "func newInstrumentationStmt(funcIdent string, args []dst.Expr) dst.Stmt {\n\treturn &dst.BlockStmt{\n\t\tList: []dst.Stmt{\n\t\t\t&dst.ExprStmt{\n\t\t\t\tX: &dst.CallExpr{\n\t\t\t\t\tFun: &dst.Ident{\n\t\t\t\t\t\tName: funcIdent,\n\t\t\t\t\t},\n\t\t\t\t\tArgs: args,\n\t\t\t\t\tEllipsis: false,\n\t\t\t\t\tDecs: dst.CallExprDecorations{},\n\t\t\t\t},\n\t\t\t\tDecs: dst.ExprStmtDecorations{},\n\t\t\t},\n\t\t},\n\t}\n}", "func (c *cluster) collectSpans(\n\tt *testing.T, txn *roachpb.Transaction, ts hlc.Timestamp, reqs []roachpb.Request,\n) (latchSpans, lockSpans *spanset.SpanSet) {\n\tlatchSpans, lockSpans = &spanset.SpanSet{}, &spanset.SpanSet{}\n\th := roachpb.Header{Txn: txn, Timestamp: ts}\n\tfor _, req := range reqs {\n\t\tif cmd, ok := batcheval.LookupCommand(req.Method()); ok {\n\t\t\tcmd.DeclareKeys(c.rangeDesc, h, req, latchSpans, lockSpans)\n\t\t} else {\n\t\t\tt.Fatalf(\"unrecognized command %s\", req.Method())\n\t\t}\n\t}\n\n\t// Commands may create a large number of duplicate spans. De-duplicate\n\t// them to reduce the number of spans we pass to the spanlatch manager.\n\tfor _, s := range [...]*spanset.SpanSet{latchSpans, lockSpans} {\n\t\ts.SortAndDedup()\n\t\tif err := s.Validate(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\treturn latchSpans, lockSpans\n}", "func NewCollector(api API) *Collector {\n\treturn &Collector{api: api}\n}", "func collectJoinRequestPacket(ctx common.Context, rxPacket gw.RXPacket) error {\n\treturn collectAndCallOnce(ctx.RedisPool, rxPacket, func(rxPacket models.RXPacket) error {\n\t\treturn handleCollectedJoinRequestPackets(ctx, rxPacket)\n\t})\n}", "func NewRawPacket(bytes ...[]byte) (*Packet, error) {\n\t//concatenate\n\tb := make([]byte, 0, MaxEIRPacketLength)\n\tfor _, bb := range bytes {\n\t\tb = append(b, bb...)\n\t}\n\n\t//decode the bytes\n\tm, err := parser.Parse(b)\n\tif err != nil {\n\t\tif !errors.Is(err, parser.EmptyOrNilPdu) {\n\t\t\terr = fmt.Errorf(\"pdu decode: %w\", err)\n\t\t} else {\n\t\t\terr = nil\n\t\t}\n\t}\n\n\tswitch {\n\tcase err == nil:\n\t\t// ok\n\tcase len(m) > 0:\n\t\t// some of the adv was ok, append the error\n\t\tm[ble.AdvertisementMapKeys.AdvertisementError] = err.Error()\n\tdefault:\n\t\t// nothing was ok parsed, exit\n\t\treturn nil, err\n\t}\n\n\tp := &Packet{b: b, m: m}\n\treturn p, nil\n}", "func NewCollector() Collector {\n\treturn make(Collector)\n}", "func NewCollector() *Collector {\n\twg := &sync.WaitGroup{}\n\tevtCh := make(chan *eventsapi.ClientEvent, collChanBufferSize)\n\n\tc := &Collector{&atomic.Value{}, wg, evtCh}\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\n\t\tvar events []*eventsapi.ClientEvent\n\t\tfor evt := range evtCh {\n\t\t\tevents = append(events, evt)\n\t\t}\n\n\t\tc.val.Store(events)\n\t}()\n\n\treturn c\n}", "func NewSpan() Span {\n\treturn newSpan(&otlptrace.Span{})\n}", "func newBatch(evts []*evtsapi.Event, offset *events.Offset) (events.Batch, error) {\n\tif offset == nil {\n\t\treturn nil, fmt.Errorf(\"cannot create a batch with nil offset\")\n\t}\n\treturn &batch{evts: evts, offset: offset}, nil\n}", "func (e *ebpfConntracker) Collect(ch chan<- prometheus.Metric) {\n\tebpfTelemetry := &netebpf.ConntrackTelemetry{}\n\tif err := e.telemetryMap.Lookup(unsafe.Pointer(&zero), unsafe.Pointer(ebpfTelemetry)); err != nil {\n\t\tlog.Tracef(\"error retrieving the telemetry struct: %s\", err)\n\t} else {\n\t\tdelta := ebpfTelemetry.Registers - conntrackerTelemetry.lastRegisters\n\t\tconntrackerTelemetry.lastRegisters = ebpfTelemetry.Registers\n\t\tch <- prometheus.MustNewConstMetric(conntrackerTelemetry.registersTotal, prometheus.CounterValue, float64(delta))\n\t}\n}", "func newNetBufPayload(data []byte) (*netBuf, []byte) {\n\tnb := &netBuf{\n\t\tbuf: data,\n\t\tpool: -1,\n\t}\n\treturn nb, nb.buf\n}", "func (tzGrpCol TimeZoneGroupCollection) New() TimeZoneGroupCollection {\n\tnewTzGrp := TimeZoneGroupCollection{}\n\n\tnewTzGrp.tzGroups = make([]TimeZoneGroupDto, 0, 300)\n\n\treturn newTzGrp\n}", "func NewPacketParser(source string, dst chan<- *Message) *PacketParser {\n\tpp := &PacketParser{\n\t\tasync: make(chan sendSentence, 200),\n\t\tsourceName: source,\n\t}\n\tgo pp.decodeSentences(dst)\n\treturn pp\n}", "func (c *HTTPCollector) createBuffer() []*zipkincore.Span {\n\treturn c.batchPool.Get().([]*zipkincore.Span)\n}", "func NewCollector() Collector {\n\treturn Collector{client: NewClient(time.Second * 5)}\n}", "func (l *listener) newPacketConn(raddr net.Addr) *PacketConn {\n\treturn &PacketConn{\n\t\tlistener: l,\n\t\traddr: raddr,\n\t\tbuffer: idtlsnet.NewPacketBuffer(),\n\t\tdoneCh: make(chan struct{}),\n\t\twriteDeadline: deadline.New(),\n\t}\n}", "func (network *Network) CreatePacket(rpc string, sourceip string, sourceid string, targetid string, contacts []Contact, value []byte) *packet {\n\tcreatedPacket := &packet{\n\t\tRPC: rpc,\n\t\tSourceID: sourceid,\n\t\tSourceIP: sourceip,\n\t\tTargetID: targetid,\n\t\tContacts: contacts,\n\t\tValue: value,\n\t}\n\treturn createdPacket\n}", "func (s ProxyClaimRequestRequest) NewLabel() (util.LocalizedText, error) {\n\tss, err := util.NewLocalizedText(s.Struct.Segment())\n\tif err != nil {\n\t\treturn util.LocalizedText{}, err\n\t}\n\terr = s.Struct.SetPtr(2, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func (m *MeterImpl) collect(ctx context.Context, labels []attribute.KeyValue, measurements []Measurement) {\n\tm.provider.addMeasurement(Batch{\n\t\tCtx: ctx,\n\t\tLabels: labels,\n\t\tMeasurements: measurements,\n\t\tLibrary: m.library,\n\t})\n}", "func (tr *tracer) newSpan(ctx context.Context, name string, config *trace.SpanConfig) trace.Span {\n\t// If told explicitly to make this a new root use a zero value SpanContext\n\t// as a parent which contains an invalid trace ID and is not remote.\n\tvar psc trace.SpanContext\n\tif config.NewRoot() {\n\t\tctx = trace.ContextWithSpanContext(ctx, psc)\n\t} else {\n\t\tpsc = trace.SpanContextFromContext(ctx)\n\t}\n\n\t// If there is a valid parent trace ID, use it to ensure the continuity of\n\t// the trace. Always generate a new span ID so other components can rely\n\t// on a unique span ID, even if the Span is non-recording.\n\tvar tid trace.TraceID\n\tvar sid trace.SpanID\n\tif !psc.TraceID().IsValid() {\n\t\ttid, sid = tr.provider.idGenerator.NewIDs(ctx)\n\t} else {\n\t\ttid = psc.TraceID()\n\t\tsid = tr.provider.idGenerator.NewSpanID(ctx, tid)\n\t}\n\n\tsamplingResult := tr.provider.sampler.ShouldSample(SamplingParameters{\n\t\tParentContext: ctx,\n\t\tTraceID: tid,\n\t\tName: name,\n\t\tKind: config.SpanKind(),\n\t\tAttributes: config.Attributes(),\n\t\tLinks: config.Links(),\n\t})\n\n\tscc := trace.SpanContextConfig{\n\t\tTraceID: tid,\n\t\tSpanID: sid,\n\t\tTraceState: samplingResult.Tracestate,\n\t}\n\tif isSampled(samplingResult) {\n\t\tscc.TraceFlags = psc.TraceFlags() | trace.FlagsSampled\n\t} else {\n\t\tscc.TraceFlags = psc.TraceFlags() &^ trace.FlagsSampled\n\t}\n\tsc := trace.NewSpanContext(scc)\n\n\tif !isRecording(samplingResult) {\n\t\treturn tr.newNonRecordingSpan(sc)\n\t}\n\treturn tr.newRecordingSpan(psc, sc, name, samplingResult, config)\n}", "func NewPBPacket(id ProtoID) interface{} {\n packet, ok := packetMap[id];\n if !ok {\n return nil;\n }\n ms, _ := packet.(proto.Message);\n \n return proto.Clone(ms)\n}", "func MakePacket(args ...interface{}) (pkt *pktmbuf.Packet) {\n\tvar mp *pktmbuf.Pool\n\tvar segments [][]byte\n\tvar headroom *Headroom\n\tfor i, arg := range args {\n\t\tswitch a := arg.(type) {\n\t\tcase []byte:\n\t\t\tsegments = append(segments, a)\n\t\tcase string:\n\t\t\tsegments = append(segments, BytesFromHex(a))\n\t\tcase []string:\n\t\t\tfor _, hexString := range a {\n\t\t\t\tsegments = append(segments, BytesFromHex(hexString))\n\t\t\t}\n\t\tcase *pktmbuf.Pool:\n\t\t\tmp = a\n\t\tcase Headroom:\n\t\t\theadroom = &a\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"MakePacket args[%d] invalid type %T\", i, arg))\n\t\t}\n\t}\n\n\tif mp == nil {\n\t\tmp = Direct.Pool()\n\t}\n\tif len(segments) == 0 {\n\t\treturn mp.MustAlloc(1)[0]\n\t}\n\n\tvec := mp.MustAlloc(len(segments))\n\tpkt = vec[0]\n\tfor i, b := range segments {\n\t\tseg := vec[i]\n\t\tif headroom != nil {\n\t\t\tseg.SetHeadroom(int(*headroom))\n\t\t}\n\t\tseg.Append(b)\n\t\tif i > 0 {\n\t\t\tpkt.Chain(seg)\n\t\t}\n\t}\n\treturn pkt\n}", "func (x *fastReflection_MsgCommunityPoolSpend) New() protoreflect.Message {\n\treturn new(fastReflection_MsgCommunityPoolSpend)\n}", "func (as *AggregateStore) Collect(id SpanID, anns ...Annotation) error {\n\tas.mu.Lock()\n\tdefer as.mu.Unlock()\n\n\t// Initialization\n\tif as.groups == nil {\n\t\tas.groups = make(map[ID]*spanGroup)\n\t\tas.groupsByName = make(map[string]ID)\n\t\tas.pre = &LimitStore{\n\t\t\tMax: as.MaxRate,\n\t\t\tDeleteStore: NewMemoryStore(),\n\t\t}\n\t}\n\n\t// Collect into the limit store.\n\tif err := as.pre.Collect(id, anns...); err != nil {\n\t\treturn err\n\t}\n\n\t// Consider eviction of old data.\n\tif time.Since(as.lastEvicted) > as.MinEvictAge {\n\t\tif err := as.evictBefore(time.Now().Add(-1 * as.MinEvictAge)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Grab the group for our span.\n\tgroup, ok := as.group(id, anns...)\n\tif !ok {\n\t\t// We don't have a group for the trace, and can't create one (the\n\t\t// spanName event isn't present yet).\n\t\treturn nil\n\t}\n\n\t// Unmarshal the events.\n\tvar events []Event\n\tif err := UnmarshalEvents(anns, &events); err != nil {\n\t\treturn err\n\t}\n\n\t// Find the start and end time of the trace.\n\teStart, eEnd, ok := findTraceTimes(events)\n\tif !ok {\n\t\t// We didn't find any timespan events at all, so we're done here.\n\t\treturn nil\n\t}\n\n\t// Update the group to consider this trace being one of the slowest.\n\tgroup.update(eStart, eEnd, id.Trace, func(trace ID) {\n\t\t// Delete the request trace from the output store.\n\t\tif err := as.deleteOutput(trace); err != nil {\n\t\t\tlog.Printf(\"AggregateStore: failed to delete a trace: %s\", err)\n\t\t}\n\t})\n\n\t// Move traces from the limit store into the group, as needed.\n\tfor _, slowest := range group.Slowest {\n\t\t// Find the trace in the limit store.\n\t\ttrace, err := as.pre.Trace(slowest.TraceID)\n\t\tif err == ErrTraceNotFound {\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Place into output store.\n\t\tvar walk func(t *Trace) error\n\t\twalk = func(t *Trace) error {\n\t\t\terr := as.MemoryStore.Collect(t.Span.ID, t.Span.Annotations...)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, sub := range t.Sub {\n\t\t\t\tif err := walk(sub); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif err := walk(trace); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Delete from the limit store.\n\t\terr = as.pre.Delete(slowest.TraceID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Prepare the aggregation event (before locking below).\n\tev := &AggregateEvent{\n\t\tName: group.Name,\n\t\tTimes: group.Times,\n\t}\n\tfor _, slowest := range group.Slowest {\n\t\tif !slowest.empty() {\n\t\t\tev.Slowest = append(ev.Slowest, slowest.TraceID)\n\t\t}\n\t}\n\tif as.Debug && len(ev.Slowest) == 0 {\n\t\tlog.Printf(\"AggregateStore: no slowest traces for group %q (consider increasing MaxRate)\", group.Name)\n\t}\n\n\t// As we're updating the aggregation event, we go ahead and delete the old\n\t// one now. We do this all under as.MemoryStore.Lock otherwise users (e.g. the\n\t// web UI) can pull from as.MemoryStore when the trace has been deleted.\n\tas.MemoryStore.Lock()\n\tdefer as.MemoryStore.Unlock()\n\tif err := as.MemoryStore.deleteNoLock(group.Trace); err != nil {\n\t\treturn err\n\t}\n\n\t// Record an aggregate event with the given name.\n\trecEvent := func(e Event) error {\n\t\tanns, err := MarshalEvent(e)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn as.MemoryStore.collectNoLock(SpanID{Trace: group.Trace}, anns...)\n\t}\n\tif err := recEvent(spanName{Name: group.Name}); err != nil {\n\t\treturn err\n\t}\n\tif err := recEvent(ev); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *bgpCollector) Collect(client collector.Client, ch chan<- prometheus.Metric, labelValues []string) error {\n\terr := c.collect(client, ch, labelValues)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (*latencyR) NewStruct() *latencyR {\n\treturn &latencyR{}\n}", "func NewIntervalOfSpan(l, s int64) Interval {\n\treturn NewInterval(l, l+s)\n}", "func New() *AllocGrp {\n\tvar m AllocGrp\n\treturn &m\n}", "func (bt *BlipTester) newRequest() *blip.Message {\n\tmsg := blip.NewRequest()\n\tbt.addCollectionProperty(msg)\n\treturn msg\n}", "func NewCollector(username string, token string, source string, timeout time.Duration, waitGroup *sync.WaitGroup) Collector {\n\treturn &collector{\n\t\turl: metricsEndpont,\n\t\tusername: username,\n\t\ttoken: token,\n\t\tsource: source,\n\t\ttimeout: timeout,\n\n\t\thttpClient: &http.Client{\n\t\t\tTimeout: time.Second * 30,\n\t\t},\n\t\twaitGroup: waitGroup,\n\t\tstop: make(chan bool),\n\t\tbuffer: make(chan gauge, 10000),\n\t}\n}", "func (s StaticInfoExtn) NewLatency() (StaticInfoExtn_LatencyInfo, error) {\n\tss, err := NewStaticInfoExtn_LatencyInfo(s.Struct.Segment())\n\tif err != nil {\n\t\treturn StaticInfoExtn_LatencyInfo{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func NewCollection(address, database, collection string) *Collection {\n\treturn &Collection{address: address, database: database, collection: collection}\n}", "func newReceive(name string, channel string) *Instruction {\n\treturn &Instruction{\n\t\tType: ReceiveInst,\n\t\tName: name,\n\t\tChannel: channel,\n\t}\n}", "func NewSpanID(bytes [8]byte) SpanID {\n\treturn SpanID{id: bytes}\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 New(windowSizes []time.Duration, opts *Options) *Latency {\n\tprecision := time.Nanosecond\n\tif opts != nil && opts.AvgPrecision.Nanoseconds() != 0 {\n\t\tprecision = opts.AvgPrecision\n\t}\n\tsf := precision / time.Nanosecond\n\tcompute := func(ts, now time.Time) time.Duration { return now.Sub(ts) }\n\tif opts != nil && opts.ComputeFunc != nil {\n\t\tcompute = opts.ComputeFunc\n\t}\n\tvar windows []*window\n\tfor _, size := range windowSizes {\n\t\twindows = append(windows, newWindow(size, sf.Nanoseconds()))\n\t}\n\treturn &Latency{\n\t\twindows: windows,\n\t\tscaleFactor: sf,\n\t\tcompute: compute,\n\t}\n}", "func newConstProto() *Instruction {\n\treturn &Instruction{\n\t\tType: ConstProtoInst,\n\t\tName: \"ConstProto\",\n\t}\n}", "func (s Sentry) New() cue.Collector {\n\tif s.DSN == \"\" || !validDSN(s.DSN) {\n\t\tlog.Warn(\"Sentry.New called to created a collector, but DSN param is empty or invalid. Returning nil collector.\")\n\t\treturn nil\n\t}\n\treturn &sentryCollector{\n\t\tSentry: s,\n\t\thttp: collector.HTTP{RequestFormatter: s.formatRequest}.New(),\n\t}\n}", "func (ack *TLCAck) CreatePacket() *GossipPacket {\n\treturn &GossipPacket{\n\t\tAck: ack,\n\t}\n}", "func newSpanAttributesProcessor(logger *zap.Logger, attrProc *attraction.AttrProc, skipExpr expr.BoolExpr[ottlspan.TransformContext]) *spanAttributesProcessor {\n\treturn &spanAttributesProcessor{\n\t\tlogger: logger,\n\t\tattrProc: attrProc,\n\t\tskipExpr: skipExpr,\n\t}\n}" ]
[ "0.5870983", "0.58339983", "0.5465129", "0.54080963", "0.54068404", "0.53500813", "0.53196156", "0.5210788", "0.5104033", "0.50751895", "0.49993894", "0.4986562", "0.49562997", "0.4911006", "0.4851788", "0.48231903", "0.48181325", "0.48133972", "0.48114294", "0.47517624", "0.47467238", "0.4743829", "0.47375944", "0.47084537", "0.4707631", "0.46969658", "0.46923175", "0.46914193", "0.46682075", "0.46443638", "0.4633962", "0.4623287", "0.45992997", "0.4594009", "0.45838043", "0.45803794", "0.45680404", "0.45524016", "0.45436624", "0.45175812", "0.45163614", "0.45117244", "0.45016155", "0.4501398", "0.4493037", "0.4483515", "0.44824034", "0.44668302", "0.44659483", "0.44652095", "0.44533607", "0.4452926", "0.44507053", "0.44474384", "0.44462577", "0.44441465", "0.44342765", "0.44275355", "0.44259456", "0.4425517", "0.44192117", "0.4399811", "0.43899953", "0.43864053", "0.43819934", "0.43745235", "0.4373213", "0.43694702", "0.4362457", "0.43598878", "0.43593884", "0.43528998", "0.43470305", "0.43468", "0.43456158", "0.43426877", "0.43417785", "0.43322182", "0.43205276", "0.43205205", "0.431368", "0.4305334", "0.43044743", "0.43017903", "0.43014362", "0.4300798", "0.42864162", "0.4280633", "0.42793158", "0.4274801", "0.42676046", "0.42606062", "0.4257083", "0.42565346", "0.42514035", "0.42321303", "0.42296574", "0.4226948", "0.42167306", "0.4216077" ]
0.87639284
0
Collect adds the span and annotations to a local buffer until the next call to Flush (or when MinInterval elapses), at which point they are sent (grouped by span) to the underlying collector.
func (cc *ChunkedCollector) Collect(span SpanID, anns ...Annotation) error { cc.mu.Lock() defer cc.mu.Unlock() if cc.stopped { return errors.New("ChunkedCollector is stopped") } if !cc.started { cc.start() } if cc.pendingBySpanID == nil { cc.pendingBySpanID = map[SpanID]*wire.CollectPacket{} } if p, present := cc.pendingBySpanID[span]; present { if len(anns) > 0 { p.Annotation = append(p.Annotation, Annotations(anns).wire()...) } } else { cc.pendingBySpanID[span] = newCollectPacket(span, anns) cc.pending = append(cc.pending, span) } if err := cc.lastErr; err != nil { cc.lastErr = nil return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (as *AggregateStore) Collect(id SpanID, anns ...Annotation) error {\n\tas.mu.Lock()\n\tdefer as.mu.Unlock()\n\n\t// Initialization\n\tif as.groups == nil {\n\t\tas.groups = make(map[ID]*spanGroup)\n\t\tas.groupsByName = make(map[string]ID)\n\t\tas.pre = &LimitStore{\n\t\t\tMax: as.MaxRate,\n\t\t\tDeleteStore: NewMemoryStore(),\n\t\t}\n\t}\n\n\t// Collect into the limit store.\n\tif err := as.pre.Collect(id, anns...); err != nil {\n\t\treturn err\n\t}\n\n\t// Consider eviction of old data.\n\tif time.Since(as.lastEvicted) > as.MinEvictAge {\n\t\tif err := as.evictBefore(time.Now().Add(-1 * as.MinEvictAge)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Grab the group for our span.\n\tgroup, ok := as.group(id, anns...)\n\tif !ok {\n\t\t// We don't have a group for the trace, and can't create one (the\n\t\t// spanName event isn't present yet).\n\t\treturn nil\n\t}\n\n\t// Unmarshal the events.\n\tvar events []Event\n\tif err := UnmarshalEvents(anns, &events); err != nil {\n\t\treturn err\n\t}\n\n\t// Find the start and end time of the trace.\n\teStart, eEnd, ok := findTraceTimes(events)\n\tif !ok {\n\t\t// We didn't find any timespan events at all, so we're done here.\n\t\treturn nil\n\t}\n\n\t// Update the group to consider this trace being one of the slowest.\n\tgroup.update(eStart, eEnd, id.Trace, func(trace ID) {\n\t\t// Delete the request trace from the output store.\n\t\tif err := as.deleteOutput(trace); err != nil {\n\t\t\tlog.Printf(\"AggregateStore: failed to delete a trace: %s\", err)\n\t\t}\n\t})\n\n\t// Move traces from the limit store into the group, as needed.\n\tfor _, slowest := range group.Slowest {\n\t\t// Find the trace in the limit store.\n\t\ttrace, err := as.pre.Trace(slowest.TraceID)\n\t\tif err == ErrTraceNotFound {\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Place into output store.\n\t\tvar walk func(t *Trace) error\n\t\twalk = func(t *Trace) error {\n\t\t\terr := as.MemoryStore.Collect(t.Span.ID, t.Span.Annotations...)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, sub := range t.Sub {\n\t\t\t\tif err := walk(sub); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif err := walk(trace); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Delete from the limit store.\n\t\terr = as.pre.Delete(slowest.TraceID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Prepare the aggregation event (before locking below).\n\tev := &AggregateEvent{\n\t\tName: group.Name,\n\t\tTimes: group.Times,\n\t}\n\tfor _, slowest := range group.Slowest {\n\t\tif !slowest.empty() {\n\t\t\tev.Slowest = append(ev.Slowest, slowest.TraceID)\n\t\t}\n\t}\n\tif as.Debug && len(ev.Slowest) == 0 {\n\t\tlog.Printf(\"AggregateStore: no slowest traces for group %q (consider increasing MaxRate)\", group.Name)\n\t}\n\n\t// As we're updating the aggregation event, we go ahead and delete the old\n\t// one now. We do this all under as.MemoryStore.Lock otherwise users (e.g. the\n\t// web UI) can pull from as.MemoryStore when the trace has been deleted.\n\tas.MemoryStore.Lock()\n\tdefer as.MemoryStore.Unlock()\n\tif err := as.MemoryStore.deleteNoLock(group.Trace); err != nil {\n\t\treturn err\n\t}\n\n\t// Record an aggregate event with the given name.\n\trecEvent := func(e Event) error {\n\t\tanns, err := MarshalEvent(e)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn as.MemoryStore.collectNoLock(SpanID{Trace: group.Trace}, anns...)\n\t}\n\tif err := recEvent(spanName{Name: group.Name}); err != nil {\n\t\treturn err\n\t}\n\tif err := recEvent(ev); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (rc *RemoteCollector) Collect(span SpanID, anns ...Annotation) error {\n\treturn rc.collectAndRetry(newCollectPacket(span, anns))\n}", "func (w *Writer) Collect(ch chan<- prometheus.Metric) {\n\tw.kafkaWriteStatus.Collect(ch)\n\tw.queuedForWrites.Collect(ch)\n}", "func (l *LabelStatistics) Collect() {\n\tl.RLock()\n\tdefer l.RUnlock()\n\tfor level, count := range l.labelCounter {\n\t\tregionLabelLevelGauge.WithLabelValues(level).Set(float64(count))\n\t}\n}", "func (m httpReferenceDiscoveryMetrics) Collect(metrics chan<- prometheus.Metric) {\n\tm.firstPacket.Collect(metrics)\n\tm.totalTime.Collect(metrics)\n\tm.advertisedRefs.Collect(metrics)\n}", "func (m *MeterImpl) collect(ctx context.Context, labels []attribute.KeyValue, measurements []Measurement) {\n\tm.provider.addMeasurement(Batch{\n\t\tCtx: ctx,\n\t\tLabels: labels,\n\t\tMeasurements: measurements,\n\t\tLibrary: m.library,\n\t})\n}", "func (c *cluster) collectSpans(\n\tt *testing.T, txn *roachpb.Transaction, ts hlc.Timestamp, reqs []roachpb.Request,\n) (latchSpans, lockSpans *spanset.SpanSet) {\n\tlatchSpans, lockSpans = &spanset.SpanSet{}, &spanset.SpanSet{}\n\th := roachpb.Header{Txn: txn, Timestamp: ts}\n\tfor _, req := range reqs {\n\t\tif cmd, ok := batcheval.LookupCommand(req.Method()); ok {\n\t\t\tcmd.DeclareKeys(c.rangeDesc, h, req, latchSpans, lockSpans)\n\t\t} else {\n\t\t\tt.Fatalf(\"unrecognized command %s\", req.Method())\n\t\t}\n\t}\n\n\t// Commands may create a large number of duplicate spans. De-duplicate\n\t// them to reduce the number of spans we pass to the spanlatch manager.\n\tfor _, s := range [...]*spanset.SpanSet{latchSpans, lockSpans} {\n\t\ts.SortAndDedup()\n\t\tif err := s.Validate(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\treturn latchSpans, lockSpans\n}", "func (cc *ChunkedCollector) Flush() error {\n\tcc.mu.Lock()\n\tpendingBySpanID := cc.pendingBySpanID\n\tpending := cc.pending\n\tcc.pendingBySpanID = nil\n\tcc.pending = nil\n\tcc.mu.Unlock()\n\n\tvar errs []error\n\tfor _, spanID := range pending {\n\t\tp := pendingBySpanID[spanID]\n\t\tif err := cc.Collector.Collect(spanIDFromWire(p.Spanid), annotationsFromWire(p.Annotation)...); err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\n\tif len(errs) == 1 {\n\t\treturn errs[0]\n\t} else if len(errs) > 1 {\n\t\treturn fmt.Errorf(\"ChunkedCollector: multiple errors: %v\", errs)\n\t}\n\treturn nil\n}", "func (collector *Collector) Collect(ch chan<- prometheus.Metric) {\n\tch <- prometheus.MustNewConstMetric(collector.incidentsCreatedCount, prometheus.CounterValue, collector.storage.GetIncidentsCreatedCount())\n}", "func (d *decorator) Collect(in chan<- prometheus.Metric) {\n\td.duration.Collect(in)\n\td.requests.Collect(in)\n}", "func Collect(metrics []Metric, c CloudWatchService, namespace string) {\n\tid, err := GetInstanceID()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor _, metric := range metrics {\n\t\tmetric.Collect(id, c, namespace)\n\t}\n}", "func (c *beatCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n}", "func (b *EBPFTelemetry) Collect(ch chan<- prometheus.Metric) {\n\tb.getHelpersTelemetry(ch)\n\tb.getMapsTelemetry(ch)\n}", "func (c *metricbeatCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n}", "func (c *Collector) Collect(ch chan<- prometheus.Metric) {\n\tc.mut.RLock()\n\tdefer c.mut.RUnlock()\n\n\tif c.inner != nil {\n\t\tc.inner.Collect(ch)\n\t}\n}", "func (c *filebeatCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n}", "func (c *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, cc := range c.collectors {\n\t\tcc.Collect(ch)\n\t}\n}", "func (c *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, cc := range c.collectors {\n\t\tcc.Collect(ch)\n\t}\n}", "func (mlw *Wrapper) Collect() {\n\tmlw.ml.Collect()\n\tsort.Sort(byLatency(mlw.ml.Results))\n}", "func (collector *MetricsCollector) Collect(ch chan<- prometheus.Metric) {\n\tfilterMetricsByKind := func(kind string, orgMetrics []constMetric) (filteredMetrics []constMetric) {\n\t\tfor _, metric := range orgMetrics {\n\t\t\tif metric.kind == kind {\n\t\t\t\tfilteredMetrics = append(filteredMetrics, metric)\n\t\t\t}\n\t\t}\n\t\treturn filteredMetrics\n\t}\n\tcollector.defMetrics.reset()\n\tfor k := range collector.metrics {\n\t\tcounters := filterMetricsByKind(config.KeyMetricTypeCounter, collector.metrics[k])\n\t\tgauges := filterMetricsByKind(config.KeyMetricTypeGauge, collector.metrics[k])\n\t\thistograms := filterMetricsByKind(config.KeyMetricTypeHistogram, collector.metrics[k])\n\t\tcollectCounters(counters, collector.defMetrics, ch)\n\t\tcollectGauges(gauges, collector.defMetrics, ch)\n\t\tcollectHistograms(histograms, collector.defMetrics, ch)\n\t\tcollector.cache.Reset()\n\t}\n\tcollector.defMetrics.collectDefaultMetrics(ch)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mu.Lock()\n\tdefer e.mu.Unlock()\n\n\tfor _, cc := range e.collectors {\n\t\tcc.Collect(ch)\n\t}\n}", "func (c *collector) Collect(ch chan<- prometheus.Metric) {\n\tc.m.Lock()\n\tfor _, m := range c.metrics {\n\t\tch <- m.metric\n\t}\n\tc.m.Unlock()\n}", "func (c *Aggregator) Collect(ctx context.Context, rec export.Record, exp export.Batcher) {\n\tc.checkpoint = c.current.SwapNumberAtomic(core.Number(0))\n\n\texp.Export(ctx, rec, c)\n}", "func (a *MetricAggregator) Flush(flushInterval time.Duration) {\n\ta.statser.Gauge(\"aggregator.metricmaps_received\", float64(a.metricMapsReceived), nil)\n\n\tflushInSeconds := float64(flushInterval) / float64(time.Second)\n\n\ta.metricMap.Counters.Each(func(key, tagsKey string, counter gostatsd.Counter) {\n\t\tcounter.PerSecond = float64(counter.Value) / flushInSeconds\n\t\ta.metricMap.Counters[key][tagsKey] = counter\n\t})\n\n\ta.metricMap.Timers.Each(func(key, tagsKey string, timer gostatsd.Timer) {\n\t\tif hasHistogramTag(timer) {\n\t\t\ttimer.Histogram = latencyHistogram(timer, a.histogramLimit)\n\t\t\ta.metricMap.Timers[key][tagsKey] = timer\n\t\t\treturn\n\t\t}\n\n\t\tif count := len(timer.Values); count > 0 {\n\t\t\tsort.Float64s(timer.Values)\n\t\t\ttimer.Min = timer.Values[0]\n\t\t\ttimer.Max = timer.Values[count-1]\n\t\t\tn := len(timer.Values)\n\t\t\tcount := float64(n)\n\n\t\t\tcumulativeValues := make([]float64, n)\n\t\t\tcumulSumSquaresValues := make([]float64, n)\n\t\t\tcumulativeValues[0] = timer.Min\n\t\t\tcumulSumSquaresValues[0] = timer.Min * timer.Min\n\t\t\tfor i := 1; i < n; i++ {\n\t\t\t\tcumulativeValues[i] = timer.Values[i] + cumulativeValues[i-1]\n\t\t\t\tcumulSumSquaresValues[i] = timer.Values[i]*timer.Values[i] + cumulSumSquaresValues[i-1]\n\t\t\t}\n\n\t\t\tvar sumSquares = timer.Min * timer.Min\n\t\t\tvar mean = timer.Min\n\t\t\tvar sum = timer.Min\n\t\t\tvar thresholdBoundary = timer.Max\n\n\t\t\tfor pct, pctStruct := range a.percentThresholds {\n\t\t\t\tnumInThreshold := n\n\t\t\t\tif n > 1 {\n\t\t\t\t\tnumInThreshold = int(round(math.Abs(pct) / 100 * count))\n\t\t\t\t\tif numInThreshold == 0 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif pct > 0 {\n\t\t\t\t\t\tthresholdBoundary = timer.Values[numInThreshold-1]\n\t\t\t\t\t\tsum = cumulativeValues[numInThreshold-1]\n\t\t\t\t\t\tsumSquares = cumulSumSquaresValues[numInThreshold-1]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthresholdBoundary = timer.Values[n-numInThreshold]\n\t\t\t\t\t\tsum = cumulativeValues[n-1] - cumulativeValues[n-numInThreshold-1]\n\t\t\t\t\t\tsumSquares = cumulSumSquaresValues[n-1] - cumulSumSquaresValues[n-numInThreshold-1]\n\t\t\t\t\t}\n\t\t\t\t\tmean = sum / float64(numInThreshold)\n\t\t\t\t}\n\n\t\t\t\tif !a.disabledSubtypes.CountPct {\n\t\t\t\t\ttimer.Percentiles.Set(pctStruct.count, float64(numInThreshold))\n\t\t\t\t}\n\t\t\t\tif !a.disabledSubtypes.MeanPct {\n\t\t\t\t\ttimer.Percentiles.Set(pctStruct.mean, mean)\n\t\t\t\t}\n\t\t\t\tif !a.disabledSubtypes.SumPct {\n\t\t\t\t\ttimer.Percentiles.Set(pctStruct.sum, sum)\n\t\t\t\t}\n\t\t\t\tif !a.disabledSubtypes.SumSquaresPct {\n\t\t\t\t\ttimer.Percentiles.Set(pctStruct.sumSquares, sumSquares)\n\t\t\t\t}\n\t\t\t\tif pct > 0 {\n\t\t\t\t\tif !a.disabledSubtypes.UpperPct {\n\t\t\t\t\t\ttimer.Percentiles.Set(pctStruct.upper, thresholdBoundary)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif !a.disabledSubtypes.LowerPct {\n\t\t\t\t\t\ttimer.Percentiles.Set(pctStruct.lower, thresholdBoundary)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsum = cumulativeValues[n-1]\n\t\t\tsumSquares = cumulSumSquaresValues[n-1]\n\t\t\tmean = sum / count\n\n\t\t\tvar sumOfDiffs float64\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tsumOfDiffs += (timer.Values[i] - mean) * (timer.Values[i] - mean)\n\t\t\t}\n\n\t\t\tmid := int(math.Floor(count / 2))\n\t\t\tif math.Mod(count, 2) == 0 {\n\t\t\t\ttimer.Median = (timer.Values[mid-1] + timer.Values[mid]) / 2\n\t\t\t} else {\n\t\t\t\ttimer.Median = timer.Values[mid]\n\t\t\t}\n\n\t\t\ttimer.Mean = mean\n\t\t\ttimer.StdDev = math.Sqrt(sumOfDiffs / count)\n\t\t\ttimer.Sum = sum\n\t\t\ttimer.SumSquares = sumSquares\n\n\t\t\ttimer.Count = int(round(timer.SampledCount))\n\t\t\ttimer.PerSecond = timer.SampledCount / flushInSeconds\n\t\t} else {\n\t\t\ttimer.Count = 0\n\t\t\ttimer.SampledCount = 0\n\t\t\ttimer.PerSecond = 0\n\t\t}\n\t\ta.metricMap.Timers[key][tagsKey] = timer\n\t})\n}", "func (c *Collector) Collect(scs []stats.SampleContainer) {\n\tc.lock.Lock()\n\tfor _, sc := range scs {\n\t\tc.Samples = append(c.Samples, sc.GetSamples()...)\n\t}\n\tc.lock.Unlock()\n}", "func (c *auditdCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n}", "func (e *ServiceQuotasExporter) Collect(ch chan<- prometheus.Metric) {\n\tquotas, err := e.quotasClient.QuotasAndUsage()\n\tif err != nil {\n\t\tlog.Errorf(\"Can not retrieve quotas and limits: %s\", err)\n\t}\n\n\tfor _, quota := range quotas {\n\t\tresourceID := quota.Identifier()\n\n\t\tmetricLimit, ok := e.metricsQuotaLimit[resourceID]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tch <- prometheus.MustNewConstMetric(metricLimit, prometheus.GaugeValue, quota.Quota, resourceID)\n\n\t\tmetricUsed, ok := e.metricsUsedQuota[resourceID]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tch <- prometheus.MustNewConstMetric(metricUsed, prometheus.GaugeValue, quota.Usage, resourceID)\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.withCollectors(func(cs []prometheus.Collector) {\n\t\tfor _, c := range cs {\n\t\t\tc.Collect(ch)\n\t\t}\n\t})\n}", "func (o *requestMetrics) Collect(ch chan<- prometheus.Metric) {\n\tmetricFamilies, err := o.stStore.GetPromDirectMetrics()\n\tif err != nil {\n\t\tklog.Errorf(\"fetch prometheus metrics failed: %v\", err)\n\t\treturn\n\t}\n\to.handleMetrics(metricFamilies, ch)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\tif err := e.collect(ch); err != nil {\n\t\tlog.Errorf(\"Error scraping ingestor: %s\", err)\n\t}\n\treturn\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\tif err := e.scrape(); err != nil {\n\t\tlog.Error(err)\n\t\tnomad_up.Set(0)\n\t\tch <- nomad_up\n\t\treturn\n\t}\n\n\tch <- nomad_up\n\tch <- metric_uptime\n\tch <- metric_request_response_time_total\n\tch <- metric_request_response_time_avg\n\n\tfor _, metric := range metric_request_status_count_current {\n\t\tch <- metric\n\t}\n\tfor _, metric := range metric_request_status_count_total {\n\t\tch <- metric\n\t}\n}", "func (c *VMCollector) Collect(ch chan<- prometheus.Metric) {\n\tfor _, m := range c.getMetrics() {\n\t\tch <- m\n\t}\n}", "func (collector *Metrics) Collect(ch chan<- prometheus.Metric) {\n\n\tcollectedIssues, err := fetchJiraIssues()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\tfor _, issue := range collectedIssues.Issues {\n\t\tcreatedTimestamp := convertToUnixTime(issue.Fields.Created)\n\t\tch <- prometheus.MustNewConstMetric(collector.issue, prometheus.CounterValue, createdTimestamp, issue.Fields.Status.Name, issue.Fields.Project.Name, issue.Key, issue.Fields.Assignee.Name, issue.Fields.Location.Name, issue.Fields.Priority.Name, issue.Fields.Level.Name, issue.Fields.RequestType.Name, issue.Fields.Feedback, issue.Fields.Urgency.Name, issue.Fields.IssueType.Name, issue.Fields.Reporter.Name, issue.Fields.Satisfaction)\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\t// Reset metrics.\n\tfor _, vec := range e.gauges {\n\t\tvec.Reset()\n\t}\n\n\tfor _, vec := range e.counters {\n\t\tvec.Reset()\n\t}\n\n\tresp, err := e.client.Get(e.URI)\n\tif err != nil {\n\t\te.up.Set(0)\n\t\tlog.Printf(\"Error while querying Elasticsearch: %v\", err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tlog.Printf(\"Failed to read ES response body: %v\", err)\n\t\te.up.Set(0)\n\t\treturn\n\t}\n\n\te.up.Set(1)\n\n\tvar all_stats NodeStatsResponse\n\terr = json.Unmarshal(body, &all_stats)\n\n\tif err != nil {\n\t\tlog.Printf(\"Failed to unmarshal JSON into struct: %v\", err)\n\t\treturn\n\t}\n\n\t// Regardless of whether we're querying the local host or the whole\n\t// cluster, here we can just iterate through all nodes found.\n\n\tfor node, stats := range all_stats.Nodes {\n\t\tlog.Printf(\"Processing node %v\", node)\n\t\t// GC Stats\n\t\tfor collector, gcstats := range stats.JVM.GC.Collectors {\n\t\t\te.counters[\"jvm_gc_collection_count\"].WithLabelValues(all_stats.ClusterName, stats.Name, collector).Set(float64(gcstats.CollectionCount))\n\t\t\te.counters[\"jvm_gc_collection_time_in_millis\"].WithLabelValues(all_stats.ClusterName, stats.Name, collector).Set(float64(gcstats.CollectionTime))\n\t\t}\n\n\t\t// Breaker stats\n\t\tfor breaker, bstats := range stats.Breakers {\n\t\t\te.gauges[\"breakers_estimated_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name, breaker).Set(float64(bstats.EstimatedSize))\n\t\t\te.gauges[\"breakers_limit_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name, breaker).Set(float64(bstats.LimitSize))\n\t\t}\n\n\t\t// JVM Memory Stats\n\t\te.gauges[\"jvm_mem_heap_committed_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.HeapCommitted))\n\t\te.gauges[\"jvm_mem_heap_used_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.HeapUsed))\n\t\te.gauges[\"jvm_mem_heap_max_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.HeapMax))\n\t\te.gauges[\"jvm_mem_non_heap_committed_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.NonHeapCommitted))\n\t\te.gauges[\"jvm_mem_non_heap_used_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.NonHeapUsed))\n\n\t\t// Indices Stats\n\t\te.gauges[\"indices_fielddata_evictions\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.FieldData.Evictions))\n\t\te.gauges[\"indices_fielddata_memory_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.FieldData.MemorySize))\n\t\te.gauges[\"indices_filter_cache_evictions\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.FilterCache.Evictions))\n\t\te.gauges[\"indices_filter_cache_memory_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.FilterCache.MemorySize))\n\n\t\te.gauges[\"indices_docs_count\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Docs.Count))\n\t\te.gauges[\"indices_docs_deleted\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Docs.Deleted))\n\n\t\te.gauges[\"indices_segments_memory_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Segments.Memory))\n\n\t\te.gauges[\"indices_store_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Store.Size))\n\t\te.counters[\"indices_store_throttle_time_in_millis\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Store.ThrottleTime))\n\n\t\te.counters[\"indices_flush_total\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Flush.Total))\n\t\te.counters[\"indices_flush_time_in_millis\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Flush.Time))\n\n\t\t// Transport Stats\n\t\te.counters[\"transport_rx_count\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Transport.RxCount))\n\t\te.counters[\"transport_rx_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Transport.RxSize))\n\t\te.counters[\"transport_tx_count\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Transport.TxCount))\n\t\te.counters[\"transport_tx_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Transport.TxSize))\n\t}\n\n\t// Report metrics.\n\tch <- e.up\n\n\tfor _, vec := range e.counters {\n\t\tvec.Collect(ch)\n\t}\n\n\tfor _, vec := range e.gauges {\n\t\tvec.Collect(ch)\n\t}\n}", "func (c *libbeatCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n\t// output.type with dynamic label\n\tch <- prometheus.MustNewConstMetric(libbeatOutputType, prometheus.CounterValue, float64(1), c.stats.LibBeat.Output.Type)\n\n}", "func (t *TimestampCollector) Collect(ch chan<- prometheus.Metric) {\n\t// New map to dedup filenames.\n\tuniqueFiles := make(map[string]float64)\n\tt.lock.RLock()\n\tfor fileSD := range t.discoverers {\n\t\tfileSD.lock.RLock()\n\t\tfor filename, timestamp := range fileSD.timestamps {\n\t\t\tuniqueFiles[filename] = timestamp\n\t\t}\n\t\tfileSD.lock.RUnlock()\n\t}\n\tt.lock.RUnlock()\n\tfor filename, timestamp := range uniqueFiles {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tt.Description,\n\t\t\tprometheus.GaugeValue,\n\t\t\ttimestamp,\n\t\t\tfilename,\n\t\t)\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\tif err := e.collect(ch); err != nil {\n\t\tlog.Errorf(\"Error scraping: %s\", err)\n\t}\n\treturn\n}", "func (e *exporter) Collect(ch chan<- prometheus.Metric) {\n\twg := sync.WaitGroup{}\n\twg.Add(len(e.Collectors))\n\tfor name, c := range e.Collectors {\n\t\tgo func(name string, c Collector) {\n\t\t\texecute(name, c, ch)\n\t\t\twg.Done()\n\t\t}(name, c)\n\t}\n\twg.Wait()\n}", "func (c *Collector) Collect(sampleContainers []stats.SampleContainer) {\n\tselect {\n\tcase <-c.stopSendingMetricsCh:\n\t\treturn\n\tdefault:\n\t}\n\n\tif c.referenceID == \"\" {\n\t\treturn\n\t}\n\n\tnewSamples := []*Sample{}\n\tnewHTTPTrails := []*httpext.Trail{}\n\n\tfor _, sampleContainer := range sampleContainers {\n\t\tswitch sc := sampleContainer.(type) {\n\t\tcase *httpext.Trail:\n\t\t\tsc = useCloudTags(sc)\n\t\t\t// Check if aggregation is enabled,\n\t\t\tif c.config.AggregationPeriod.Duration > 0 {\n\t\t\t\tnewHTTPTrails = append(newHTTPTrails, sc)\n\t\t\t} else {\n\t\t\t\tnewSamples = append(newSamples, NewSampleFromTrail(sc))\n\t\t\t}\n\t\tcase *netext.NetTrail:\n\t\t\t// TODO: aggregate?\n\t\t\tvalues := map[string]float64{\n\t\t\t\tmetrics.DataSent.Name: float64(sc.BytesWritten),\n\t\t\t\tmetrics.DataReceived.Name: float64(sc.BytesRead),\n\t\t\t}\n\n\t\t\tif sc.FullIteration {\n\t\t\t\tvalues[metrics.IterationDuration.Name] = stats.D(sc.EndTime.Sub(sc.StartTime))\n\t\t\t\tvalues[metrics.Iterations.Name] = 1\n\t\t\t}\n\n\t\t\tnewSamples = append(newSamples, &Sample{\n\t\t\t\tType: DataTypeMap,\n\t\t\t\tMetric: \"iter_li_all\",\n\t\t\t\tData: &SampleDataMap{\n\t\t\t\t\tTime: toMicroSecond(sc.GetTime()),\n\t\t\t\t\tTags: sc.GetTags(),\n\t\t\t\t\tValues: values,\n\t\t\t\t},\n\t\t\t})\n\t\tdefault:\n\t\t\tfor _, sample := range sampleContainer.GetSamples() {\n\t\t\t\tnewSamples = append(newSamples, &Sample{\n\t\t\t\t\tType: DataTypeSingle,\n\t\t\t\t\tMetric: sample.Metric.Name,\n\t\t\t\t\tData: &SampleDataSingle{\n\t\t\t\t\t\tType: sample.Metric.Type,\n\t\t\t\t\t\tTime: toMicroSecond(sample.Time),\n\t\t\t\t\t\tTags: sample.Tags,\n\t\t\t\t\t\tValue: sample.Value,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(newSamples) > 0 || len(newHTTPTrails) > 0 {\n\t\tc.bufferMutex.Lock()\n\t\tc.bufferSamples = append(c.bufferSamples, newSamples...)\n\t\tc.bufferHTTPTrails = append(c.bufferHTTPTrails, newHTTPTrails...)\n\t\tc.bufferMutex.Unlock()\n\t}\n}", "func (p *Collector) Collect(c chan<- prometheus.Metric) {\n\tp.Sink.mu.Lock()\n\tdefer p.Sink.mu.Unlock()\n\n\texpire := p.Sink.expiration != 0\n\tnow := time.Now()\n\tfor k, v := range p.Sink.gauges {\n\t\tlast := p.Sink.updates[k]\n\t\tif expire && last.Add(p.Sink.expiration).Before(now) {\n\t\t\tdelete(p.Sink.updates, k)\n\t\t\tdelete(p.Sink.gauges, k)\n\t\t} else {\n\t\t\tv.Collect(c)\n\t\t}\n\t}\n\tfor k, v := range p.Sink.summaries {\n\t\tlast := p.Sink.updates[k]\n\t\tif expire && last.Add(p.Sink.expiration).Before(now) {\n\t\t\tdelete(p.Sink.updates, k)\n\t\t\tdelete(p.Sink.summaries, k)\n\t\t} else {\n\t\t\tv.Collect(c)\n\t\t}\n\t}\n\tfor k, v := range p.Sink.counters {\n\t\tlast := p.Sink.updates[k]\n\t\tif expire && last.Add(p.Sink.expiration).Before(now) {\n\t\t\tdelete(p.Sink.updates, k)\n\t\t\tdelete(p.Sink.counters, k)\n\t\t} else {\n\t\t\tv.Collect(c)\n\t\t}\n\t}\n}", "func (c *collector) Collect(ch chan<- prometheus.Metric) {\n\tc.mu.Lock()\n\t// Get the last views\n\tviews := c.views\n\t// Now clear them out for the next accumulation\n\tc.views = c.views[:0]\n\tc.mu.Unlock()\n\n\tif len(views) == 0 {\n\t\treturn\n\t}\n\n\t// seen is necessary because within each Collect cycle\n\t// if a Metric is sent to Prometheus with the same make up\n\t// that is \"name\" and \"labels\", it will error out.\n\tseen := make(map[prometheus.Metric]bool)\n\n\tfor _, vd := range views {\n\t\tfor _, row := range vd.Rows {\n\t\t\tmetric := c.toMetric(vd.View, row)\n\t\t\tif _, ok := seen[metric]; !ok && metric != nil {\n\t\t\t\tch <- metric\n\t\t\t\tseen[metric] = true\n\t\t\t}\n\t\t}\n\t}\n}", "func (c *analysisRunCollector) Collect(ch chan<- prometheus.Metric) {\n\tanalysisRuns, err := c.store.List(labels.NewSelector())\n\tif err != nil {\n\t\tlog.Warnf(\"Failed to collect analysisRuns: %v\", err)\n\t\treturn\n\t}\n\tfor _, ar := range analysisRuns {\n\t\tcollectAnalysisRuns(ch, ar)\n\t}\n}", "func (h *Metrics) Collect(in chan<- prometheus.Metric) {\n\th.duration.Collect(in)\n\th.totalRequests.Collect(in)\n\th.requestSize.Collect(in)\n\th.responseSize.Collect(in)\n\th.handlerStatuses.Collect(in)\n\th.responseTime.Collect(in)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\tif err := e.scrape(ch); err != nil {\n\t\tlog.Printf(\"Error scraping nightscout url: %s\", err)\n\t}\n\n\te.statusNightscout.Collect(ch)\n\n\treturn\n}", "func (r *RGWCollector) Collect(ch chan<- prometheus.Metric, version *Version) {\n\tif !r.background {\n\t\tr.logger.WithField(\"background\", r.background).Debug(\"collecting RGW GC stats\")\n\t\terr := r.collect()\n\t\tif err != nil {\n\t\t\tr.logger.WithField(\"background\", r.background).WithError(err).Error(\"error collecting RGW GC stats\")\n\t\t}\n\t}\n\n\tfor _, metric := range r.collectorList() {\n\t\tmetric.Collect(ch)\n\t}\n}", "func (e *ebpfConntracker) Collect(ch chan<- prometheus.Metric) {\n\tebpfTelemetry := &netebpf.ConntrackTelemetry{}\n\tif err := e.telemetryMap.Lookup(unsafe.Pointer(&zero), unsafe.Pointer(ebpfTelemetry)); err != nil {\n\t\tlog.Tracef(\"error retrieving the telemetry struct: %s\", err)\n\t} else {\n\t\tdelta := ebpfTelemetry.Registers - conntrackerTelemetry.lastRegisters\n\t\tconntrackerTelemetry.lastRegisters = ebpfTelemetry.Registers\n\t\tch <- prometheus.MustNewConstMetric(conntrackerTelemetry.registersTotal, prometheus.CounterValue, float64(delta))\n\t}\n}", "func (a collectorAdapter) Collect(ch chan<- prometheus.Metric) {\n\tif err := a.Update(ch); err != nil {\n\t\tpanic(fmt.Sprintf(\"failed to update collector: %v\", err))\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\tif err := e.collect(ch); err != nil {\n\t\tglog.Error(fmt.Sprintf(\"Error collecting stats: %s\", err))\n\t}\n\treturn\n}", "func (r *RegionStatistics) Collect() {\n\tr.RLock()\n\tdefer r.RUnlock()\n\tregionMissPeerRegionCounter.Set(float64(len(r.stats[MissPeer])))\n\tregionExtraPeerRegionCounter.Set(float64(len(r.stats[ExtraPeer])))\n\tregionDownPeerRegionCounter.Set(float64(len(r.stats[DownPeer])))\n\tregionPendingPeerRegionCounter.Set(float64(len(r.stats[PendingPeer])))\n\tregionOfflinePeerRegionCounter.Set(float64(len(r.stats[OfflinePeer])))\n\tregionLearnerPeerRegionCounter.Set(float64(len(r.stats[LearnerPeer])))\n\tregionEmptyRegionCounter.Set(float64(len(r.stats[EmptyRegion])))\n\tregionOversizedRegionCounter.Set(float64(len(r.stats[OversizedRegion])))\n\tregionUndersizedRegionCounter.Set(float64(len(r.stats[UndersizedRegion])))\n\tregionWitnessLeaderRegionCounter.Set(float64(len(r.stats[WitnessLeader])))\n}", "func (c *CephExporter) Collect(ch chan<- prometheus.Metric) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, cc := range c.collectors {\n\t\tcc.Collect(ch)\n\t}\n}", "func (m *Metrics) Collect() error {\n\tfor range time.Tick(m.cInterval) {\n\t\tcontainers, err := m.docker.ContainerList()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, container := range containers {\n\t\t\tif _, ok := m.metrics[container.Names[0][1:]]; !ok {\n\t\t\t\tgo func() {\n\t\t\t\t\tif err := m.collect(container.Names[0][1:]); err != nil {\n\t\t\t\t\t\tlog.Fatal().Err(err).Msg(\"collection metrics error\")\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t\t\tlog.Info().Msgf(\"new container %s\", container.Names[0][1:])\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tjunosTotalScrapeCount++\n\tch <- prometheus.MustNewConstMetric(junosDesc[\"ScrapesTotal\"], prometheus.CounterValue, junosTotalScrapeCount)\n\n\twg := &sync.WaitGroup{}\n\tfor _, collector := range e.Collectors {\n\t\twg.Add(1)\n\t\tgo e.runCollector(ch, collector, wg)\n\t}\n\twg.Wait()\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\tup := e.scrape(ch)\n\n\tch <- prometheus.MustNewConstMetric(artifactoryUp, prometheus.GaugeValue, up)\n\tch <- e.totalScrapes\n\tch <- e.jsonParseFailures\n}", "func (m *ClientMetrics) Collect(ch chan<- prom.Metric) {\n\tm.clientStartedCounter.Collect(ch)\n\tm.clientHandledCounter.Collect(ch)\n\tm.clientStreamMsgReceived.Collect(ch)\n\tm.clientStreamMsgSent.Collect(ch)\n\tif m.clientHandledHistogramEnabled {\n\t\tm.clientHandledHistogram.Collect(ch)\n\t}\n}", "func (c *Client) Collect(s stat.Stat) error {\n\tbuf, err := json.Marshal(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/collect\", c.url), bytes.NewBuffer(buf))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn errors.Wrap(errors.New(resp.Status), \"statscoll\")\n\t}\n\n\treturn nil\n}", "func (c *goCollector) Collect(ch chan<- Metric) {\n\t// Collect base non-memory metrics.\n\tc.base.Collect(ch)\n\n\tif len(c.sampleBuf) == 0 {\n\t\treturn\n\t}\n\n\t// Collect must be thread-safe, so prevent concurrent use of\n\t// sampleBuf elements. Just read into sampleBuf but write all the data\n\t// we get into our Metrics or MemStats.\n\t//\n\t// This lock also ensures that the Metrics we send out are all from\n\t// the same updates, ensuring their mutual consistency insofar as\n\t// is guaranteed by the runtime/metrics package.\n\t//\n\t// N.B. This locking is heavy-handed, but Collect is expected to be called\n\t// relatively infrequently. Also the core operation here, metrics.Read,\n\t// is fast (O(tens of microseconds)) so contention should certainly be\n\t// low, though channel operations and any allocations may add to that.\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\t// Populate runtime/metrics sample buffer.\n\tmetrics.Read(c.sampleBuf)\n\n\t// Collect all our runtime/metrics user chose to expose from sampleBuf (if any).\n\tfor i, metric := range c.rmExposedMetrics {\n\t\t// We created samples for exposed metrics first in order, so indexes match.\n\t\tsample := c.sampleBuf[i]\n\n\t\t// N.B. switch on concrete type because it's significantly more efficient\n\t\t// than checking for the Counter and Gauge interface implementations. In\n\t\t// this case, we control all the types here.\n\t\tswitch m := metric.(type) {\n\t\tcase *counter:\n\t\t\t// Guard against decreases. This should never happen, but a failure\n\t\t\t// to do so will result in a panic, which is a harsh consequence for\n\t\t\t// a metrics collection bug.\n\t\t\tv0, v1 := m.get(), unwrapScalarRMValue(sample.Value)\n\t\t\tif v1 > v0 {\n\t\t\t\tm.Add(unwrapScalarRMValue(sample.Value) - m.get())\n\t\t\t}\n\t\t\tm.Collect(ch)\n\t\tcase *gauge:\n\t\t\tm.Set(unwrapScalarRMValue(sample.Value))\n\t\t\tm.Collect(ch)\n\t\tcase *batchHistogram:\n\t\t\tm.update(sample.Value.Float64Histogram(), c.exactSumFor(sample.Name))\n\t\t\tm.Collect(ch)\n\t\tdefault:\n\t\t\tpanic(\"unexpected metric type\")\n\t\t}\n\t}\n\n\tif c.msMetricsEnabled {\n\t\t// ms is a dummy MemStats that we populate ourselves so that we can\n\t\t// populate the old metrics from it if goMemStatsCollection is enabled.\n\t\tvar ms runtime.MemStats\n\t\tmemStatsFromRM(&ms, c.sampleMap)\n\t\tfor _, i := range c.msMetrics {\n\t\t\tch <- MustNewConstMetric(i.desc, i.valType, i.eval(&ms))\n\t\t}\n\t}\n}", "func (c *interfaceCollector) Collect(client *rpc.Client, ch chan<- prometheus.Metric, labelValues []string) error {\n\tstats, err := c.interfaceStats(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, s := range stats {\n\t\tc.collectForInterface(s, ch, labelValues)\n\t}\n\n\treturn nil\n}", "func (c *logMetricsCollector) CollectWithStability(ch chan<- metrics.Metric) {\n\tpodStats, err := c.podStats(context.Background())\n\tif err != nil {\n\t\tklog.ErrorS(err, \"Failed to get pod stats\")\n\t\treturn\n\t}\n\n\tfor _, ps := range podStats {\n\t\tfor _, c := range ps.Containers {\n\t\t\tif c.Logs != nil && c.Logs.UsedBytes != nil {\n\t\t\t\tch <- metrics.NewLazyConstMetric(\n\t\t\t\t\tdescLogSize,\n\t\t\t\t\tmetrics.GaugeValue,\n\t\t\t\t\tfloat64(*c.Logs.UsedBytes),\n\t\t\t\t\tps.PodRef.UID,\n\t\t\t\t\tps.PodRef.Namespace,\n\t\t\t\t\tps.PodRef.Name,\n\t\t\t\t\tc.Name,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}", "func (p *promProducer) Collect(ch chan<- prometheus.Metric) {\n\tfor _, obj := range p.store.Objects() {\n\t\tmessage, ok := obj.(producers.MetricsMessage)\n\t\tif !ok {\n\t\t\tpromLog.Warnf(\"Unsupported message type %T\", obj)\n\t\t\tcontinue\n\t\t}\n\t\tdims := dimsToMap(message.Dimensions)\n\n\t\tfor _, d := range message.Datapoints {\n\t\t\tpromLog.Debugf(\"Processing datapoint %s\", d.Name)\n\t\t\tvar tagKeys []string\n\t\t\tvar tagVals []string\n\t\t\tfor k, v := range dims {\n\t\t\t\ttagKeys = append(tagKeys, sanitizeName(k))\n\t\t\t\ttagVals = append(tagVals, v)\n\t\t\t}\n\t\t\tfor k, v := range d.Tags {\n\t\t\t\ttagKeys = append(tagKeys, sanitizeName(k))\n\t\t\t\ttagVals = append(tagVals, v)\n\t\t\t}\n\n\t\t\tname := sanitizeName(d.Name)\n\t\t\tval, err := coerceToFloat(d.Value)\n\t\t\tif err != nil {\n\t\t\t\tpromLog.Warnf(\"Bad datapoint value %q: %s\", d.Value, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdesc := prometheus.NewDesc(name, \"DC/OS Metrics Datapoint\", tagKeys, nil)\n\t\t\tmetric, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, val, tagVals...)\n\t\t\tif err != nil {\n\t\t\t\tpromLog.Warnf(\"Could not create Prometheus metric %s: %s\", name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpromLog.Debugf(\"Emitting datapoint %s\", name)\n\t\t\tch <- metric\n\t\t}\n\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\t// Protect metrics from concurrent collects.\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\n\t// Scrape metrics from Tankerkoenig API.\n\tif err := e.scrape(ch); err != nil {\n\t\te.logger.Printf(\"error: cannot scrape tankerkoenig api: %v\", err)\n\t}\n\n\t// Collect metrics.\n\te.up.Collect(ch)\n\te.scrapeDuration.Collect(ch)\n\te.failedScrapes.Collect(ch)\n\te.totalScrapes.Collect(ch)\n}", "func (p *statelessAsyncInstrument[N, Storage, Methods]) Collect(seq data.Sequence, output *[]data.Instrument) {\n\tp.instLock.Lock()\n\tdefer p.instLock.Unlock()\n\n\tioutput := p.appendInstrument(output)\n\n\tfor set, entry := range p.data {\n\t\tp.appendPoint(ioutput, set, &entry.storage, aggregation.CumulativeTemporality, seq.Start, seq.Now, false)\n\t}\n\n\t// Reset the entire map.\n\tp.data = map[attribute.Set]*storageHolder[Storage, notUsed]{}\n}", "func (c *bgpCollector) Collect(client collector.Client, ch chan<- prometheus.Metric, labelValues []string) error {\n\terr := c.collect(client, ch, labelValues)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (fl *flusher) Flush(ctx context.Context, span opentracing.Span, classrooms []models.Classroom) []models.Classroom {\n\n\tchunks, err := utils.SplitSlice(classrooms, fl.chunkSize)\n\n\tif err != nil {\n\t\treturn classrooms\n\t}\n\n\tfor i, chunk := range chunks {\n\n\t\tvar childSpan opentracing.Span\n\t\tif span != nil {\n\t\t\tchildSpan = opentracing.StartSpan(\"Flush\", opentracing.ChildOf(span.Context()))\n\t\t}\n\n\t\t_, err := fl.repo.MultiAddClassroom(ctx, chunk)\n\n\t\tif span != nil {\n\n\t\t\tchildSpan.LogFields(\n\t\t\t\tlog.Int(\"len\", len(chunk)),\n\t\t\t\tlog.Bool(\"sent\", err == nil),\n\t\t\t)\n\t\t\tchildSpan.Finish()\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn classrooms[fl.chunkSize*i:]\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m httpPostMetrics) Collect(metrics chan<- prometheus.Metric) {\n\tm.totalTime.Collect(metrics)\n\tm.firstProgressPacket.Collect(metrics)\n\tm.firstPackPacket.Collect(metrics)\n\tm.packBytes.Collect(metrics)\n}", "func (m *ClientMetrics) Collect(ch chan<- prometheus.Metric) {\n\tm.clientHandledSummary.Collect(ch)\n}", "func (m *MeterImpl) CollectAsync(labels []attribute.KeyValue, obs ...sdkapi.Observation) {\n\tmm := make([]Measurement, len(obs))\n\tfor i := 0; i < len(obs); i++ {\n\t\to := obs[i]\n\t\tmm[i] = Measurement{\n\t\t\tInstrument: o.AsyncImpl(),\n\t\t\tNumber: o.Number(),\n\t\t}\n\t}\n\tm.collect(context.Background(), labels, mm)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\n\tfor _, vec := range e.gauges {\n\t\tvec.Reset()\n\t}\n\n\tdefer func() { ch <- e.up }()\n\n\t// If we fail at any point in retrieving GPU status, we fail 0\n\te.up.Set(1)\n\n\te.GetTelemetryFromNVML()\n\n\tfor _, vec := range e.gauges {\n\t\tvec.Collect(ch)\n\t}\n}", "func (p *statefulSyncInstrument[N, Storage, Methods]) Collect(seq data.Sequence, output *[]data.Instrument) {\n\tp.instLock.Lock()\n\tdefer p.instLock.Unlock()\n\n\tioutput := p.appendInstrument(output)\n\n\tfor set, entry := range p.data {\n\t\tp.appendPoint(ioutput, set, &entry.storage, aggregation.CumulativeTemporality, seq.Start, seq.Now, false)\n\t}\n}", "func (c *transportNodeCollector) Collect(ch chan<- prometheus.Metric) {\n\ttransportNodeMetrics := c.generateTransportNodeMetrics()\n\tfor _, metric := range transportNodeMetrics {\n\t\tch <- metric\n\t}\n}", "func (m *Monitoring) collect() {\n\tfor {\n\t\tevents, ok := <-m.ch\n\t\tif !ok {\n\t\t\tlog.Printf(\"event channel is closed\")\n\t\t\treturn\n\t\t}\n\n\t\tif err := m.w.Write(context.Background(), events); err != nil {\n\t\t\tlog.Printf(\"failed to write metric events %+v: %v\", events, err)\n\t\t}\n\t}\n\n}", "func (o *observer) Collect(ch chan<- prometheus.Metric) {\n\to.updateError.Collect(ch)\n\to.verifyError.Collect(ch)\n\to.expiration.Collect(ch)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\te.zpool.getStatus()\n\te.poolUsage.Set(float64(e.zpool.capacity))\n\te.providersOnline.Set(float64(e.zpool.online))\n\te.providersFaulted.Set(float64(e.zpool.faulted))\n\n\tch <- e.poolUsage\n\tch <- e.providersOnline\n\tch <- e.providersFaulted\n}", "func (c *Collector) Collect(ch chan<- prometheus.Metric) {\n\tsess, err := sessions.CreateAWSSession()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\t// Init WaitGroup. Without a WaitGroup the channel we write\n\t// results to will close before the goroutines finish\n\tvar wg sync.WaitGroup\n\twg.Add(len(c.Scrapers))\n\n\t// Iterate through all scrapers and invoke the scrape\n\tfor _, scraper := range c.Scrapers {\n\t\t// Wrape the scrape invocation in a goroutine, but we need to pass\n\t\t// the scraper into the function explicitly to re-scope the variable\n\t\t// the goroutine accesses. If we don't do this, we can sometimes hit\n\t\t// a case where the scraper reports results twice and the collector panics\n\t\tgo func(scraper *Scraper) {\n\t\t\t// Done call deferred until end of the scrape\n\t\t\tdefer wg.Done()\n\n\t\t\tlog.Debugf(\"Running scrape: %s\", scraper.ID)\n\t\t\tscrapeResults := scraper.Scrape(sess)\n\n\t\t\t// Iterate through scrape results and send the metric\n\t\t\tfor key, results := range scrapeResults {\n\t\t\t\tfor _, result := range results {\n\t\t\t\t\tch <- prometheus.MustNewConstMetric(scraper.Metrics[key].metric, result.Type, result.Value, result.Labels...)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Debugf(\"Scrape completed: %s\", scraper.ID)\n\t\t}(scraper)\n\t}\n\t// Wait\n\twg.Wait()\n}", "func (m *Client) Collect(ch chan<- prometheus.Metric) {\n\tm.storeMu.Lock()\n\tdefer m.storeMu.Unlock()\n\n\tch <- prometheus.MustNewConstMetric(m.storeValuesDesc, prometheus.GaugeValue, float64(len(m.store)))\n\n\tfor k, v := range m.store {\n\t\tch <- prometheus.MustNewConstMetric(m.storeSizesDesc, prometheus.GaugeValue, float64(len(v.value)), k)\n\t}\n}", "func (c *NetSocket) Collect(ctx context.Context) error {\n\tmetrics := cgm.Metrics{}\n\n\tc.Lock()\n\n\tif c.runTTL > time.Duration(0) {\n\t\tif time.Since(c.lastEnd) < c.runTTL {\n\t\t\tc.logger.Warn().Msg(collector.ErrTTLNotExpired.Error())\n\t\t\tc.Unlock()\n\t\t\treturn collector.ErrTTLNotExpired\n\t\t}\n\t}\n\tif c.running {\n\t\tc.logger.Warn().Msg(collector.ErrAlreadyRunning.Error())\n\t\tc.Unlock()\n\t\treturn collector.ErrAlreadyRunning\n\t}\n\n\tc.running = true\n\tc.lastStart = time.Now()\n\tc.Unlock()\n\n\tif err := c.sockstatCollect(ctx, &metrics); err != nil {\n\t\tc.logger.Warn().Err(err).Msg(\"sockstat\")\n\t}\n\n\tc.setStatus(metrics, nil)\n\treturn nil\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tok := e.collectPeersMetric(ch)\n\tok = e.collectLeaderMetric(ch) && ok\n\tok = e.collectNodesMetric(ch) && ok\n\tok = e.collectMembersMetric(ch) && ok\n\tok = e.collectMembersWanMetric(ch) && ok\n\tok = e.collectServicesMetric(ch) && ok\n\tok = e.collectHealthStateMetric(ch) && ok\n\tok = e.collectKeyValues(ch) && ok\n\n\tif ok {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tup, prometheus.GaugeValue, 1.0,\n\t\t)\n\t} else {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tup, prometheus.GaugeValue, 0.0,\n\t\t)\n\t}\n}", "func (s *Streams) Collect() []interface{} {\n\tdata, ok := s.Buffer.Obj().([]interface{})\n\n\tif !ok {\n\t\treturn nil\n\t}\n\n\ts.Buffer.Clear()\n\treturn data\n}", "func (c *TeamsCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tteams := getTotalTeams()\n\n\tch <- prometheus.MustNewConstMetric(\n\t\tc.totalTeamsGaugeDesc,\n\t\tprometheus.GaugeValue,\n\t\tfloat64(teams),\n\t)\n}", "func coveringFromSpans(spans []roachpb.Span, payload interface{}) intervalccl.Covering {\n\tvar covering intervalccl.Covering\n\tfor _, span := range spans {\n\t\tcovering = append(covering, intervalccl.Range{\n\t\t\tStart: []byte(span.Key),\n\t\t\tEnd: []byte(span.EndKey),\n\t\t\tPayload: payload,\n\t\t})\n\t}\n\treturn covering\n}", "func (c *SecurityGroupCollector) Collect(ch chan<- prometheus.Metric) {\n\tfor _, zone := range affectedZones(c.client) {\n\t\tnow := time.Now()\n\t\tresp, err := c.instance.ListSecurityGroups(&instance.ListSecurityGroupsRequest{\n\t\t\tZone: zone,\n\t\t\tOrganization: c.org,\n\t\t\tProject: c.project,\n\t\t}, scw.WithAllPages())\n\t\tc.duration.WithLabelValues(\"security_group\").Observe(time.Since(now).Seconds())\n\n\t\tif err != nil {\n\t\t\tlevel.Error(c.logger).Log(\n\t\t\t\t\"msg\", \"Failed to fetch security groups\",\n\t\t\t\t\"zone\", zone,\n\t\t\t\t\"err\", err,\n\t\t\t)\n\n\t\t\tc.failures.WithLabelValues(\"security_group\").Inc()\n\t\t\treturn\n\t\t}\n\n\t\tlevel.Debug(c.logger).Log(\n\t\t\t\"msg\", \"Fetched security groups\",\n\t\t\t\"zone\", zone,\n\t\t\t\"count\", resp.TotalCount,\n\t\t)\n\n\t\tfor _, securityGroup := range resp.SecurityGroups {\n\t\t\tvar (\n\t\t\t\tenableDefault float64\n\t\t\t\tprojectDefault float64\n\t\t\t\tstateful float64\n\t\t\t\tinboundDefault float64\n\t\t\t\toutboundDefault float64\n\t\t\t)\n\n\t\t\tlabels := []string{\n\t\t\t\tsecurityGroup.ID,\n\t\t\t\tsecurityGroup.Name,\n\t\t\t\tsecurityGroup.Zone.String(),\n\t\t\t\tsecurityGroup.Organization,\n\t\t\t\tsecurityGroup.Project,\n\t\t\t}\n\n\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\tc.Defined,\n\t\t\t\tprometheus.GaugeValue,\n\t\t\t\t1.0,\n\t\t\t\tlabels...,\n\t\t\t)\n\n\t\t\tif securityGroup.EnableDefaultSecurity {\n\t\t\t\tenableDefault = 1.0\n\t\t\t}\n\n\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\tc.EnableDefault,\n\t\t\t\tprometheus.GaugeValue,\n\t\t\t\tenableDefault,\n\t\t\t\tlabels...,\n\t\t\t)\n\n\t\t\tif securityGroup.ProjectDefault {\n\t\t\t\tprojectDefault = 1.0\n\t\t\t}\n\n\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\tc.ProjectDefault,\n\t\t\t\tprometheus.GaugeValue,\n\t\t\t\tprojectDefault,\n\t\t\t\tlabels...,\n\t\t\t)\n\n\t\t\tif securityGroup.Stateful {\n\t\t\t\tstateful = 1.0\n\t\t\t}\n\n\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\tc.Stateful,\n\t\t\t\tprometheus.GaugeValue,\n\t\t\t\tstateful,\n\t\t\t\tlabels...,\n\t\t\t)\n\n\t\t\tswitch val := securityGroup.InboundDefaultPolicy; val {\n\t\t\tcase instance.SecurityGroupPolicyAccept:\n\t\t\t\tinboundDefault = 1.0\n\t\t\tcase instance.SecurityGroupPolicyDrop:\n\t\t\t\tinboundDefault = 0.0\n\t\t\tdefault:\n\t\t\t\tinboundDefault = 0.0\n\t\t\t}\n\n\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\tc.InboundDefault,\n\t\t\t\tprometheus.GaugeValue,\n\t\t\t\tinboundDefault,\n\t\t\t\tlabels...,\n\t\t\t)\n\n\t\t\tswitch val := securityGroup.OutboundDefaultPolicy; val {\n\t\t\tcase instance.SecurityGroupPolicyAccept:\n\t\t\t\toutboundDefault = 1.0\n\t\t\tcase instance.SecurityGroupPolicyDrop:\n\t\t\t\toutboundDefault = 0.0\n\t\t\tdefault:\n\t\t\t\toutboundDefault = 0.0\n\t\t\t}\n\n\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\tc.OutboundDefault,\n\t\t\t\tprometheus.GaugeValue,\n\t\t\t\toutboundDefault,\n\t\t\t\tlabels...,\n\t\t\t)\n\n\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\tc.Servers,\n\t\t\t\tprometheus.GaugeValue,\n\t\t\t\tfloat64(len(securityGroup.Servers)),\n\t\t\t\tlabels...,\n\t\t\t)\n\n\t\t\tif securityGroup.CreationDate != nil {\n\t\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\t\tc.Created,\n\t\t\t\t\tprometheus.GaugeValue,\n\t\t\t\t\tfloat64(securityGroup.CreationDate.Unix()),\n\t\t\t\t\tlabels...,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif securityGroup.ModificationDate != nil {\n\t\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\t\tc.Modified,\n\t\t\t\t\tprometheus.GaugeValue,\n\t\t\t\t\tfloat64(securityGroup.ModificationDate.Unix()),\n\t\t\t\t\tlabels...,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}", "func (pr *PeriodicReader) collect(ctx context.Context, method func(context.Context, data.Metrics) error) error {\n\tpr.lock.Lock()\n\tdefer pr.lock.Unlock()\n\n\t// The lock ensures that re-use of `pr.data` is successful, it\n\t// means that shutdown, flush, and ordinary collection are\n\t// exclusive. Note that shutdown will cancel a concurrent\n\t// (ordinary) export, while flush will wait for a concurrent\n\t// export.\n\tpr.data = pr.producer.Produce(&pr.data)\n\n\treturn method(ctx, pr.data)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tvar (\n\t\tdata *Data\n\t\terr error\n\t)\n\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\te.resetGaugeVecs() // Clean starting point\n\n\tvar endpointOfAPI []string\n\tif strings.HasSuffix(rancherURL, \"v3\") || strings.HasSuffix(rancherURL, \"v3/\") {\n\t\tendpointOfAPI = endpointsV3\n\t} else {\n\t\tendpointOfAPI = endpoints\n\t}\n\n\tcacheExpired := e.IsCacheExpired()\n\n\t// Range over the pre-configured endpoints array\n\tfor _, p := range endpointOfAPI {\n\t\tif cacheExpired {\n\t\t\tdata, err = e.gatherData(e.rancherURL, e.resourceLimit, e.accessKey, e.secretKey, p, ch)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error getting JSON from URL %s\", p)\n\t\t\t\treturn\n\t\t\t}\n\t\t\te.cache[p] = data\n\t\t} else {\n\t\t\td, ok := e.cache[p]\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdata = d\n\t\t}\n\n\t\tif err := e.processMetrics(data, p, e.hideSys, ch); err != nil {\n\t\t\tlog.Errorf(\"Error scraping rancher url: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"Metrics successfully processed for %s\", p)\n\t}\n\n\tif cacheExpired {\n\t\te.RenewCache()\n\t}\n\n\tfor _, m := range e.gaugeVecs {\n\t\tm.Collect(ch)\n\t}\n}", "func (c *DebugFsStatCollector) Collect(ch chan<- prometheus.Metric) {\n\tc.updateProbeStats(0, \"kprobe\", ch)\n\tc.updateProbeStats(0, \"uprobe\", ch)\n}", "func newCollectPacket(s SpanID, as Annotations) *wire.CollectPacket {\n\treturn &wire.CollectPacket{\n\t\tSpanid: s.wire(),\n\t\tAnnotation: as.wire(),\n\t}\n}", "func (c *solarCollector) Collect(ch chan<- prometheus.Metric) {\n\tc.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer c.mutex.Unlock()\n\tif err := c.collect(ch); err != nil {\n\t\tlog.Printf(\"Error getting solar controller data: %s\", err)\n\t\tc.scrapeFailures.Inc()\n\t\tc.scrapeFailures.Collect(ch)\n\t}\n\treturn\n}", "func (ulw *Wrapper) Collect() {\n\tulw.ul.Collect()\n\tsort.Sort(byTotalTime(ulw.ul.Results))\n}", "func (collector *collector) Collect(ch chan<- prometheus.Metric) {\n\tcontainerNames, err := collector.server.GetContainerNames()\n\tif err != nil {\n\t\tcollector.logger.Printf(\"Can't query container names: %s\", err)\n\t\treturn\n\t}\n\n\tfor _, containerName := range containerNames {\n\t\tstate, _, err := collector.server.GetContainerState(containerName)\n\t\tif err != nil {\n\t\t\tcollector.logger.Printf(\n\t\t\t\t\"Can't query container state for `%s`: %s\", containerName, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tcollector.collectContainerMetrics(ch, containerName, state)\n\t}\n}", "func (*noOpConntracker) Collect(ch chan<- prometheus.Metric) {}", "func (c *Collector) Collect(ch chan<- prometheus.Metric) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tc.totalScrapes.Inc()\n\terr := c.getDadataBalance()\n\tif err != nil {\n\t\tc.failedBalanceScrapes.Inc()\n\t}\n\terr = c.getDadataStats()\n\tif err != nil {\n\t\tc.failedStatsScrapes.Inc()\n\t}\n\n\tch <- c.totalScrapes\n\tch <- c.failedBalanceScrapes\n\tch <- c.failedStatsScrapes\n\tch <- c.CurrentBalance\n\tch <- c.ServicesClean\n\tch <- c.ServicesMerging\n\tch <- c.ServicesSuggestions\n}", "func (c *SchedulerController) CollectMetrics(ch chan<- prometheus.Metric) {\n\tmetric, err := prometheus.NewConstMetric(scheduler.ControllerWorkerSum, prometheus.GaugeValue, float64(c.RunningWorkers()), \"seed\")\n\tif err != nil {\n\t\tscheduler.ScrapeFailures.With(prometheus.Labels{\"kind\": \"gardener-shoot-scheduler\"}).Inc()\n\t\treturn\n\t}\n\tch <- metric\n}", "func (b Blackbox) Collect(metrics chan<- prometheus.Metric) {\n\tb.fetchReferenceDiscoveryMetrics.Collect(metrics)\n\tb.httpPostMetrics.Collect(metrics)\n\tb.wantedRefs.Collect(metrics)\n}", "func (c *StorageDomainCollector) Collect(ch chan<- prometheus.Metric) {\n\tctx, span := c.cc.Tracer().Start(c.rootCtx, \"StorageDomainCollector.Collect\")\n\tdefer span.End()\n\n\tc.cc.SetMetricsCh(ch)\n\n\ttimer := prometheus.NewTimer(c.collectDuration)\n\tdefer timer.ObserveDuration()\n\n\ts := StorageDomains{}\n\terr := c.cc.Client().GetAndParse(ctx, \"storagedomains\", &s)\n\tif err != nil {\n\t\tc.cc.HandleError(err, span)\n\t\treturn\n\t}\n\n\tfor _, h := range s.Domains {\n\t\tc.collectMetricsForDomain(h)\n\t}\n}", "func (sc *SlurmCollector) Collect(ch chan<- prometheus.Metric) {\n\tsc.mutex.Lock()\n\tdefer sc.mutex.Unlock()\n\n\tlog.Debugf(\"Time since last scrape: %f seconds\", time.Since(sc.lastScrape).Seconds())\n\tif time.Since(sc.lastScrape).Seconds() > float64(sc.scrapeInterval) {\n\t\tsc.updateDynamicJobIds()\n\t\tvar err error\n\t\tsc.sshClient, err = sc.sshConfig.NewClient()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Creating SSH client: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tdefer sc.sshClient.Close()\n\t\tlog.Infof(\"Collecting metrics from Slurm...\")\n\t\tsc.trackedJobs = make(map[string]bool)\n\t\tif sc.targetJobIds == \"\" {\n\t\t\t// sc.collectQueue()\n\t\t} else {\n\t\t\tsc.collectAcct()\n\t\t}\n\t\tif !sc.skipInfra {\n\t\t\tsc.collectInfo()\n\t\t}\n\t\tsc.lastScrape = time.Now()\n\t\tsc.delJobs()\n\n\t}\n\n\tsc.updateMetrics(ch)\n}", "func (c *ClusterManager) Collect(ch chan<- prometheus.Metric) {\n\toomCountByHost, ramUsageByHost := c.ReallyExpensiveAssessmentOfTheSystemState()\n\tfor host, oomCount := range oomCountByHost {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.OOMCountDesc,\n\t\t\tprometheus.CounterValue,\n\t\t\tfloat64(oomCount),\n\t\t\thost,\n\t\t)\n\t}\n\tfor host, ramUsage := range ramUsageByHost {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.RAMUsageDesc,\n\t\t\tprometheus.GaugeValue,\n\t\t\tramUsage,\n\t\t\thost,\n\t\t)\n\t}\n}", "func (c *DiskCache) Collect(metrics chan<- prometheus.Metric) {\n\tc.requestTotals.Collect(metrics)\n\tc.missTotals.Collect(metrics)\n\tc.bytesStoredtotals.Collect(metrics)\n\tc.bytesFetchedtotals.Collect(metrics)\n\tc.bytesLoserTotals.Collect(metrics)\n\tc.errTotal.Collect(metrics)\n\tc.walkerRemovalTotal.Collect(metrics)\n\tc.walkerErrorTotal.Collect(metrics)\n\tc.walkerEmptyDirTotal.Collect(metrics)\n\tc.walkerEmptyDirRemovalTotal.Collect(metrics)\n}", "func (e *Route53Exporter) CollectLoop() {\n\tclient := awsclient.NewClientFromSession(e.sess)\n\n\tfor {\n\t\tctx, ctxCancelFunc := context.WithTimeout(context.Background(), e.timeout)\n\t\te.Cancel = ctxCancelFunc\n\t\tlevel.Info(e.logger).Log(\"msg\", \"Updating Route53 metrics...\")\n\n\t\thostedZones, err := getAllHostedZones(client, ctx, e.logger)\n\n\t\tlevel.Info(e.logger).Log(\"msg\", \"Got all zones\")\n\t\tif err != nil {\n\t\t\tlevel.Error(e.logger).Log(\"msg\", \"Could not retrieve the list of hosted zones\", \"error\", err.Error())\n\t\t\tawsclient.AwsExporterMetrics.IncrementErrors()\n\t\t}\n\n\t\terr = e.getHostedZonesPerAccountMetrics(client, hostedZones, ctx)\n\t\tif err != nil {\n\t\t\tlevel.Error(e.logger).Log(\"msg\", \"Could not get limits for hosted zone\", \"error\", err.Error())\n\t\t\tawsclient.AwsExporterMetrics.IncrementErrors()\n\t\t}\n\n\t\terrs := e.getRecordsPerHostedZoneMetrics(client, hostedZones, ctx)\n\t\tfor _, err = range errs {\n\t\t\tlevel.Error(e.logger).Log(\"msg\", \"Could not get limits for hosted zone\", \"error\", err.Error())\n\t\t\tawsclient.AwsExporterMetrics.IncrementErrors()\n\t\t}\n\n\t\tlevel.Info(e.logger).Log(\"msg\", \"Route53 metrics Updated\")\n\n\t\tctxCancelFunc() // should never do anything as we don't run stuff in the background\n\n\t\ttime.Sleep(e.interval)\n\t}\n}", "func (c *Client) Collect(ch chan<- prometheus.Metric) {\n\tc.metrics.functionInvocation.Collect(ch)\n\tc.metrics.functionsHistogram.Collect(ch)\n\tc.metrics.queueHistogram.Collect(ch)\n\tc.metrics.functionInvocationStarted.Collect(ch)\n\tc.metrics.serviceReplicasGauge.Reset()\n\tfor _, service := range c.services {\n\t\tvar serviceName string\n\t\tif len(service.Namespace) > 0 {\n\t\t\tserviceName = fmt.Sprintf(\"%s.%s\", service.Name, service.Namespace)\n\t\t} else {\n\t\t\tserviceName = service.Name\n\t\t}\n\t\tc.metrics.serviceReplicasGauge.\n\t\t\tWithLabelValues(serviceName).\n\t\t\tSet(float64(service.Replicas))\n\t}\n\tc.metrics.serviceReplicasGauge.Collect(ch)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\n\te.scrape()\n\n\te.up.Collect(ch)\n\te.totalScrapes.Collect(ch)\n\te.exchangeStatus.Collect(ch)\n\te.ltp.Collect(ch)\n\te.bestBid.Collect(ch)\n\te.bestAsk.Collect(ch)\n\te.bestBidSize.Collect(ch)\n\te.bestAskSize.Collect(ch)\n\te.totalBidDepth.Collect(ch)\n\te.totalAskDepth.Collect(ch)\n\te.volume.Collect(ch)\n\te.volumeByProduct.Collect(ch)\n}", "func (o *OSDCollector) Collect(ch chan<- prometheus.Metric) {\n\tif err := o.collectOSDPerf(); err != nil {\n\t\tlog.Println(\"failed collecting osd perf stats:\", err)\n\t}\n\n\tif err := o.collectOSDDump(); err != nil {\n\t\tlog.Println(\"failed collecting osd dump:\", err)\n\t}\n\n\tif err := o.collectOSDDF(); err != nil {\n\t\tlog.Println(\"failed collecting osd metrics:\", err)\n\t}\n\n\tif err := o.collectOSDTreeDown(ch); err != nil {\n\t\tlog.Println(\"failed collecting osd metrics:\", err)\n\t}\n\n\tfor _, metric := range o.collectorList() {\n\t\tmetric.Collect(ch)\n\t}\n\n\tif err := o.collectOSDScrubState(ch); err != nil {\n\t\tlog.Println(\"failed collecting osd scrub state:\", err)\n\t}\n}", "func (c *MetricsCollector) Collect(ch chan<- prometheus.Metric) {\n\tfor _, s := range c.status {\n\t\ts.RLock()\n\t\tdefer s.RUnlock()\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.verify,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(s.VerifyRestore),\n\t\t\t\"verify_restore\",\n\t\t\ts.BackupService,\n\t\t\ts.StorageService,\n\t\t)\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.verify,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(s.VerifyDiff),\n\t\t\t\"verify_diff\",\n\t\t\ts.BackupService,\n\t\t\ts.StorageService,\n\t\t)\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.verify,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(s.VerifyChecksum),\n\t\t\t\"verify_checksum\",\n\t\t\ts.BackupService,\n\t\t\ts.StorageService,\n\t\t)\n\t}\n\n}" ]
[ "0.6309139", "0.62056905", "0.59496146", "0.5861292", "0.58595854", "0.5749108", "0.5731653", "0.57281625", "0.56668395", "0.5666777", "0.5659342", "0.5649344", "0.55813223", "0.55552435", "0.55202997", "0.55081296", "0.54767895", "0.54767895", "0.54666686", "0.545717", "0.5450747", "0.54505527", "0.544508", "0.5440054", "0.5439095", "0.5422174", "0.53877944", "0.5386716", "0.53777814", "0.53743565", "0.53377837", "0.53343785", "0.5320144", "0.5298158", "0.52956486", "0.52869594", "0.5279735", "0.52791387", "0.52758926", "0.52631927", "0.5262825", "0.52571845", "0.52527297", "0.5251159", "0.5246382", "0.5242903", "0.52254933", "0.52246296", "0.52175575", "0.5197544", "0.5189173", "0.5188942", "0.51804596", "0.51629144", "0.5159724", "0.51348174", "0.5119232", "0.5117924", "0.51175076", "0.5112991", "0.5110002", "0.5108095", "0.51069033", "0.5102488", "0.5080886", "0.5054106", "0.5051215", "0.50400865", "0.503956", "0.50385106", "0.50333095", "0.50085443", "0.500604", "0.5005395", "0.5001058", "0.4979235", "0.49773383", "0.49750885", "0.49744478", "0.49652916", "0.49633992", "0.4960799", "0.4959177", "0.4948116", "0.49430653", "0.49333423", "0.49192643", "0.4918806", "0.49164122", "0.49072838", "0.4902036", "0.4894147", "0.48747724", "0.48743692", "0.48741183", "0.48666382", "0.485854", "0.48560983", "0.48530197", "0.48430637" ]
0.7222805
0
Flush immediately sends all pending spans to the underlying collector.
func (cc *ChunkedCollector) Flush() error { cc.mu.Lock() pendingBySpanID := cc.pendingBySpanID pending := cc.pending cc.pendingBySpanID = nil cc.pending = nil cc.mu.Unlock() var errs []error for _, spanID := range pending { p := pendingBySpanID[spanID] if err := cc.Collector.Collect(spanIDFromWire(p.Spanid), annotationsFromWire(p.Annotation)...); err != nil { errs = append(errs, err) } } if len(errs) == 1 { return errs[0] } else if len(errs) > 1 { return fmt.Errorf("ChunkedCollector: multiple errors: %v", errs) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Collector) Flush() error {\n\treturn s.flusher.Flush(s.stats)\n}", "func (c *HTTPCollector) flush(b []*zipkincore.Span) (err error) {\n\tdefer func() {\n\t\tc.batchPool.Put(b[:0])\n\t\tif err != nil {\n\t\t\tc.logger.Log(\"err\", err)\n\t\t}\n\t}()\n\n\t// Do not send an empty batch\n\tif len(b) == 0 {\n\t\treturn nil\n\t}\n\n\tdata, err := httpSerialize(b)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar req *http.Request\n\n\treq, err = http.NewRequest(\"POST\", c.url, data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/x-thrift\")\n\tif _, err = c.client.Do(req); err != nil {\n\t\treturn\n\t}\n\n\treturn nil\n}", "func (c *Collector) Flush() {\n\tclose(c.results)\n\t<-c.done\n}", "func (c *Stats) Flush() {\n\t// Add a job to the flush wait group\n\tc.flushWG.Add(1)\n\tc.jobs <- &job{flush: true}\n\tc.flushWG.Wait()\n}", "func (w *batchWriter) Flush(ctx context.Context) error {\n\tfor i, s := range w.batch {\n\t\t_, err := fmt.Fprintln(w.writer, s)\n\t\tif err != nil {\n\t\t\tw.batch = w.batch[i:]\n\t\t\tw.persistRecords = w.persistRecords[i:]\n\t\t\treturn err\n\t\t}\n\t\tw.flushed = w.persistRecords[i]\n\t}\n\tw.batch = make([]string, 0, batchSize)\n\tw.persistRecords = make([]*persistRecord, 0, batchSize)\n\treturn nil\n}", "func Flush() {\n\tif t, ok := internal.GetGlobalTracer().(*tracer); ok {\n\t\tt.flushSync()\n\t}\n}", "func (e *Exporter) Flush() {\n\te.tracer.Flush(context.Background())\n}", "func (f *flusher) Flush() {\n\tf.mu.Lock()\n\tfor _, m := range f.meters {\n\t\tm.FlushReading(f.sink)\n\t}\n\tf.sink.Flush()\n\tf.mu.Unlock()\n}", "func Flush() {\n\tif traceListeners != nil {\n\t\tfor _, tl := range traceListeners {\n\t\t\t(*tl).Flush()\n\t\t}\n\t}\n}", "func (fl *flusher) Flush(ctx context.Context, span opentracing.Span, classrooms []models.Classroom) []models.Classroom {\n\n\tchunks, err := utils.SplitSlice(classrooms, fl.chunkSize)\n\n\tif err != nil {\n\t\treturn classrooms\n\t}\n\n\tfor i, chunk := range chunks {\n\n\t\tvar childSpan opentracing.Span\n\t\tif span != nil {\n\t\t\tchildSpan = opentracing.StartSpan(\"Flush\", opentracing.ChildOf(span.Context()))\n\t\t}\n\n\t\t_, err := fl.repo.MultiAddClassroom(ctx, chunk)\n\n\t\tif span != nil {\n\n\t\t\tchildSpan.LogFields(\n\t\t\t\tlog.Int(\"len\", len(chunk)),\n\t\t\t\tlog.Bool(\"sent\", err == nil),\n\t\t\t)\n\t\t\tchildSpan.Finish()\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn classrooms[fl.chunkSize*i:]\n\t\t}\n\t}\n\n\treturn nil\n}", "func (buf *Buffer) Flush(now time.Time) {\n\tbatch := buf.currentBatch\n\tif batch == nil {\n\t\treturn\n\t}\n\n\tbatch.nextSend = now // immediately make available to send\n\tbuf.unleased.PushBatch(batch)\n\tbuf.batchItemsGuess.record(batch.countedItems)\n\tbuf.currentBatch = nil\n\treturn\n}", "func (c *Client) flush() {\n\tsubmissions := make([]*Request, 0, len(c.requests)+1)\n\tif c.newMetrics {\n\t\tc.newMetrics = false\n\t\tr := c.newRequest(RequestTypeGenerateMetrics)\n\t\tpayload := &Metrics{\n\t\t\tNamespace: c.Namespace,\n\t\t\tLibLanguage: \"go\",\n\t\t\tLibVersion: version.Tag,\n\t\t}\n\t\tfor _, m := range c.metrics {\n\t\t\ts := Series{\n\t\t\t\tMetric: m.name,\n\t\t\t\tType: string(m.kind),\n\t\t\t\tTags: m.tags,\n\t\t\t\tCommon: m.common,\n\t\t\t}\n\t\t\ts.Points = [][2]float64{{m.ts, m.value}}\n\t\t\tpayload.Series = append(payload.Series, s)\n\t\t}\n\t\tr.Payload = payload\n\t\tsubmissions = append(submissions, r)\n\t}\n\n\t// copy over requests so we can do the actual submission without holding\n\t// the lock. Zero out the old stuff so we don't leak references\n\tfor i, r := range c.requests {\n\t\tsubmissions = append(submissions, r)\n\t\tc.requests[i] = nil\n\t}\n\tc.requests = c.requests[:0]\n\n\tgo func() {\n\t\tfor _, r := range submissions {\n\t\t\terr := c.submit(r)\n\t\t\tif err != nil {\n\t\t\t\tc.log(\"telemetry submission failed: %s\", err)\n\t\t\t}\n\t\t}\n\t}()\n}", "func (b *Buffer) Flush() {\n\tif len(b.series) == 0 {\n\t\treturn\n\t}\n\n\tsbuffer := []*influxdb.Series{}\n\tfor _, item := range b.series {\n\t\tsbuffer = append(sbuffer, item)\n\t}\n\n\tb.fn(sbuffer)\n\tb.Clear()\n}", "func (clt *Client) flush() {\n\tif !clt.timer.Stop() {\n\t\tselect {\n\t\tcase <-clt.timer.C:\n\t\tdefault:\n\t\t}\n\t}\n\tclt.timer.Reset(recordsTimeout)\n\n\t// Don't send empty batch\n\tif len(clt.batch) == 0 {\n\t\treturn\n\t}\n\n\tclt.putRecordBatch()\n\n\tclt.batchSize = 0\n\tclt.batch = nil\n}", "func (t *tracer) flushSync() {\n\tdone := make(chan struct{})\n\tt.flush <- done\n\t<-done\n}", "func (b *Basic) flush(done chan<- struct{}) {\n\tfor {\n\t\tvar rec *LogRec\n\t\tvar err error\n\t\tselect {\n\t\tcase rec = <-b.in:\n\t\t\t// ignore any redundant flush records.\n\t\t\tif rec.flush == nil {\n\t\t\t\terr = b.w.Write(rec)\n\t\t\t\tif err != nil {\n\t\t\t\t\tb.incErrorCounter()\n\t\t\t\t\trec.Logger().Logr().ReportError(err)\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tdone <- struct{}{}\n\t\t\treturn\n\t\t}\n\t}\n}", "func (lms *MessageSorter) Flush() {\n\tsort.Sort(ktail.ByTimestamp(lms.cache))\n\n\tfor _, msg := range lms.cache {\n\t\tlms.format(lms.wr, msg)\n\t}\n\n\tlms.cache = []*ktail.LogMessage{}\n\tlms.current = 0\n}", "func (e *eventDebouncer) flush() {\n\tif len(e.events) == 0 {\n\t\treturn\n\t}\n\n\t// if the flush interval is faster than the callback then we will end up calling\n\t// the callback multiple times, probably a bad idea. In this case we could drop\n\t// frames?\n\tgo e.callback(e.events)\n\te.events = make([]frame, 0, eventBufferSize)\n}", "func (b *FlushingBatch) Flush() error {\n\terr := b.index.Batch(b.batch)\n\tif err != nil {\n\t\treturn err\n\t}\n\tb.batch = b.index.NewBatch()\n\treturn nil\n}", "func (q *Queue) Flush() {\r\n\tel, _ := q.clear()\r\n\r\n\tfor el != nil {\r\n\t\tq.cb(el.v)\r\n\t\tel = el.next\r\n\t}\r\n}", "func (self *averageCache) flush(flushLimit int) {\n\tlog.WithFields(log.Fields{\n\t\t\"cache\": self.name,\n\t}).Debug(\"Internal Flush\")\n\tvar valueFlushTargets []*whisper.TimeSeriesPoint = make([]*whisper.TimeSeriesPoint, 0)\n\tvar countFlushTargets []*whisper.TimeSeriesPoint = make([]*whisper.TimeSeriesPoint, 0)\n\tfor timeSlot, cacheSlot := range self.cache {\n\t\t// TODO: \n\t\t// Write all changes to subscriptions\n\t\tif cacheSlot.LastUpdated <= flushLimit {\n\t\t\tvalueFlushTargets = append(valueFlushTargets, &whisper.TimeSeriesPoint{timeSlot, cacheSlot.Value})\n\t\t\tcountFlushTargets = append(countFlushTargets, &whisper.TimeSeriesPoint{timeSlot, cacheSlot.Count})\n\t\t\tdelete(self.cache, timeSlot)\n\t\t}\n\t}\n\tlog.Debug(\"FlushAverages: \", valueFlushTargets)\n\tlog.Debug(\"FlushCounts: \", countFlushTargets)\n\n\t// TODO: Write flush targets to whisper\n\t// In another fiber perhaps to make this non-blocking?\n\tself.valueBackend.Write(valueFlushTargets)\n\tself.countBackend.Write(countFlushTargets)\n}", "func (s *Spooler) flush() {\n\tif len(s.spool) > 0 {\n\t\t// copy buffer\n\t\ttmpCopy := make([]*input.FileEvent, len(s.spool))\n\t\tcopy(tmpCopy, s.spool)\n\n\t\t// clear buffer\n\t\ts.spool = s.spool[:0]\n\n\t\t// send\n\t\ts.publisher <- tmpCopy\n\t}\n\ts.nextFlushTime = time.Now().Add(s.idleTimeout)\n}", "func (clt *Client) flush() {\n\n\tif !clt.t.Stop() {\n\t\tselect {\n\t\tcase <-clt.t.C:\n\t\tdefault:\n\t\t}\n\t}\n\tclt.t.Reset(recordsTimeout)\n\n\tsize := len(clt.batch)\n\t// Don't send empty batch\n\tif size == 0 {\n\t\treturn\n\t}\n\n\t// Create slice with the struct need by firehose\n\tfor _, b := range clt.batch {\n\t\tclt.records = append(clt.records, &firehose.Record{Data: b.B})\n\t}\n\n\t// Create the request\n\treq, _ := clt.srv.awsSvc.PutRecordBatchRequest(&firehose.PutRecordBatchInput{\n\t\tDeliveryStreamName: aws.String(clt.srv.cfg.StreamName),\n\t\tRecords: clt.records,\n\t})\n\n\t// Add context timeout to the request\n\tctx, cancel := context.WithTimeout(context.Background(), connectTimeout)\n\tdefer cancel()\n\n\treq.SetContext(ctx)\n\n\t// Send the request\n\terr := req.Send()\n\tif err != nil {\n\t\tif req.IsErrorThrottle() {\n\t\t\tlog.Printf(\"Firehose client %s [%d]: ERROR IsErrorThrottle: %s\", clt.srv.cfg.StreamName, clt.ID, err)\n\t\t} else {\n\t\t\tlog.Printf(\"Firehose client %s [%d]: ERROR PutRecordBatch->Send: %s\", clt.srv.cfg.StreamName, clt.ID, err)\n\t\t}\n\t\tclt.srv.failure()\n\n\t\t// Finish if is not critical stream\n\t\tif clt.srv.cfg.Critical {\n\t\t\tlog.Printf(\"Firehose client %s [%d]: ERROR Critical records lost, %d messages lost\", clt.srv.cfg.StreamName, clt.ID, size)\n\t\t}\n\t}\n\n\t// Put slice bytes in the pull after sent\n\tfor _, b := range clt.batch {\n\t\tpool.Put(b)\n\t}\n\n\tclt.batchSize = 0\n\tclt.count = 0\n\tclt.batch = nil\n\tclt.records = nil\n}", "func (sr *SpanRecorder) ForceFlush(context.Context) error {\n\treturn nil\n}", "func flushMetrics(flushChannel chan Metric, finishChannel chan int) {\n\n\tfor {\n\t\tselect {\n\t\tcase metric := <-flushChannel:\n\t\t\tsendMetricToStats(metric)\n\t\tcase <-finishChannel:\n\t\t\treturn\n\t\t}\n\t}\n}", "func (c Consumer) flush() {\n\tfor i := 0; i < MAX_NUM_WIDGETS; i++ {\n\t\t<- c.ch\n\t\tlog.Print(\"Consumer: Recieving from channel assigned to consumer: \", c.id)\n\t}\n}", "func (a *AppTracer) Flush() {\n\tfor _, cli := range a.ClientList {\n\t\tcli.Flush()\n\t}\n}", "func (c *Concentrator) Flush(force bool) *pb.StatsPayload {\n\treturn c.flushNow(time.Now().UnixNano(), force)\n}", "func (oq *outputQueue) flush() error {\n\tif oq.rowIdx <= 0 {\n\t\treturn nil\n\t}\n\tif oq.ep.needExportToFile() {\n\t\tif err := exportDataToCSVFile(oq); err != nil {\n\t\t\tlogError(oq.ses, oq.ses.GetDebugString(),\n\t\t\t\t\"Error occurred while exporting to CSV file\",\n\t\t\t\tzap.Error(err))\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t//send group of row\n\t\tif oq.showStmtType == ShowTableStatus {\n\t\t\toq.rowIdx = 0\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := oq.proto.SendResultSetTextBatchRowSpeedup(oq.mrs, oq.rowIdx); err != nil {\n\t\t\tlogError(oq.ses, oq.ses.GetDebugString(),\n\t\t\t\t\"Flush error\",\n\t\t\t\tzap.Error(err))\n\t\t\treturn err\n\t\t}\n\t}\n\toq.rowIdx = 0\n\treturn nil\n}", "func (i *queueIndex) flush() error {\n\treturn i.indexArena.Flush(syscall.MS_SYNC)\n}", "func (p *AutoCommitter) Flush() error {\n\tif p.verbose {\n\t\tlog.Info(fmt.Sprintf(\"AutoCommitter-%s(%s) a new flush is comming\", p.name, p.coll))\n\t}\n\tfor _, w := range p.workers {\n\t\tw.flushC <- struct{}{}\n\t\t<-w.flushAckC // wait for completion\n\t}\n\tif p.verbose {\n\t\tlog.Info(fmt.Sprintf(\"AutoCommitter-%s(%s) a new flush is finished\", p.name, p.coll))\n\t}\n\treturn nil\n}", "func (s *ServerlessTraceAgent) Flush() {\n\tif s.Get() != nil {\n\t\ts.ta.FlushSync()\n\t}\n}", "func (c *Client) Flush() error {\n\tif len(c.data) > 0 {\n\t\tc.logger.Infof(\"Pushing metrics: %d\", len(c.data))\n\n\t\tinput := &cloudwatch.PutMetricDataInput{\n\t\t\tNamespace: aws.String(c.namespace),\n\t\t\tMetricData: c.data,\n\t\t}\n\n\t\t_, err := c.svc.PutMetricData(input)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc.data = nil\n\t}\n\n\treturn nil\n}", "func (t *tracer) worker(tick <-chan time.Time) {\n\tfor {\n\t\tselect {\n\t\tcase trace := <-t.out:\n\t\t\tt.sampleFinishedTrace(trace)\n\t\t\tif len(trace.spans) != 0 {\n\t\t\t\tt.traceWriter.add(trace.spans)\n\t\t\t}\n\t\tcase <-tick:\n\t\t\tt.config.statsd.Incr(\"datadog.tracer.flush_triggered\", []string{\"reason:scheduled\"}, 1)\n\t\t\tt.traceWriter.flush()\n\n\t\tcase done := <-t.flush:\n\t\t\tt.config.statsd.Incr(\"datadog.tracer.flush_triggered\", []string{\"reason:invoked\"}, 1)\n\t\t\tt.traceWriter.flush()\n\t\t\t// TODO(x): In reality, the traceWriter.flush() call is not synchronous\n\t\t\t// when using the agent traceWriter. However, this functionnality is used\n\t\t\t// in Lambda so for that purpose this mechanism should suffice.\n\t\t\tdone <- struct{}{}\n\n\t\tcase <-t.stop:\n\t\tloop:\n\t\t\t// the loop ensures that the payload channel is fully drained\n\t\t\t// before the final flush to ensure no traces are lost (see #526)\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase trace := <-t.out:\n\t\t\t\t\tt.sampleFinishedTrace(trace)\n\t\t\t\t\tif len(trace.spans) != 0 {\n\t\t\t\t\t\tt.traceWriter.add(trace.spans)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tbreak loop\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "func (c *Converter) flush(ctx context.Context, pLogs pdata.Logs) error {\n\tdoneChan := ctx.Done()\n\n\tselect {\n\tcase <-doneChan:\n\t\treturn fmt.Errorf(\"flushing log entries interrupted, err: %w\", ctx.Err())\n\n\tcase c.pLogsChan <- pLogs:\n\n\t// The converter has been stopped so bail the flush.\n\tcase <-c.stopChan:\n\t\treturn errors.New(\"logs converter has been stopped\")\n\t}\n\n\treturn nil\n}", "func (s *shard) Flush() (err error) {\n\t// another flush process is running\n\tif !s.isFlushing.CAS(false, true) {\n\t\treturn nil\n\t}\n\t// 1. mark flush job doing\n\ts.flushCondition.Add(1)\n\n\tdefer func() {\n\t\t//TODO add commit kv meta after ack successfully\n\t\t// mark flush job complete, notify\n\t\ts.flushCondition.Done()\n\t\ts.isFlushing.Store(false)\n\t}()\n\n\t//FIXME stone1100\n\t// index flush\n\tif s.indexDB != nil {\n\t\tif err = s.indexDB.Flush(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// flush memory database if need flush\n\tfor _, memDB := range s.families {\n\t\t//TODO add time threshold???\n\t\tif memDB.MemSize() > constants.ShardMemoryUsedThreshold {\n\t\t\tif err := s.flushMemoryDatabase(memDB); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\t//FIXME(stone1100) need remove memory database if long time no data\n\t// finally, commit replica sequence\n\ts.ackReplicaSeq()\n\treturn nil\n}", "func (b *httpBatch) Flush() error {\n\treturn nil\n}", "func (th *telemetryHandle) Flush() {\n\tth.client.Channel().Flush()\n}", "func (a *Agent) flush() {\n\tvar wg sync.WaitGroup\n\n\twg.Add(len(a.Config.Processors))\n\tfor _, p := range a.Config.Processors {\n\t\tgo func(processor *models.RunningProcessor) {\n\t\t\tdefer wg.Done()\n\t\t\tprocessor.Flush()\n\t\t}(p)\n\t}\n\n\twg.Add(len(a.Config.Sinks))\n\tfor _, s := range a.Config.Sinks {\n\t\tgo func(sink *models.RunningSink) {\n\t\t\tdefer wg.Done()\n\t\t\terr := sink.Write()\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ERROR Error writing to sink [%s]: %s\",\n\t\t\t\t\tsink.Name(), err.Error())\n\t\t\t}\n\t\t}(s)\n\t}\n\n\twg.Wait()\n}", "func (cs *UnsafeCounterIndex) Flush(s Counters) Counters {\n\ts = append(s, cs.counters...)\n\tcs.counters.Zero()\n\treturn s\n}", "func (p *Pool) flush() {\n\tconn := p.Pool.Get()\n\tdefer conn.Close()\n\n\tconn.Send(\"DEBUG\", \"FLUSHALL\")\n}", "func (qs *queuedSender) Flush(params *map[string]string) {\n\tvar anonService interface{} = qs\n\tservice, ok := anonService.(types.Service)\n\tif ok {\n\t\t// Since this method is supposed to be deferred we just have to ignore errors\n\t\t_ = service.Send(strings.Join(qs.queue, \"\\n\"), params)\n\t}\n}", "func (ab *Buffer) unsafeFlushAsync(ctx context.Context, contents []interface{}) {\n\tif len(contents) == 0 {\n\t\treturn\n\t}\n\tif ab.Tracer != nil {\n\t\tfinisher := ab.Tracer.StartQueueFlush(ctx)\n\t\tdefer finisher.Finish(nil)\n\t}\n\tif ab.Stats != nil {\n\t\tab.maybeStatCount(ctx, MetricFlush, 1)\n\t\tab.maybeStatGauge(ctx, MetricFlushQueueLength, float64(len(ab.flushes)))\n\t\tab.maybeStatCount(ctx, MetricFlushItemCount, len(contents))\n\t\tstart := time.Now().UTC()\n\t\tdefer func() {\n\t\t\tab.maybeStatElapsed(ctx, MetricFlushEnqueueElapsed, start)\n\t\t}()\n\t}\n\n\tlogger.MaybeDebugf(ab.Log, \"autoflush buffer; queue flush, queue length: %d\", len(ab.flushes))\n\tab.flushes <- Flush{\n\t\tContext: ctx,\n\t\tContents: contents,\n\t}\n}", "func (runner *runner) Flush() error {\n\trunner.mu.Lock()\n\tdefer runner.mu.Unlock()\n\treturn runner.ipvsHandle.Flush()\n}", "func (n *NodeEventsBatcher) Flush() {\n\tvar hasCreate bool\n\toutput := &NodeChangeEventWithInfo{}\n\tfor _, e := range n.buffer {\n\t\tif e.Type == tree.NodeChangeEvent_CREATE {\n\t\t\thasCreate = true\n\t\t}\n\t\toutput.Source = e.Source\n\t\toutput.Type = e.Type\n\t\tif output.Target != nil {\n\t\t\t// Merge metadatas\n\t\t\toutput.Target.Etag = e.Target.Etag\n\t\t\toutput.Target.Type = e.Target.Type\n\t\t\toutput.Target.MTime = e.Target.MTime\n\t\t\toutput.Target.Size = e.Target.Size\n\t\t\tfor k, v := range e.Target.MetaStore {\n\t\t\t\toutput.Target.MetaStore[k] = v\n\t\t\t}\n\t\t} else {\n\t\t\toutput.Target = e.Target\n\t\t}\n\t}\n\tif hasCreate {\n\t\toutput.Type = tree.NodeChangeEvent_CREATE\n\t\toutput.refreshTarget = false\n\t} else {\n\t\toutput.refreshTarget = true\n\t}\n\tn.out <- output\n\tn.done <- n.uuid\n}", "func (i *Batch) flush(ctx context.Context, workerID int, tasks map[string]TaskArgs) {\n\targs := make(map[string]map[string]interface{}, len(tasks))\n\tfor _, task := range tasks {\n\t\targs[task.ID] = task.Args\n\t}\n\trespData, err := i.doFn(ctx, args)\n\tfor _, task := range tasks {\n\t\tgo func(t TaskArgs) {\n\t\t\tt.RespChan <- &TaskResp{\n\t\t\t\tErr: err,\n\t\t\t\tData: respData[t.ID],\n\t\t\t}\n\t\t}(task)\n\t}\n\treturn\n}", "func (a *Agent) flush() {\n\tif len(a.Buf) != 0 {\n\t\ta.Sketch.insert(agentConfig, a.Buf)\n\t\ta.Buf = nil\n\t}\n\n\tif len(a.CountBuf) != 0 {\n\t\ta.Sketch.insertCounts(agentConfig, a.CountBuf)\n\t\ta.CountBuf = nil\n\t}\n}", "func (r *httpReporter) sendBatch() error {\n\t// Select all current spans in the batch to be sent\n\tr.batchMtx.Lock()\n\tsendBatch := r.batch[:]\n\tr.batchMtx.Unlock()\n\n\tif len(sendBatch) == 0 {\n\t\treturn nil\n\t}\n\n\tbody, err := r.serializer.Serialize(sendBatch)\n\tif err != nil {\n\t\tr.logger.Printf(\"failed when marshalling the spans batch: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", r.url, bytes.NewReader(body))\n\tif err != nil {\n\t\tr.logger.Printf(\"failed when creating the request: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", r.serializer.ContentType())\n\tif r.reqCallback != nil {\n\t\tr.reqCallback(req)\n\t}\n\n\tctx, cancel := context.WithTimeout(req.Context(), r.reqTimeout)\n\tdefer cancel()\n\n\tresp, err := r.client.Do(req.WithContext(ctx))\n\tif err != nil {\n\t\tr.logger.Printf(\"failed to send the request: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\t_ = resp.Body.Close()\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\tr.logger.Printf(\"failed the request with status code %d\\n\", resp.StatusCode)\n\t}\n\n\t// Remove sent spans from the batch even if they were not saved\n\tr.batchMtx.Lock()\n\tr.batch = r.batch[len(sendBatch):]\n\tr.batchMtx.Unlock()\n\n\treturn nil\n}", "func (s *PrometheusSerializer) Flush() error {\n\twr := &prompb.WriteRequest{\n\t\tTimeseries: s.series[:s.cur],\n\t}\n\tdata, err := wr.Marshal()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsb := bytebufferpool.Get()\n\tsb.B = snappy.Encode(sb.B, data)\n\n\tvar sizeBuf []byte\n\tsizeBuf = marshalUint64(sizeBuf[:0], uint64(sb.Len()))\n\tif _, err := s.w.Write(sizeBuf); err != nil {\n\t\tbytebufferpool.Put(sb)\n\t\treturn err\n\t}\n\n\t_, err = s.w.Write(sb.Bytes())\n\ts.cur = 0\n\tbytebufferpool.Put(sb)\n\treturn err\n}", "func flush(logger *zap.Logger) {\n\t_ = logger.Sync()\n\teventingmetrics.FlushExporter()\n}", "func (p *Pools) Flush(force bool) {\n\tvar wgFlush sync.WaitGroup\n\tvar tcpFlushed int64\n\tvar tcpCount int64\n\tvar udpFlushed int64\n\tvar udpCount int64\n\tvar counterLock sync.Mutex\n\tfor _, pool := range p.pools {\n\t\tpool.flush(force, &wgFlush, &tcpFlushed, &tcpCount, &udpFlushed, &udpCount, &counterLock)\n\t}\n\twgFlush.Wait()\n\tfmt.Println(humanize.Comma(tcpFlushed), \"\\t/\", humanize.Comma(tcpCount), \"TCP Flows flushed\")\n\tfmt.Println(humanize.Comma(udpFlushed), \"\\t/\", humanize.Comma(udpCount), \"UDP Flows flushed\")\n\twgFlush.Wait()\n}", "func (etcd *EtcdSource) Flush() (err error) {\n\tif etcd.writeChan != nil {\n\t\tclose(etcd.writeChan)\n\t}\n\n\t// wait for flush to complete\n\tfor err = range etcd.flushChan {\n\t\tlog.Printf(\"config:EtcdSource %v: Flush: %v\", etcd, err)\n\t}\n\n\treturn\n}", "func flushAll() {\n\tclients.Range(func(h *ClientHandler) {\n\t\th.Flush()\n\t})\n}", "func (f *AggregationFlusher) Flush(ctx context.Context) error {\n\treturn f.Sink.Aggregate(ctx, f.Source.FlushMetrics())\n}", "func (l *Logger) Flush() {\n\tfor _, l := range l.outputs {\n\t\tl.Flush()\n\t}\n}", "func (r *promReporter) Flush() {\n\n}", "func (s *StatsdClient) Flush() error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.counts = make(map[string]int64)\n\treturn nil\n}", "func (b *RecordBuffer) Flush() {\n\tb.recordsInBuffer = b.recordsInBuffer[:0]\n\tb.sequencesInBuffer = b.sequencesInBuffer[:0]\n}", "func (a *MetricAggregator) Flush(flushInterval time.Duration) {\n\ta.statser.Gauge(\"aggregator.metricmaps_received\", float64(a.metricMapsReceived), nil)\n\n\tflushInSeconds := float64(flushInterval) / float64(time.Second)\n\n\ta.metricMap.Counters.Each(func(key, tagsKey string, counter gostatsd.Counter) {\n\t\tcounter.PerSecond = float64(counter.Value) / flushInSeconds\n\t\ta.metricMap.Counters[key][tagsKey] = counter\n\t})\n\n\ta.metricMap.Timers.Each(func(key, tagsKey string, timer gostatsd.Timer) {\n\t\tif hasHistogramTag(timer) {\n\t\t\ttimer.Histogram = latencyHistogram(timer, a.histogramLimit)\n\t\t\ta.metricMap.Timers[key][tagsKey] = timer\n\t\t\treturn\n\t\t}\n\n\t\tif count := len(timer.Values); count > 0 {\n\t\t\tsort.Float64s(timer.Values)\n\t\t\ttimer.Min = timer.Values[0]\n\t\t\ttimer.Max = timer.Values[count-1]\n\t\t\tn := len(timer.Values)\n\t\t\tcount := float64(n)\n\n\t\t\tcumulativeValues := make([]float64, n)\n\t\t\tcumulSumSquaresValues := make([]float64, n)\n\t\t\tcumulativeValues[0] = timer.Min\n\t\t\tcumulSumSquaresValues[0] = timer.Min * timer.Min\n\t\t\tfor i := 1; i < n; i++ {\n\t\t\t\tcumulativeValues[i] = timer.Values[i] + cumulativeValues[i-1]\n\t\t\t\tcumulSumSquaresValues[i] = timer.Values[i]*timer.Values[i] + cumulSumSquaresValues[i-1]\n\t\t\t}\n\n\t\t\tvar sumSquares = timer.Min * timer.Min\n\t\t\tvar mean = timer.Min\n\t\t\tvar sum = timer.Min\n\t\t\tvar thresholdBoundary = timer.Max\n\n\t\t\tfor pct, pctStruct := range a.percentThresholds {\n\t\t\t\tnumInThreshold := n\n\t\t\t\tif n > 1 {\n\t\t\t\t\tnumInThreshold = int(round(math.Abs(pct) / 100 * count))\n\t\t\t\t\tif numInThreshold == 0 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif pct > 0 {\n\t\t\t\t\t\tthresholdBoundary = timer.Values[numInThreshold-1]\n\t\t\t\t\t\tsum = cumulativeValues[numInThreshold-1]\n\t\t\t\t\t\tsumSquares = cumulSumSquaresValues[numInThreshold-1]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthresholdBoundary = timer.Values[n-numInThreshold]\n\t\t\t\t\t\tsum = cumulativeValues[n-1] - cumulativeValues[n-numInThreshold-1]\n\t\t\t\t\t\tsumSquares = cumulSumSquaresValues[n-1] - cumulSumSquaresValues[n-numInThreshold-1]\n\t\t\t\t\t}\n\t\t\t\t\tmean = sum / float64(numInThreshold)\n\t\t\t\t}\n\n\t\t\t\tif !a.disabledSubtypes.CountPct {\n\t\t\t\t\ttimer.Percentiles.Set(pctStruct.count, float64(numInThreshold))\n\t\t\t\t}\n\t\t\t\tif !a.disabledSubtypes.MeanPct {\n\t\t\t\t\ttimer.Percentiles.Set(pctStruct.mean, mean)\n\t\t\t\t}\n\t\t\t\tif !a.disabledSubtypes.SumPct {\n\t\t\t\t\ttimer.Percentiles.Set(pctStruct.sum, sum)\n\t\t\t\t}\n\t\t\t\tif !a.disabledSubtypes.SumSquaresPct {\n\t\t\t\t\ttimer.Percentiles.Set(pctStruct.sumSquares, sumSquares)\n\t\t\t\t}\n\t\t\t\tif pct > 0 {\n\t\t\t\t\tif !a.disabledSubtypes.UpperPct {\n\t\t\t\t\t\ttimer.Percentiles.Set(pctStruct.upper, thresholdBoundary)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif !a.disabledSubtypes.LowerPct {\n\t\t\t\t\t\ttimer.Percentiles.Set(pctStruct.lower, thresholdBoundary)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsum = cumulativeValues[n-1]\n\t\t\tsumSquares = cumulSumSquaresValues[n-1]\n\t\t\tmean = sum / count\n\n\t\t\tvar sumOfDiffs float64\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tsumOfDiffs += (timer.Values[i] - mean) * (timer.Values[i] - mean)\n\t\t\t}\n\n\t\t\tmid := int(math.Floor(count / 2))\n\t\t\tif math.Mod(count, 2) == 0 {\n\t\t\t\ttimer.Median = (timer.Values[mid-1] + timer.Values[mid]) / 2\n\t\t\t} else {\n\t\t\t\ttimer.Median = timer.Values[mid]\n\t\t\t}\n\n\t\t\ttimer.Mean = mean\n\t\t\ttimer.StdDev = math.Sqrt(sumOfDiffs / count)\n\t\t\ttimer.Sum = sum\n\t\t\ttimer.SumSquares = sumSquares\n\n\t\t\ttimer.Count = int(round(timer.SampledCount))\n\t\t\ttimer.PerSecond = timer.SampledCount / flushInSeconds\n\t\t} else {\n\t\t\ttimer.Count = 0\n\t\t\ttimer.SampledCount = 0\n\t\t\ttimer.PerSecond = 0\n\t\t}\n\t\ta.metricMap.Timers[key][tagsKey] = timer\n\t})\n}", "func (evc *EventCache) Flush() {\n\tfor _, ei := range evc.events {\n\t\tevc.evsw.FireEvent(ei.event, ei.data)\n\t}\n\tevc.events = make([]eventInfo, eventsBufferSize)\n}", "func (m *Metric) Done() {\n\t// End open spans.\n\tm.mu.Lock() // Lock protects the slice of spans changing size.\n\tvar zeroTime time.Time\n\tfor _, s := range m.spans {\n\t\tif s.EndTime == zeroTime {\n\t\t\ts.End()\n\t\t}\n\t}\n\tm.mu.Unlock()\n\n\tif atomic.LoadInt32(&registered) == 0 {\n\t\t// No saver registered,\n\t\t// don't send any metrics.\n\t\treturn\n\t}\n\n\tselect {\n\tcase saveQueue <- m:\n\t\t// Sent\n\tdefault:\n\t\t// Warn if channel is full.\n\t\tlog.Error.Printf(\"metric: channel is full. Dropping metric %q.\", m.Name)\n\t}\n}", "func (s *Layer) Flush() {\n\ts.Pool = Pool{}\n}", "func FlushSend(q Queue) {\n\tif flusher, ok := q.(Flusher); ok {\n\t\tflusher.FlushSend()\n\t}\n}", "func (ingest *Ingestion) Flush() error {\n\terr := ingest.commit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ingest.Start()\n}", "func Flush() {\n\tsentry.Flush(3 * time.Second)\n}", "func (s *Collector) FlushAlways(interval time.Duration, errs chan<- error) {\n\tfor range time.Tick(interval) {\n\t\terrs <- s.Flush()\n\t}\n}", "func (c *QueuedChan) flush() {\n\t// Flush queue.\n\tfor elem := c.Front(); nil != elem; elem = c.Front() {\n\t\tc.popc <- elem.Value\n\t\tc.List.Remove(elem)\n\t}\n}", "func (ab *AutoflushBuffer) Flush(ctx context.Context) {\n\tab.Lock()\n\tdefer ab.Unlock()\n\tab.flushUnsafe(ctx, ab.Contents.Drain())\n}", "func (dam *dam) flush(err error) {\n\tclose(dam.barrier)\n\n\t// Reset barrier\n\tdam.lock.Lock()\n\tdam.barrier = make(chan error)\n\tdam.lock.Unlock()\n}", "func (mlog *MultiLogger) Flush() {\n\tmlog.Lock()\n\tdefer mlog.Unlock()\n\n\tif mlog.isClosed {\n\t\treturn\n\t}\n\tmlog.qerr <- cmdFlush\n\tmlog.qout <- cmdFlush\n\t<-mlog.flushq\n\t<-mlog.flushq\n}", "func (iter *Iterator) Flush() error { return iter.impl.Flush() }", "func (c *Conn) Flush() error {\n\tif c.FlushMock != nil {\n\t\treturn c.FlushMock()\n\t}\n\n\tif len(c.queue) > 0 {\n\t\tfor _, cmd := range c.queue {\n\t\t\treply, err := c.do(cmd.commandName, cmd.args...)\n\t\t\tc.replies = append(c.replies, replyElement{reply: reply, err: err})\n\t\t}\n\t\tc.queue = []queueElement{}\n\t}\n\n\treturn nil\n}", "func (h *heapSorter) flush(ctx context.Context, maxResolvedTs uint64) error {\n\tcaptureAddr := util.CaptureAddrFromCtx(ctx)\n\tchangefeedID := util.ChangefeedIDFromCtx(ctx)\n\t_, tableName := util.TableIDFromCtx(ctx)\n\tsorterFlushCountHistogram.WithLabelValues(captureAddr, changefeedID, tableName).Observe(float64(h.heap.Len()))\n\n\tisEmptyFlush := h.heap.Len() == 0\n\tif isEmptyFlush {\n\t\treturn nil\n\t}\n\tvar (\n\t\tbackEnd backEnd\n\t\tlowerBound uint64\n\t)\n\n\tif !isEmptyFlush {\n\t\tvar err error\n\t\tbackEnd, err = pool.alloc(ctx)\n\t\tif err != nil {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\n\t\tlowerBound = h.heap[0].entry.CRTs\n\t}\n\n\ttask := &flushTask{\n\t\ttaskID: h.taskCounter,\n\t\theapSorterID: h.id,\n\t\tbackend: backEnd,\n\t\ttsLowerBound: lowerBound,\n\t\tmaxResolvedTs: maxResolvedTs,\n\t\tfinished: make(chan error, 2),\n\t}\n\th.taskCounter++\n\n\tvar oldHeap sortHeap\n\tif !isEmptyFlush {\n\t\ttask.dealloc = func() error {\n\t\t\tif task.backend != nil {\n\t\t\t\ttask.backend = nil\n\t\t\t\treturn pool.dealloc(backEnd)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\toldHeap = h.heap\n\t\th.heap = make(sortHeap, 0, 65536)\n\t} else {\n\t\ttask.dealloc = func() error {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tlog.Debug(\"Unified Sorter new flushTask\",\n\t\tzap.String(\"table\", tableNameFromCtx(ctx)),\n\t\tzap.Int(\"heap-id\", task.heapSorterID),\n\t\tzap.Uint64(\"resolvedTs\", task.maxResolvedTs))\n\n\tgo func() {\n\t\tif isEmptyFlush {\n\t\t\treturn\n\t\t}\n\t\tbackEndFinal := backEnd\n\t\twriter, err := backEnd.writer()\n\t\tif err != nil {\n\t\t\tif backEndFinal != nil {\n\t\t\t\t_ = task.dealloc()\n\t\t\t}\n\t\t\ttask.finished <- errors.Trace(err)\n\t\t\treturn\n\t\t}\n\n\t\tdefer func() {\n\t\t\t// handle errors (or aborts) gracefully to prevent resource leaking (especially FD's)\n\t\t\tif writer != nil {\n\t\t\t\t_ = writer.flushAndClose()\n\t\t\t}\n\t\t\tif backEndFinal != nil {\n\t\t\t\t_ = task.dealloc()\n\t\t\t}\n\t\t\tclose(task.finished)\n\t\t}()\n\n\t\tfor oldHeap.Len() > 0 {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\ttask.finished <- ctx.Err()\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\tevent := heap.Pop(&oldHeap).(*sortItem).entry\n\t\t\terr := writer.writeNext(event)\n\t\t\tif err != nil {\n\t\t\t\ttask.finished <- errors.Trace(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tdataSize := writer.dataSize()\n\t\tatomic.StoreInt64(&task.dataSize, int64(dataSize))\n\t\teventCount := writer.writtenCount()\n\n\t\twriter1 := writer\n\t\twriter = nil\n\t\terr = writer1.flushAndClose()\n\t\tif err != nil {\n\t\t\ttask.finished <- errors.Trace(err)\n\t\t\treturn\n\t\t}\n\n\t\tbackEndFinal = nil\n\t\ttask.finished <- nil // DO NOT access `task` beyond this point in this function\n\t\tlog.Debug(\"Unified Sorter flushTask finished\",\n\t\t\tzap.Int(\"heap-id\", task.heapSorterID),\n\t\t\tzap.String(\"table\", tableNameFromCtx(ctx)),\n\t\t\tzap.Uint64(\"resolvedTs\", task.maxResolvedTs),\n\t\t\tzap.Uint64(\"data-size\", dataSize),\n\t\t\tzap.Int(\"size\", eventCount))\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase h.outputCh <- task:\n\t}\n\treturn nil\n}", "func (m *Migrator) Flush() error {\n\tvar wg sync.WaitGroup\n\tvar mu sync.Mutex\n\tvar errs HostErrorSet\n\tfor hostKey, s := range m.shards {\n\t\tif s.Len() == 0 {\n\t\t\tcontinue\n\t\t}\n\t\twg.Add(1)\n\t\tgo func(hostKey hostdb.HostPublicKey, s *renter.SectorBuilder) {\n\t\t\tdefer wg.Done()\n\t\t\th, err := m.hosts.acquire(hostKey)\n\t\t\tif err != nil {\n\t\t\t\tmu.Lock()\n\t\t\t\terrs = append(errs, &HostError{hostKey, err})\n\t\t\t\tmu.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsector := s.Finish()\n\t\t\troot, err := h.Append(sector)\n\t\t\tm.hosts.release(hostKey)\n\t\t\tif err != nil {\n\t\t\t\tmu.Lock()\n\t\t\t\terrs = append(errs, &HostError{hostKey, err})\n\t\t\t\tmu.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\t\t\ts.SetMerkleRoot(root)\n\t\t}(hostKey, s)\n\t}\n\twg.Wait()\n\tif len(errs) > 0 {\n\t\treturn errs\n\t}\n\n\tfor _, fn := range m.onFlush {\n\t\tif err := fn(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tm.onFlush = m.onFlush[:0]\n\n\tfor _, s := range m.shards {\n\t\ts.Reset()\n\t}\n\n\treturn nil\n}", "func (client *LDClient) Flush() {\n\tclient.eventProcessor.Flush()\n}", "func (t Tracker) FlushEmitter() {\n\tt.Emitter.Flush()\n}", "func (honest *Honest) flushUpdates() {\n\n\thonest.blockUpdates = honest.blockUpdates[:0]\n}", "func (r *Transformer) flushUncombined(ctx context.Context) {\n\tfor source := range r.batchMap {\n\t\tfor _, entry := range r.batchMap[source].entries {\n\t\t\tr.Write(ctx, entry)\n\t\t}\n\t\tr.removeBatch(source)\n\t}\n\tr.ticker.Reset(r.forceFlushTimeout)\n}", "func (cl *Client) Flush(ctx context.Context) error {\n\tp := &cl.producer\n\n\t// Signal to finishRecord that we want to be notified once buffered hits 0.\n\t// Also forbid any new producing to start a linger.\n\tatomic.AddInt32(&p.flushing, 1)\n\tdefer atomic.AddInt32(&p.flushing, -1)\n\n\tcl.cfg.logger.Log(LogLevelInfo, \"flushing\")\n\tdefer cl.cfg.logger.Log(LogLevelDebug, \"flushed\")\n\n\t// At this point, if lingering is configured, nothing will _start_ a\n\t// linger because the producer's flushing atomic int32 is nonzero. We\n\t// must wake anything that could be lingering up, after which all sinks\n\t// will loop draining.\n\tif cl.cfg.linger > 0 || cl.cfg.manualFlushing {\n\t\tfor _, parts := range p.topics.load() {\n\t\t\tfor _, part := range parts.load().partitions {\n\t\t\t\tpart.records.unlingerAndManuallyDrain()\n\t\t\t}\n\t\t}\n\t}\n\n\tquit := false\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tp.notifyMu.Lock()\n\t\tdefer p.notifyMu.Unlock()\n\t\tdefer close(done)\n\n\t\tfor !quit && atomic.LoadInt64(&p.bufferedRecords) > 0 {\n\t\t\tp.notifyCond.Wait()\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-done:\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\tp.notifyMu.Lock()\n\t\tquit = true\n\t\tp.notifyMu.Unlock()\n\t\tp.notifyCond.Broadcast()\n\t\treturn ctx.Err()\n\t}\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 (u *LDSUnit) Flush() {\n\tu.toRead = nil\n\tu.toExec = nil\n\tu.toWrite = nil\n}", "func (r *limitedRowWriter) Flush() {\n\tif r == nil {\n\t\treturn\n\t}\n\n\t// If at least some rows were sent, and no values are pending, then don't\n\t// emit anything, since at least 1 row was previously emitted. This ensures\n\t// that if no rows were ever sent, at least 1 will be emitted, even an empty row.\n\tif r.totalSent != 0 && len(r.currValues) == 0 {\n\t\treturn\n\t}\n\n\tif r.limit > 0 && len(r.currValues) > r.limit {\n\t\tr.currValues = r.currValues[:r.limit]\n\t}\n\tr.c <- r.processValues(r.currValues)\n\tr.currValues = nil\n}", "func (s *State) Flush() {\n\ts.decidedBlocks.Flush()\n\ts.missingBlocks.Flush()\n\ts.unverifiedBlocks.Flush()\n}", "func (s *State) doFlush(c context.Context, state *tsmon.State, settings *tsmonSettings) error {\n\tvar mon monitor.Monitor\n\n\tif s.testingMonitor != nil {\n\t\tmon = s.testingMonitor\n\t} else if info.Get(c).IsDevAppServer() || settings.PubsubProject == \"\" || settings.PubsubTopic == \"\" {\n\t\tmon = monitor.NewDebugMonitor(\"\")\n\t} else {\n\t\ttopic := gcps.NewTopic(settings.PubsubProject, settings.PubsubTopic)\n\t\tlogging.Infof(c, \"Sending metrics to %s\", topic)\n\n\t\t// Create an HTTP client with the default appengine service account. The\n\t\t// client is bound to the context and inherits its deadline.\n\t\tauth, err := gaeauth.Authenticator(c, gcps.PublisherScopes, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tclient, err := auth.Client()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmon, err = monitor.NewPubsubMonitor(c, client, topic)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := state.Flush(c, mon); err != nil {\n\t\treturn err\n\t}\n\n\tstate.ResetGlobalCallbackMetrics(c)\n\treturn nil\n}", "func (m *mergeWithTimestampsType) Flush() {\n\ttsLen := len(m.timestamps)\n\tif !m.lastRecordSet {\n\t\treturn\n\t}\n\tfor m.timestampIdx < tsLen {\n\t\tm.lastRecord.TimeStamp = m.timestamps[m.timestampIdx]\n\t\tif !m.wrapped.Append(&m.lastRecord) {\n\t\t\treturn\n\t\t}\n\t\tm.timestampIdx++\n\t}\n}", "func (r *ResponseStatusRecorder) Flush() {\n\tif r.flusher != nil {\n\t\tr.flusher.Flush()\n\t}\n}", "func (s *shard) Flush() (err error) {\n\t// another flush process is running\n\tif !s.isFlushing.CAS(false, true) {\n\t\treturn nil\n\t}\n\t// 1. mark flush job doing\n\ts.flushCondition.Add(1)\n\n\tdefer func() {\n\t\t//TODO add commit kv meta after ack successfully\n\t\t// mark flush job complete, notify\n\t\ts.flushCondition.Done()\n\t\ts.isFlushing.Store(false)\n\t}()\n\n\tstartTime := time.Now()\n\t//FIXME stone1100\n\t// index flush\n\tif s.indexDB != nil {\n\t\tif err = s.indexDB.Flush(); err != nil {\n\t\t\ts.logger.Error(\"failed to flush indexDB \",\n\t\t\t\tlogger.Any(\"shardID\", s.id),\n\t\t\t\tlogger.String(\"database\", s.databaseName),\n\t\t\t\tlogger.Error(err))\n\t\t\treturn err\n\t\t}\n\t\ts.logger.Info(\"flush indexDB successfully\",\n\t\t\tlogger.Any(\"shardID\", s.id),\n\t\t\tlogger.String(\"database\", s.databaseName),\n\t\t)\n\t\ts.statistics.indexFlushTimer.UpdateSince(startTime)\n\t}\n\n\tvar waitingFlushMemDB memdb.MemoryDatabase\n\timmutable := s.families.ImmutableEntries()\n\t// flush first immutable memdb\n\tif len(immutable) > 0 {\n\t\twaitingFlushMemDB = immutable[0].memDB\n\t} else {\n\t\ts.mutex.Lock()\n\t\t// force picks a mutable memdb from memory\n\t\tif evictedMutable := s.families.SetLargestMutableMemDBImmutable(); evictedMutable {\n\t\t\twaitingFlushMemDB = s.families.ImmutableEntries()[0].memDB\n\t\t\ts.logger.Info(\"forcefully switch a memdb to immutable for flushing\",\n\t\t\t\tlogger.Any(\"shardID\", s.id),\n\t\t\t\tlogger.String(\"database\", s.databaseName),\n\t\t\t\tlogger.Int64(\"familyTime\", waitingFlushMemDB.FamilyTime()),\n\t\t\t\tlogger.Int64(\"memDBSize\", waitingFlushMemDB.MemSize()),\n\t\t\t)\n\t\t}\n\t\ts.mutex.Unlock()\n\t}\n\tif waitingFlushMemDB == nil {\n\t\ts.logger.Warn(\"there is no memdb to flush\", logger.Any(\"shardID\", s.id))\n\t\treturn nil\n\t}\n\n\tstartTime = time.Now()\n\tif err := s.flushMemoryDatabase(waitingFlushMemDB); err != nil {\n\t\ts.logger.Error(\"failed to flush memdb\",\n\t\t\tlogger.Any(\"shardID\", s.id),\n\t\t\tlogger.String(\"database\", s.databaseName),\n\t\t\tlogger.Int64(\"familyTime\", waitingFlushMemDB.FamilyTime()),\n\t\t\tlogger.Int64(\"memDBSize\", waitingFlushMemDB.MemSize()))\n\t\treturn err\n\t}\n\t// flush success, remove it from the immutable list\n\ts.mutex.Lock()\n\ts.families.RemoveHeadImmutable()\n\ts.mutex.Unlock()\n\n\tendTime := time.Now()\n\ts.logger.Info(\"flush memdb successfully\",\n\t\tlogger.Any(\"shardID\", s.id),\n\t\tlogger.String(\"database\", s.databaseName),\n\t\tlogger.String(\"flush-duration\", endTime.Sub(startTime).String()),\n\t\tlogger.Int64(\"familyTime\", waitingFlushMemDB.FamilyTime()),\n\t\tlogger.Int64(\"memDBSize\", waitingFlushMemDB.MemSize()))\n\ts.statistics.memFlushTimer.UpdateDuration(endTime.Sub(startTime))\n\n\t//FIXME(stone1100) commit replica sequence\n\ts.ackReplicaSeq()\n\treturn nil\n}", "func TestSpanModifyWhileFlushing(t *testing.T) {\n\ttracer, _ := getTestTracer()\n\tdefer tracer.Stop()\n\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tspan := tracer.NewRootSpan(\"pylons.request\", \"pylons\", \"/\")\n\t\tspan.Finish()\n\t\t// It doesn't make much sense to update the span after it's been finished,\n\t\t// but an error in a user's code could lead to this.\n\t\tspan.SetMeta(\"race_test\", \"true\")\n\t\tspan.SetMetric(\"race_test2\", 133.7)\n\t\tspan.SetMetrics(\"race_test3\", 133.7)\n\t\tspan.SetError(errors.New(\"t\"))\n\t\tdone <- struct{}{}\n\t}()\n\n\trun := true\n\tfor run {\n\t\tselect {\n\t\tcase <-done:\n\t\t\trun = false\n\t\tdefault:\n\t\t\ttracer.flushTraces()\n\t\t}\n\t}\n}", "func (res *ServerHTTPResponse) flush(ctx context.Context) {\n\tif res.flushed {\n\t\t/* coverage ignore next line */\n\t\tres.contextLogger.Error(ctx,\n\t\t\t\"Flushed a server response multiple times\",\n\t\t\tzap.String(\"path\", res.Request.URL.Path),\n\t\t)\n\t\t/* coverage ignore next line */\n\t\treturn\n\t}\n\n\tres.flushed = true\n\tres.writeHeader(res.pendingStatusCode)\n\tif _, noContent := noContentStatusCodes[res.pendingStatusCode]; !noContent {\n\t\tres.writeBytes(res.pendingBodyBytes)\n\t}\n\tres.finish(ctx)\n}", "func (n *NodeDrainer) flush(state *state.StateStore) {\n\t// Cancel anything that may be running.\n\tif n.exitFn != nil {\n\t\tn.exitFn()\n\t}\n\n\t// Store the new state\n\tif state != nil {\n\t\tn.state = state\n\t}\n\n\tn.ctx, n.exitFn = context.WithCancel(context.Background())\n\tn.jobWatcher = n.jobFactory(n.ctx, n.queryLimiter, n.state, n.logger)\n\tn.nodeWatcher = n.nodeFactory(n.ctx, n.queryLimiter, n.state, n.logger, n)\n\tn.deadlineNotifier = n.deadlineNotifierFactory(n.ctx)\n\tn.nodes = make(map[string]*drainingNode, 32)\n}", "func (n *Network) Flush() {\n\t// Flush back recursively\n\tfor _, node := range n.all_nodes {\n\t\tnode.Flushback()\n\t}\n}", "func (s *syncSchedule) flush() error {\n\tfor a := range s.txs {\n\t\tif err := a.writeTxStore(s.dir); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdelete(s.txs, a)\n\t}\n\n\tfor a := range s.wallets {\n\t\tif err := a.writeWallet(s.dir); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdelete(s.wallets, a)\n\t}\n\n\treturn nil\n}", "func (s *server) ServerlessFlush() {\n\ts.log.Debug(\"Received a Flush trigger\")\n\n\t// make all workers flush their aggregated data (in the batchers) into the time samplers\n\ts.serverlessFlushChan <- true\n\n\tstart := time.Now()\n\t// flush the aggregator to have the serializer/forwarder send data to the backend.\n\t// We add 10 seconds to the interval to ensure that we're getting the whole sketches bucket\n\ts.demultiplexer.ForceFlushToSerializer(start.Add(time.Second*10), true)\n}", "func (set *Set) Flush() error {\n\t_, err := set.Parent.run(\"flush\", set.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ab *Buffer) Dispatch() {\n\tab.Latch.Started()\n\n\tvar stopping <-chan struct{}\n\tvar flushWorker *async.Worker\n\tvar flush Flush\n\tfor {\n\t\tstopping = ab.Latch.NotifyStopping()\n\t\tselect {\n\t\tcase <-stopping:\n\t\t\tab.Latch.Stopped()\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t\tselect {\n\t\tcase flush = <-ab.flushes:\n\t\t\tselect {\n\t\t\tcase flushWorker = <-ab.flushWorkersReady:\n\t\t\t\tflushWorker.Work <- flush\n\t\t\tcase <-stopping:\n\t\t\t\tab.flushes <- flush\n\t\t\t\tab.Latch.Stopped()\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-stopping:\n\t\t\tab.Latch.Stopped()\n\t\t\treturn\n\t\t}\n\t}\n}", "func (a *Async) flushBuf(b *buffer) {\n\ttasks := b.Tasks()\n\tif len(tasks) > 0 {\n\t\tfor _, t := range tasks {\n\t\t\ta.wait.Add(1)\n\t\t\tgo func(t *task) {\n\t\t\t\tt.Do()\n\t\t\t\ta.wait.Done()\n\t\t\t}(t)\n\t\t}\n\t\ta.wait.Wait()\n\t\tb.Reset()\n\t}\n}", "func (lp *LogFile) Flush() {\n\tcomplete := make(chan bool)\n\tlp.messages <- logMessage{action: flushLog, complete: complete}\n\t<-complete\n}", "func Flush(flusher Flusher, swallow bool) (err error) {\n\tif err = flusher.Flush(); err == nil || !swallow {\n\t\treturn err\n\t}\n\tlog.Println(\"error thrown while flushing Flusher.\", err)\n\treturn nil\n}", "func FlushAt(e *events.Event, db Storer, tm time.Time) error {\n\ts := getSnapshot()\n\tdefer putSnapshot(s)\n\ts.Counters = e.Flush(s.Counters[:0])\n\tif len(s.Counters) == 0 {\n\t\treturn nil\n\t}\n\ts.Labels, s.Time = e.Labels, tm\n\tif err := db.Store(s); err != nil {\n\t\te.Merge(s.Counters)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (_e *MockDataCoord_Expecter) Flush(ctx interface{}, req interface{}) *MockDataCoord_Flush_Call {\n\treturn &MockDataCoord_Flush_Call{Call: _e.mock.On(\"Flush\", ctx, req)}\n}" ]
[ "0.7013252", "0.70100605", "0.68950844", "0.67272437", "0.67241", "0.6619081", "0.65922195", "0.6541169", "0.6531564", "0.64752495", "0.6468364", "0.64626235", "0.6339146", "0.6326567", "0.63122135", "0.63055515", "0.62817365", "0.6278763", "0.6242171", "0.6241586", "0.6190081", "0.61752135", "0.61687803", "0.61512285", "0.6143801", "0.6119428", "0.60714424", "0.60347396", "0.60287213", "0.60254604", "0.60249454", "0.6012976", "0.6012053", "0.6001679", "0.6000438", "0.5981777", "0.5967903", "0.5961433", "0.5959291", "0.5941297", "0.5935195", "0.59328926", "0.593208", "0.5906569", "0.59040296", "0.5901941", "0.58971757", "0.5897103", "0.58864933", "0.58799464", "0.5877384", "0.5871558", "0.58678216", "0.5863703", "0.5860835", "0.5859839", "0.58462775", "0.58090776", "0.5805481", "0.57963324", "0.57853603", "0.57850564", "0.5774589", "0.5769437", "0.57494414", "0.57479626", "0.5727507", "0.57236", "0.57180387", "0.57180196", "0.571281", "0.57108927", "0.57024825", "0.5699587", "0.56948125", "0.56776094", "0.56758195", "0.5674449", "0.5665765", "0.56628597", "0.5662371", "0.5657985", "0.5653671", "0.5649608", "0.5637568", "0.56304437", "0.562761", "0.56056166", "0.558836", "0.55842924", "0.5573376", "0.5559899", "0.555125", "0.5541693", "0.55353844", "0.55349815", "0.55190766", "0.5502075", "0.54996467", "0.5496893" ]
0.7357907
0
Stop stops the collector. After stopping, no more data will be sent to the underlying collector and calls to Collect will fail.
func (cc *ChunkedCollector) Stop() { cc.mu.Lock() defer cc.mu.Unlock() close(cc.stopChan) cc.stopped = true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *collector) Stop() {\n\tclose(c.stop)\n}", "func (collector *Collector) Stop() {\n\t// Stop the underlying Prospector (this should block until all workers shutdown)\n\tcollector.prospector.Stop()\n\n\t// Signal our internal processing to stop as well. It's probably safer to do this\n\t// after we've stopped the prospector just to make sure we handle as much data as possible\n\tclose(collector.Done)\n\t// Wait for our collector to tell us its finished shutting down.\n\t<-collector.Stopped\n\n\tif collector.ticker != nil {\n\t\tcollector.ticker.Stop()\n\t}\n}", "func (c *Collector) Stop() {\n\tc.channel.Close()\n\tc.broker.Close()\n}", "func (s *Spooler) Stop() {\n\tlogp.Info(\"Stopping spooler\")\n\n\t// Signal to the run method that it should stop.\n\tclose(s.exit)\n\n\t// Stop accepting writes. Any events in the channel will be flushed.\n\tclose(s.Channel)\n\n\t// Wait for the flush to complete.\n\ts.wg.Wait()\n\tdebugf(\"Spooler has stopped\")\n}", "func (collection *Collection) Stop() {\n\tfor _, c := range collection.collectors {\n\t\tc.Stop()\n\t\tcollection.wg.Done()\n\t}\n}", "func (s *Streamer) Stop() {\n\tclose(s.stopc)\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 (w *StatsWriter) Stop() {\n\tw.stop <- struct{}{}\n\t<-w.stop\n\tstopSenders(w.senders)\n}", "func (c *Collector) Stop() {\n\tclose(c.stopChan)\n\t<-c.doneChan\n\n\t// Clean the metrics on exit.\n\tfor _, state := range api.NodeStatus_State_name {\n\t\tnodesMetric.WithValues(strings.ToLower(state)).Set(0)\n\t}\n}", "func (s *T) Stop() {\n\tclose(s.stopCh)\n\ts.wg.Wait()\n}", "func (converger *converger) Stop() {\n\tconverger.stop <- struct{}{}\n}", "func (p *GaugeCollectionProcess) Stop() {\n\tclose(p.stop)\n}", "func (batchStats *BatchStatsReporter) Stop() {\n\tclose(batchStats.stopChan)\n}", "func (c *Collection) Stop() error {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tlog.Debug(\"Stop\", \"V\", debugV)\n\n\tif c.metadataUpdates != nil {\n\t\tclose(c.metadataUpdates)\n\t\tc.metadataUpdates = nil\n\t}\n\n\tif c.events != nil {\n\t\tclose(c.events)\n\t\tc.events = nil\n\t}\n\n\tif c.StopFunc == nil {\n\t\treturn nil\n\t}\n\n\treturn c.StopFunc()\n}", "func (c *Finalizer) Stop() {\n\tc.log.Info(\"stopping...\")\n\tc.queue.ShutDown()\n}", "func (c *Consumer) Stop() {\n\tc.stop <- true\n}", "func (sp *StreamPool) Stop() {\n\t//sw.quitCh <- true\n}", "func (s *subscriber) Stop() error {\n\ts.cons.Stop()\n\treturn nil\n}", "func (pool *SubPool) Stop() {\n\tpool.StopChan <- struct{}{}\n}", "func (w *Processor) Stop() {\n\tclose(w.stop)\n}", "func (s *ReporterImpl) Stop() {\n\ts.queue.Dispose()\n}", "func (a *Acceptor) Stop() {\n\t//TODO(student): Task 3 - distributed implementation\n\ta.stop <- 0\n\n}", "func (p *Proposer) Stop() {\n\tp.stop <- struct{}{}\n}", "func (s *Source) Stop() {\n\tclose(s.closeChan)\n}", "func (s *Stage) Stop() {\n\ts.SendAll(stop)\n\ts.wg.Wait()\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 (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 (s *ObjectStore) Stop() {\n\tclose(s.stopCh)\n}", "func (p *Processor) Stop() {\n\tc := p.stopChan\n\tp.stopChan = nil\n\tc <- struct{}{}\n\tp.Conn.Close()\n}", "func (p *Pipeline) Stop() {\n\tp.mut.Lock()\n\tdefer p.mut.Unlock()\n\tif p.err == nil {\n\t\tclose(p.done)\n\t}\n}", "func (r *reaper) stop() {\n\tr.stopCh <- struct{}{}\n}", "func (d *Drainer) Stop() {\n\td.stopChan <- true\n}", "func (e *EvtFailureDetector) Stop() {\n\te.stop <- struct{}{}\n}", "func (a API) Stop(cmd *None) (e error) {\n\tRPCHandlers[\"stop\"].Call <-API{a.Ch, cmd, nil}\n\treturn\n}", "func (s *ContinuousScanner) Stop() {\n\ts.stop <- struct{}{}\n}", "func (s *streamStrategy) Stop() {\n\tclose(s.inputChan)\n\t<-s.done\n}", "func (r *Runner) Stop() {\n\tr.logger.Info(\"Stopping runner...\")\n\tr.watcher.Stop()\n\t<-r.watcher.SndDoneCh // NOTE: Might need a timeout to prevent blocking forever\n\tclose(r.RcvDoneCh)\n}", "func (mm *BytesMonitor) Stop(ctx context.Context) {\n\tmm.doStop(ctx, true)\n}", "func (fd *failureDetector) Stop() {\n\tfd.stop <- struct{}{}\n}", "func (a *Agent) Stop() {\n\tclose(a.stopping)\n\ta.wg.Wait()\n}", "func (w *Worker) Stop() {\n\tclose(w.stopCh)\n}", "func (s *samplerBackendRateCounter) Stop() {\n\tclose(s.exit)\n\t<-s.stopped\n}", "func (s *Scanner) Stop() {\n\ts.stop <- struct{}{}\n}", "func (cMap *MyStruct) Stop(){\n\tcMap.stop <- true\n}", "func (c *Counter) Stop() {\n\tc.controlChannel <- controlRecord{\"stop\", \"\"}\n}", "func (c *Context) Stop() {\n\tc.stopChannel <- struct{}{}\n}", "func (p *Provider) Stop() {\n\tclose(p.stop)\n\t<-p.stopDone\n}", "func (a *Agent) Stop() {\n\ta.init()\n\ta.stopCh <- struct{}{}\n}", "func (c *Consumer) Stop() {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\tif c.running {\n\t\tc.stop <- true\n\t}\n}", "func (ps *PushStream) Stop() error {\n\tlogger.Ctx(ps.ctx).Infow(\"worker: push stream stop invoked\", \"subscription\", ps.subscription.Name)\n\n\t// signal to stop all go routines\n\tps.cancelFunc()\n\n\t// wait for stop to complete\n\t<-ps.doneCh\n\n\treturn nil\n}", "func (a *Acceptor) Stop() {\n\t//TODO(student): Task 3 - distributed implementation\n\ta.stopChan <- 0\n}", "func (c Chief) Stop() {\n\t// close jobs channel due to no one sends any further messages\n\tclose(c.Jobs)\n\n\tfor _, w := range c.Workers {\n\t\tw.Stop()\n\t}\n\n\tclose(c.Pool)\n}", "func (l *Learner) Stop() {\n\t// TODO(student): distributed implementation\n\tl.stop <- struct{}{}\n}", "func (cwl *CollectWeatherLoop) Stop() {\n\tcwl.log.Info(\"Stopping the loop\")\n\tcwl.done <- true\n}", "func (f *Processor) Stop() {\n\tclose(f.quit)\n\tf.eventsSemaphore.Terminate()\n\tf.wg.Wait()\n\tf.buffer.Clear()\n}", "func (bt *Metricbeat) Stop() {\n\tclose(bt.done)\n}", "func (c *LP) Stop() error {\n\treturn base.Stop(c.mdc)\n}", "func (ls *LogStreamer) Stop() error {\n\tls.logger.Debug(\"[LogStreamer] Waiting for all the chunks to be uploaded\")\n\n\tls.chunkWaitGroup.Wait()\n\n\tls.logger.Debug(\"[LogStreamer] Shutting down all workers\")\n\n\tfor n := 0; n < ls.conf.Concurrency; n++ {\n\t\tls.queue <- nil\n\t}\n\n\treturn nil\n}", "func (p *Prober) Stop() {\n\tclose(p.stop)\n}", "func (l *LiveStats) Stop() error {\n\tl.stopChan <- struct{}{}\n\tl.wg.Wait()\n\treturn nil\n}", "func (vmc *VMMetricsCollector) StopCollection() {\n\tclose(vmc.done)\n}", "func (vmc *VMMetricsCollector) StopCollection() {\n\tclose(vmc.done)\n}", "func (e *Engine) Stop() error {\n\te.stop <- nil\n\terr := <-e.stop\n\tclose(e.errors)\n\tclose(e.stop)\n\treturn err\n}", "func (this *BaseUnit) Stop() {\n\tlog.Debugf(\"Stopping fetch for unit %v...\", this)\n\tclose(this.fetchStop)\n\tlog.Debugf(\"Fetch for unit %v stopped.\", this)\n}", "func (a *Attacker) Stop() {\n\tselect {\n\tcase <-a.stopch:\n\t\treturn\n\tdefault:\n\t\tclose(a.stopch)\n\t}\n}", "func (c *Processor) Stop() (err error) {\n\tc.runState = RunStateStopped\n\treturn\n}", "func (d *D) stop() {\n\tclose(d.stopCh)\n}", "func (r *Cluster) Stop() {\n\tselect {\n\tcase <-r.stop:\n\t\treturn\n\tdefault:\n\t\tclose(r.stop)\n\t}\n}", "func (o *Outbound) Stop() error {\n\treturn o.once.Stop(o.chooser.Stop)\n}", "func (c *Cleaner) Stop() {\n\tc.StopChan <- true\n}", "func (b *Batch) Stop() {\n\tb.cancelFunc()\n}", "func (er *BufferedExchangeReporter) Stop() {\n\n}", "func (k *Kinsumer) Stop() {\n\tk.stoprequest <- true\n\tk.mainWG.Wait()\n}", "func (l *Learner) Stop() {\n\tl.stop <- true\n}", "func (a *LogAgent) Stop() (err error) {\n\ta.stopOnce.Do(func() {\n\t\terr = a.pipeline.Stop()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t})\n\treturn\n}", "func (g *Group) Stop() {\n\tif g.Total > len(g.threads) {\n\t\tdefer close(g.chanStop)\n\t\tg.chanStop <- true\n\t}\n\n\tfor _, ok := range g.threads {\n\t\tok.Stop()\n\t}\n}", "func (sm *SinkManager) Stop() {\n\tsm.stopOnce.Do(func() {\n\t\tclose(sm.doneChannel)\n\t\tsm.metrics.Stop()\n\t\tsm.sinks.DeleteAll()\n\t})\n}", "func (t *TCPTest) Stop() {\n\tt.exit<-struct{}{}\n}", "func (r *Reporter) Stop() {\n\tr.elapsed = time.Since(r.startAt)\n\tr.Report()\n\tos.Exit(0)\n}", "func (l *Learner) Stop() {\n\t//TODO(student): Task 3 - distributed implementation\n}", "func (t *Tailer) Stop() {\n\tatomic.StoreInt32(&t.didFileRotate, 0)\n\tt.stop <- struct{}{}\n\tt.source.RemoveInput(t.path)\n\t// wait for the decoder to be flushed\n\t<-t.done\n}", "func (s Server) Stop() {\n\tclose(s.fetcher)\n\ts.source.Close()\n}", "func Stop() {\n\ts.Stop()\n}", "func (s *Stopper) Stop() {\n\tclose(s.stopper)\n\ts.wg.Wait()\n}", "func (c *consumerImpl) Stop() {\n\tc.logger.Info(\"Stopping consumer\")\n\tc.cancelFunc()\n\tc.consumerHandler.stop()\n}", "func (s *maxEPSSampler) Stop() {\n\ts.reportDone <- true\n\t<-s.reportDone\n\n\ts.rateCounter.Stop()\n}", "func (lt *Logtailer) Stop() {\n\tclose(lt.shutdown)\n}", "func (s *EBPFSocketInfoEnhancer) Stop() {\n\ts.tracer.Stop()\n}", "func (i *Batch) Stop() (err error) {\n\tif i.isRun {\n\t\ti.stopChan <- true\n\t} else {\n\t\terr = errors.New(\"failed to stop, batch already stopped\")\n\t}\n\treturn\n}", "func (d *dispatcher) Stop() {\n\tclose(d.inCh)\n}", "func (t *Tracker) Stop() {\n\tt.Finish = time.Now()\n\tt.Duration = time.Since(t.Run)\n}", "func (b *BTCVanity) Stop() {\n\tb.stop <- true\n}", "func (b *BTCVanity) Stop() {\n\tb.stop <- true\n}", "func (p *literalProcessor) stop() { syncClose(p.done) }", "func (w *eventCollector) stop(t *testing.T) Events {\n\treturn w.stopWait(t, time.Second)\n}", "func (p *Poller) Stop() {\n\twg := &sync.WaitGroup{}\n\twg.Add(1)\n\tp.Shutdown <- wg\n\twg.Wait()\n}", "func (d *Driver) Stop() error {\n\treturn nil\n}", "func (p *Pipe) Stop() {\n\tif !p.stoppable {\n\t\treturn\n\t}\n\tPipeRegistry().Delete(p.registryID)\n\tclose(p.terminate)\n\tgo func() {\n\t\tp.listenerMU.RLock()\n\t\tif p.listener != nil {\n\t\t\tp.listener.Close()\n\t\t}\n\t\tp.listenerMU.RUnlock()\n\n\t\t// close all clients connections\n\t\tp.clientsMapMU.Lock()\n\t\tfor k, v := range p.clientsMap {\n\t\t\tv.Close()\n\t\t\tdelete(p.clientsMap, k)\n\t\t}\n\t\tp.clientsMapMU.Unlock()\n\t}()\n}", "func (s *Stopper) Stop() {\n\tclose(s.shouldStopC)\n\ts.wg.Wait()\n}", "func (f *Fetcher) Stop() {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\tf.cancel()\n}" ]
[ "0.8214492", "0.7792185", "0.74716896", "0.7078853", "0.7061585", "0.7058037", "0.70358753", "0.7024886", "0.70175046", "0.6925726", "0.6919977", "0.68957543", "0.689342", "0.68918055", "0.6859882", "0.6839737", "0.6836054", "0.68354684", "0.6822285", "0.6815464", "0.677485", "0.6774848", "0.67590934", "0.67566633", "0.67495143", "0.67418134", "0.674074", "0.6734606", "0.6727515", "0.6715361", "0.66888684", "0.6666871", "0.6664183", "0.66641325", "0.666261", "0.66580105", "0.66545135", "0.66539896", "0.66522443", "0.6620131", "0.6615079", "0.6596774", "0.65966684", "0.6568956", "0.65653366", "0.6564443", "0.6559028", "0.6558939", "0.65587825", "0.6557336", "0.65512824", "0.6545289", "0.6544954", "0.654474", "0.65426177", "0.6541626", "0.6524535", "0.65229917", "0.65010244", "0.64930576", "0.6491232", "0.6491232", "0.6490643", "0.6485283", "0.6480697", "0.6477199", "0.64728427", "0.64638615", "0.64623255", "0.6453761", "0.64461994", "0.6442662", "0.64415467", "0.6437651", "0.6433363", "0.6427419", "0.64268553", "0.6425841", "0.6419884", "0.64197594", "0.6409737", "0.6407315", "0.6406361", "0.6400424", "0.6397008", "0.63923377", "0.63916045", "0.63861674", "0.63829494", "0.63750744", "0.6363991", "0.63559806", "0.63559806", "0.63531035", "0.6352639", "0.63522404", "0.63516504", "0.63507354", "0.6342855", "0.6342079" ]
0.7611308
2
NewRemoteCollector creates a collector that sends data to a collector server (created with NewServer). It sends data immediately when Collect is called. To send data in chunks, use a ChunkedCollector.
func NewRemoteCollector(addr string) *RemoteCollector { return &RemoteCollector{ addr: addr, dial: func() (net.Conn, error) { return net.Dial("tcp", addr) }, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewRemoteAmboyStatsCollector(env cedar.Environment, id string) amboy.Job {\n\tj := makeAmboyStatsCollector()\n\tj.ExcludeLocal = true\n\tj.env = env\n\tj.SetID(fmt.Sprintf(\"%s-%s\", amboyStatsCollectorJobName, id))\n\treturn j\n}", "func NewCollector() *Collector {\n\tcollector := &Collector{\n\t\tresults: make(chan interface{}, 100),\n\t\tdone: make(chan interface{}),\n\t}\n\tgo collector.process()\n\treturn collector\n}", "func NewCollector(config *CollectorConfig) (Collector, error) {\n\tc := &standardCollector{\n\t\trunning: true,\n\t\tevents: make(chan Event, config.EventBufferSize),\n\t\tconfig: config,\n\t\tneighbors: make(map[string]neighbor),\n\t\tRWMutex: &sync.RWMutex{},\n\t}\n\n\treturn c, nil\n}", "func NewCollector(period time.Duration, collectFunc func() []Measurement) *Collector {\n\tcollector := &Collector{\n\t\tperiod: period,\n\t\tcollectFunc: collectFunc,\n\t\tlastSendingDate: -1,\n\t}\n\n\tif sources == nil {\n\t\tsources = make([]DataSource, 0)\n\t\tgo sendingLoop()\n\t}\n\n\tif UseGlobalEngine {\n\t\tcollector.Engine = Engine\n\t} else {\n\t\tcollector.Engine = &req.Engine{}\n\t}\n\n\tsources = append(sources, collector)\n\n\treturn collector\n}", "func NewCollector() collector.RPCCollector {\n\treturn &interfaceCollector{}\n}", "func NewCollector(store *store.MemoryStore) *Collector {\n\treturn &Collector{\n\t\tstore: store,\n\t\tstopChan: make(chan struct{}),\n\t\tdoneChan: make(chan struct{}),\n\t}\n}", "func NewCollector() Collector {\n\treturn Collector{client: NewClient(time.Second * 5)}\n}", "func NewTLSRemoteCollector(addr string, tlsConfig *tls.Config) *RemoteCollector {\n\treturn &RemoteCollector{\n\t\taddr: addr,\n\t\tdial: func() (net.Conn, error) {\n\t\t\treturn tls.Dial(\"tcp\", addr, tlsConfig)\n\t\t},\n\t}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &vpwsCollector{}\n}", "func NewCollector(username string, token string, source string, timeout time.Duration, waitGroup *sync.WaitGroup) Collector {\n\treturn &collector{\n\t\turl: metricsEndpont,\n\t\tusername: username,\n\t\ttoken: token,\n\t\tsource: source,\n\t\ttimeout: timeout,\n\n\t\thttpClient: &http.Client{\n\t\t\tTimeout: time.Second * 30,\n\t\t},\n\t\twaitGroup: waitGroup,\n\t\tstop: make(chan bool),\n\t\tbuffer: make(chan gauge, 10000),\n\t}\n}", "func NewCollector() *Collector {\n\twg := &sync.WaitGroup{}\n\tevtCh := make(chan *eventsapi.ClientEvent, collChanBufferSize)\n\n\tc := &Collector{&atomic.Value{}, wg, evtCh}\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\n\t\tvar events []*eventsapi.ClientEvent\n\t\tfor evt := range evtCh {\n\t\t\tevents = append(events, evt)\n\t\t}\n\n\t\tc.val.Store(events)\n\t}()\n\n\treturn c\n}", "func NewCollector(client *api.Client, collectSnaphots, collectNetwork bool) prometheus.Collector {\n\treturn &VMCollector{client: client, collectSnapshots: collectSnaphots, collectNetwork: collectNetwork}\n}", "func NewServer(l net.Listener, c Collector) *CollectorServer {\n\tcs := &CollectorServer{c: c, l: l}\n\treturn cs\n}", "func NewCollector(l *logrus.Entry, updateInterval time.Duration) *Collector {\n\tcol := &Collector{\n\t\tMsgEvtChan: make(chan *discordgo.Message, 1000),\n\t\tinterval: updateInterval,\n\t\tl: l,\n\t\tchannels: make(map[int64]*entry),\n\t}\n\n\tgo col.run()\n\n\treturn col\n}", "func NewCollector() collector.RPCCollector {\n\treturn &storageCollector{}\n}", "func NewCollector() Collector {\n\treturn make(Collector)\n}", "func NewCollector(config *Config) (coll *Collector, err error) {\n\tvar gelfWriter *gelf.Writer\n\n\tif gelfWriter, err = gelf.NewWriter(config.Graylog.Address); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcoll = new(Collector)\n\tcoll.writer = gelfWriter\n\tcoll.host = config.Collector.Hostname\n\n\treturn coll, nil\n}", "func NewCollector(rcClientId string, kubernetesClusterId string) TelemetryCollector {\n\treturn &telemetryCollector{\n\t\tclient: httputils.NewResetClient(httpClientResetInterval, httpClientFactory(httpClientTimeout)),\n\t\thost: utils.GetMainEndpoint(config.Datadog, mainEndpointPrefix, mainEndpointUrlKey),\n\t\tuserAgent: \"Datadog Cluster Agent\",\n\t\trcClientId: rcClientId,\n\t\tkubernetesClusterId: kubernetesClusterId,\n\t}\n}", "func NewCollector(api API) *Collector {\n\treturn &Collector{api: api}\n}", "func NewCollector(cl client.Client) prometheus.Collector {\n\treturn &collector{\n\t\tcl: cl,\n\t}\n}", "func NewCollector(logicalSystem string) collector.RPCCollector {\n\treturn &bgpCollector{LogicalSystem: logicalSystem}\n}", "func New() *Collector { return &Collector{} }", "func NewLocalCollector(s Store) Collector {\n\treturn s\n}", "func NewCollector(\n\tlogger *log.Logger, server lxd.InstanceServer) prometheus.Collector {\n\treturn &collector{logger: logger, server: server}\n}", "func NewRemote(ctx context.Context, conn *grpc.ClientConn) Subjects {\n\treturn &remote{\n\t\tclient: NewServiceClient(conn),\n\t}\n}", "func NewCollector(storageLocation v1.StorageLocation, gitter gits.Gitter, gitKind string) (Collector, error) {\n\tclassifier := storageLocation.Classifier\n\tif classifier == \"\" {\n\t\tclassifier = \"default\"\n\t}\n\tgitURL := storageLocation.GitURL\n\tif gitURL != \"\" {\n\t\treturn NewGitCollector(gitter, gitURL, storageLocation.GetGitBranch(), gitKind)\n\t}\n\tbucketProvider, err := factory.NewBucketProviderFromTeamSettingsConfigurationOrDefault(clients.NewFactory(), storageLocation)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"there was a problem obtaining the bucket provider from cluster configuratio\")\n\t}\n\treturn NewBucketCollector(storageLocation.BucketURL, classifier, bucketProvider)\n}", "func NewCollector() collector.RPCCollector {\n\treturn &environmentCollector{}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &environmentCollector{}\n}", "func NewCollector(brokerURL string, s storage.Storage) *Collector {\n\tbroker, err := NewBroker(brokerURL)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tch, err := broker.Channel()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_, err = ch.QueueDeclare(\n\t\tspecsQueueName, // name\n\t\ttrue, // durable\n\t\tfalse, // delete when usused\n\t\tfalse, // exclusive\n\t\tfalse, // noWait\n\t\tnil, // arguments\n\t)\n\n\tdc, _ := ch.Consume(\n\t\tspecsQueueName, // queue\n\t\t\"\", // consumer\n\t\ttrue, // auto-ack\n\t\tfalse, // exclusive\n\t\tfalse, // no-local\n\t\tfalse, // no-wait\n\t\tnil, // args\n\t)\n\n\treturn &Collector{broker, ch, dc, s}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &isisCollector{}\n}", "func NewCollector(store *forensicstore.ForensicStore, tempDir string, definitions []goartifacts.ArtifactDefinition) (*LiveCollector, error) {\n\tprovidesMap := map[string][]goartifacts.Source{}\n\n\tdefinitions = goartifacts.FilterOS(definitions)\n\n\tfor _, definition := range definitions {\n\t\tfor _, source := range definition.Sources {\n\t\t\tfor _, provide := range source.Provides {\n\t\t\t\tkey := strings.TrimPrefix(provide.Key, \"environ_\")\n\t\t\t\tif providingSources, ok := providesMap[key]; !ok {\n\t\t\t\t\tprovidesMap[key] = []goartifacts.Source{source}\n\t\t\t\t} else {\n\t\t\t\t\tprovidesMap[key] = append(providingSources, source)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsourceFS, err := systemfs.New()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"system fs creation failed: %w\", err)\n\t}\n\n\treturn &LiveCollector{\n\t\tSourceFS: sourceFS,\n\t\tregistryfs: registryfs.New(),\n\t\tStore: store,\n\t\tTempDir: tempDir,\n\t\tprovidesMap: providesMap,\n\t\tknowledgeBase: map[string][]string{},\n\t}, nil\n}", "func NewCollector(cfg *config.AgentConfig) TelemetryCollector {\n\tif !cfg.TelemetryConfig.Enabled {\n\t\treturn &noopTelemetryCollector{}\n\t}\n\n\tvar endpoints []config.Endpoint\n\tfor _, endpoint := range cfg.TelemetryConfig.Endpoints {\n\t\tu, err := url.Parse(endpoint.Host)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tu.Path = \"/api/v2/apmtelemetry\"\n\t\tendpointWithPath := *endpoint\n\t\tendpointWithPath.Host = u.String()\n\n\t\tendpoints = append(endpoints, endpointWithPath)\n\t}\n\n\treturn &telemetryCollector{\n\t\tclient: cfg.NewHTTPClient(),\n\t\tendpoints: endpoints,\n\t\tuserAgent: fmt.Sprintf(\"Datadog Trace Agent/%s/%s\", cfg.AgentVersion, cfg.GitCommit),\n\n\t\tcfg: cfg,\n\t\tcollectedStartupError: &atomic.Bool{},\n\t}\n}", "func NewRemote() (Catalog, error) {\n\treturn newRemoteFunc()\n}", "func NewCollector(config CollectorConfig, rawConfig *common.Config) (*Collector, error) {\n\n\t// Compile the configured pattern\n\tpattern, err := regexp.Compile(config.Pattern)\n\tif err != nil {\n\t\tlogp.Warn(\"Unable to parse regular expression: %s\", err)\n\t\treturn nil, err\n\t}\n\n\t// Create our Collector with its channel signals\n\tcollector := Collector{\n\t\tPattern: pattern,\n\t\tconfig: config,\n\n\t\tprospectorDone: make(chan struct{}),\n\t\tlines: make(chan string),\n\t\tDone: make(chan struct{}),\n\t\tStopped: make(chan struct{}),\n\t}\n\n\t// Initialize our ticker for handling timeouts\n\tif config.Timeout.Interval > 0 {\n\t\t// If a timeout is set then create a new ticker and save wrap its channel with a variable\n\t\tcollector.ticker = time.NewTicker(config.Timeout.Interval)\n\t\tcollector.timeoutChannel = collector.ticker.C\n\t} else {\n\t\t// If a timeout is not set then create just a generic channel that will never return.\n\t\t// It just makes generalizing the code easier.\n\t\tcollector.timeoutChannel = make(chan time.Time)\n\t}\n\n\t// Configure a new FileBeat Prospector with our rawConfig that will send it's data to a\n\t// CollectorOutleter\n\tp, err := prospector.NewProspector(\n\t\trawConfig,\n\t\tcollector.collectorOutleterFactory,\n\t\tcollector.prospectorDone,\n\t\t[]file.State{},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcollector.prospector = p\n\treturn &collector, nil\n}", "func New(client *statsd.Client, interval time.Duration) *Collector {\n\treturn &Collector{\n\t\tinterval: interval,\n\t\tclient: client,\n\t\tdone: make(chan struct{}),\n\t}\n}", "func NewCollector(cfg *config.AgentConfig, ctx context.Context) (Collector, error) {\n\tsysInfo, err := checks.CollectSystemInfo(cfg)\n\tif err != nil {\n\t\treturn Collector{}, err\n\t}\n\n\tenabledChecks := make([]checks.Check, 0)\n\tfor _, c := range checks.All {\n\t\tif cfg.CheckIsEnabled(c.Name()) {\n\t\t\tc.Init(cfg, sysInfo)\n\t\t\tenabledChecks = append(enabledChecks, c)\n\t\t}\n\t}\n\n\treturn NewCollectorWithChecks(cfg, enabledChecks, ctx), nil\n}", "func NewCollector(bindIP, port string) (*SyslogCollector, error) {\n\tdefer TRA(CE())\n\tchannel := make(syslog.LogPartsChannel)\n\tsysServ := syslog.NewServer()\n\tsysServ.SetHandler(syslog.NewChannelHandler(channel))\n\t// uses RFC3164 because it is default for rsyslog\n\tsysServ.SetFormat(syslog.RFC3164)\n\terr := sysServ.ListenUDP(fmt.Sprintf(\"%s:%s\", bindIP, port))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func(channel syslog.LogPartsChannel) {\n\t\tfor logEntry := range channel {\n\t\t\tinfo, err := ctl.NewHostInfo()\n\t\t\tif err != nil {\n\t\t\t\tinfo = &ctl.HostInfo{}\n\t\t\t}\n\t\t\tevent, err := ctl.NewEvent(logEntry, *info)\n\t\t\tif err != nil {\n\t\t\t\tErrorLogger.Printf(\"cannot format syslog entry: %s\\n\", err)\n\t\t\t}\n\t\t\terr = event.Save(SubmitPath())\n\t\t\tif err != nil {\n\t\t\t\tErrorLogger.Printf(\"cannot save syslog entry to file: %s\\n\", err)\n\t\t\t}\n\t\t}\n\t}(channel)\n\treturn &SyslogCollector{\n\t\tserver: sysServ,\n\t\tport: port,\n\t}, nil\n}", "func New(computeAPI ComputeAPI, dnsAPI DNSAPI, removalPredicate IPAddressRemovalPredicate) *Collector {\n\treturn &Collector{computeAPI, dnsAPI, removalPredicate}\n}", "func NewCollector(apiKey, hmacKey string) (*Collector, error) {\n\thmacKeyBuf, err := hex.DecodeString(hmacKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing hmac key: %v\", err)\n\t}\n\tbaseURL := IngestionBaseURL\n\thost := os.Getenv(\"EI_HOST\")\n\tif host == \"localhost\" {\n\t\tbaseURL = \"http://localhost:4810\"\n\t} else if strings.HasSuffix(host, \"test.edgeimpulse.com\") {\n\t\tbaseURL = \"http://ingestion.\" + host\n\t} else if strings.HasSuffix(host, \"edgeimpulse.com\") {\n\t\tbaseURL = \"https://ingestion.\" + host\n\t}\n\tc := &Collector{http.DefaultClient, baseURL, hmacKeyBuf, apiKey}\n\treturn c, nil\n}", "func New() Collector {\n\treturn &collector{\n\t\tinner: sigar.ConcreteSigar{},\n\t}\n}", "func NewCollect() *cobra.Command {\n\tcollectOptions := newCollectOptions()\n\n\tcmd := &cobra.Command{\n\t\tUse: \"collect\",\n\t\tShort: \"Obtain all the data of the current node\",\n\t\tLong: edgecollectLongDescription,\n\t\tExample: edgecollectExample,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\terr := ExecuteCollect(collectOptions)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t},\n\t}\n\tcmd.AddCommand()\n\taddCollectOtherFlags(cmd, collectOptions)\n\treturn cmd\n}", "func New(cfg Collector, nodeInfo collectors.NodeInfo, rels *ContainerTaskRels) (Collector, chan producers.MetricsMessage) {\n\tc := cfg\n\tc.log = logrus.WithFields(logrus.Fields{\"collector\": \"mesos-agent\"})\n\tc.nodeInfo = nodeInfo\n\tc.metricsChan = make(chan producers.MetricsMessage)\n\tc.ContainerTaskRels = rels\n\treturn c, c.metricsChan\n}", "func NewCollectServer(cfg *ServerConfig) *CollectServer {\n\tserver := &CollectServer{Config: cfg}\n\tlogger := logrus.New()\n\tlogger.Out = cfg.LogCfg.Output\n\tlogger.Level = cfg.LogCfg.Level\n\tlogger.Formatter = cfg.LogCfg.Format\n\tserver.Logger = logger\n\treturn server\n}", "func NewStatsCollector(cliContext *cli.Context) (*StatsCollector, error) {\n\n\t// fill the Collector struct\n\tcollector := &StatsCollector{\n\t\tcliContext: cliContext,\n\t\tsocketPath: cliContext.String(\"socketPath\"),\n\t\tkamailioHost: cliContext.String(\"host\"),\n\t\tkamailioPort: cliContext.Int(\"port\"),\n\t}\n\n\t// fine, return the created object struct\n\treturn collector, nil\n}", "func NewCollector() (prometheus.Collector, error) {\n\treturn &collector{}, nil\n}", "func NewCollector(dyno *Dynomite) *Collector {\n\treturn &Collector{\n\t\tdyno: dyno,\n\t\tstate: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_state\",\n\t\t\t\t\"State as reported by Dynomite.\",\n\t\t\t\t[]string{\"state\", \"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tdbSize: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_db_size\",\n\t\t\t\t\"Key database size as reported by the Redis backend.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tuptime: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_uptime\",\n\t\t\t\t\"Uptime as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tclientConnections: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_client_connections\",\n\t\t\t\t\"Client connections as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tclientReadRequests: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_client_read_requests\",\n\t\t\t\t\"Client read requests as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tclientWriteRequests: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_client_write_requests\",\n\t\t\t\t\"Client write requests as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t\tclientDroppedRequests: typedDesc{\n\t\t\tdesc: prometheus.NewDesc(\n\t\t\t\t\"dynomite_client_dropped_requests\",\n\t\t\t\t\"Client dropped requests as reported by Dynomite info.\",\n\t\t\t\t[]string{\"rack\", \"dc\", \"token\", \"ip_address\"}, nil),\n\t\t\tvalueType: prometheus.GaugeValue,\n\t\t},\n\t}\n}", "func NewVMwareCollector(ctx *pulumi.Context,\n\tname string, args *VMwareCollectorArgs, opts ...pulumi.ResourceOption) (*VMwareCollector, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ProjectName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ProjectName'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:migrate:VMwareCollector\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:migrate/v20191001:VMwareCollector\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:migrate/v20191001:VMwareCollector\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource VMwareCollector\n\terr := ctx.RegisterResource(\"azure-native:migrate:VMwareCollector\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (o *PostAutoDiscoveryPingsweepParams) SetRemoteCollectorID(remoteCollectorID *int64) {\n\to.RemoteCollectorID = remoteCollectorID\n}", "func newMemoryConnection(\n\tlogger log.Logger,\n\tlocalID types.NodeID,\n\tremoteID types.NodeID,\n\treceiveCh <-chan memoryMessage,\n\tsendCh chan<- memoryMessage,\n) *MemoryConnection {\n\treturn &MemoryConnection{\n\t\tlogger: logger.With(\"remote\", remoteID),\n\t\tlocalID: localID,\n\t\tremoteID: remoteID,\n\t\treceiveCh: receiveCh,\n\t\tsendCh: sendCh,\n\t}\n}", "func NewFileCollector(config []byte) (Collector, error) {\n\tslaunch.Debug(\"New Files Collector initialized\\n\")\n\tvar fc = new(FileCollector)\n\terr := json.Unmarshal(config, &fc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn fc, nil\n}", "func NewCollector(cm *clientmanager.ClientManager) prometheus.Collector {\n\treturn &grpcClientManagerCollector{\n\t\tcm: cm,\n\t}\n}", "func (c *ClusterScalingScheduleCollectorPlugin) NewCollector(hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (Collector, error) {\n\treturn NewClusterScalingScheduleCollector(c.store, c.defaultScalingWindow, c.defaultTimeZone, c.rampSteps, c.now, hpa, config, interval)\n}", "func newPoolCollector(config monitoring.MetricsConfig, logger *zap.Logger,\n\tspectrumClient spectrumservice.Client) (Collector, error) {\n\n\tlabelPool := []string{\"pool_name\", \"storage_system\"}\n\n\tproperties := make(map[string]*prometheus.Desc)\n\n\tfor _, p := range config.Metrics.Pools.Properties {\n\t\tproperties[p.PropertyName] = prometheus.NewDesc(p.PrometheusName, p.PrometheusHelp, labelPool, nil)\n\t}\n\n\treturn &poolCollector{\n\t\tibmSpectrumClient: spectrumClient,\n\t\tlogger: logger.Sugar(),\n\t\tproperties: properties,\n\t}, nil\n}", "func NewLocalAmboyStatsCollector(env cedar.Environment, id string) amboy.Job {\n\tj := makeAmboyStatsCollector()\n\tj.ExcludeRemote = true\n\tj.env = env\n\tj.SetID(fmt.Sprintf(\"%s-%s\", amboyStatsCollectorJobName, id))\n\treturn j\n}", "func NewFileCollector(name string, limit Size, pipe bool) File {\n\treturn &FileCollector{Name: name, Limit: limit, Pipe: pipe}\n}", "func NewCollector(url, token, xSecret string) (*Collector, error) {\n\tc := Collector{}\n\n\tif url == \"\" {\n\t\treturn nil, fmt.Errorf(\"URL should not be empty\")\n\t}\n\tc.dadataAPIURL = url\n\tif token == \"\" {\n\t\treturn nil, fmt.Errorf(\"Token should not be empty. Please specify it via DADATA_TOKEN env var\")\n\t}\n\tc.dadataToken = token\n\tif xSecret == \"\" {\n\t\treturn nil, fmt.Errorf(\"X-Secret should not be empty. Please specify it via DADATA_X_SECRET env var\")\n\t}\n\tc.dadataXSecret = xSecret\n\n\terr := c.dadataCheck()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.totalScrapes = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tName: \"exporter_scrapes_total\",\n\t\tHelp: \"Count of total scrapes\",\n\t})\n\n\tc.failedBalanceScrapes = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tName: \"exporter_failed_balance_scrapes_total\",\n\t\tHelp: \"Count of failed balance scrapes\",\n\t})\n\n\tc.failedStatsScrapes = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tName: \"exporter_failed_stats_scrapes_total\",\n\t\tHelp: \"Count of failed stats scrapes\",\n\t})\n\n\tc.CurrentBalance = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tName: \"current_balance\",\n\t\tHelp: \"Current balance on Dadata\",\n\t})\n\n\tc.ServicesMerging = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: \"services\",\n\t\tName: \"merging_total\",\n\t\tHelp: \"Merging count for today\",\n\t})\n\n\tc.ServicesSuggestions = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: \"services\",\n\t\tName: \"suggestions_total\",\n\t\tHelp: \"Suggestions count for today\",\n\t})\n\n\tc.ServicesClean = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: \"services\",\n\t\tName: \"clean_total\",\n\t\tHelp: \"Clean count for today\",\n\t})\n\n\treturn &c, nil\n}", "func new(config map[string]any, endpoint *fd.FD) (seccheck.Sink, error) {\n\tif endpoint == nil {\n\t\treturn nil, fmt.Errorf(\"remote sink requires an endpoint\")\n\t}\n\tr := &remote{\n\t\tendpoint: endpoint,\n\t\tinitialBackoff: 25 * time.Microsecond,\n\t\tmaxBackoff: 10 * time.Millisecond,\n\t}\n\tif retriesOpaque, ok := config[\"retries\"]; ok {\n\t\tretries, ok := retriesOpaque.(float64)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"retries %q is not an int\", retriesOpaque)\n\t\t}\n\t\tr.retries = int(retries)\n\t\tif float64(r.retries) != retries {\n\t\t\treturn nil, fmt.Errorf(\"retries %q is not an int\", retriesOpaque)\n\t\t}\n\t}\n\tif ok, backoff, err := parseDuration(config, \"backoff\"); err != nil {\n\t\treturn nil, err\n\t} else if ok {\n\t\tr.initialBackoff = backoff\n\t}\n\tif ok, backoff, err := parseDuration(config, \"backoff_max\"); err != nil {\n\t\treturn nil, err\n\t} else if ok {\n\t\tr.maxBackoff = backoff\n\t}\n\tif r.initialBackoff > r.maxBackoff {\n\t\treturn nil, fmt.Errorf(\"initial backoff (%v) cannot be larger than max backoff (%v)\", r.initialBackoff, r.maxBackoff)\n\t}\n\n\tlog.Debugf(\"Remote sink created, endpoint FD: %d, %+v\", r.endpoint.FD(), r)\n\treturn r, nil\n}", "func NewRemote(v gointerfaces.Version, logger log.Logger, remoteKV remote.KVClient) remoteOpts {\n\treturn remoteOpts{bucketsCfg: mdbx.WithChaindataTables, version: v, log: logger, remoteKV: remoteKV}\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 (c *ScalingScheduleCollectorPlugin) NewCollector(hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (Collector, error) {\n\treturn NewScalingScheduleCollector(c.store, c.defaultScalingWindow, c.defaultTimeZone, c.rampSteps, c.now, hpa, config, interval)\n}", "func NewVaultCollector() (Collector, error) {\n\taddr := os.Getenv(\"VAULT_ADDR\")\n\tcaCert := os.Getenv(\"VAULT_CACERT\")\n\tcaPath := os.Getenv(\"VAULT_CAPATH\")\n\tserverName := \"\"\n\tif addr != \"\" {\n\t\turl, err := url.Parse(addr)\n\t\tif err != nil {\n\t\t\treturn nil, maskAny(err)\n\t\t}\n\t\thost, _, err := net.SplitHostPort(url.Host)\n\t\tif err != nil {\n\t\t\treturn nil, maskAny(err)\n\t\t}\n\t\tserverName = host\n\t}\n\tvar certPool *x509.CertPool\n\tif caCert != \"\" || caPath != \"\" {\n\t\tvar err error\n\t\tif caCert != \"\" {\n\t\t\tlog.Debugf(\"Loading CA cert: %s\", caCert)\n\t\t\tcertPool, err = LoadCACert(caCert)\n\t\t} else {\n\t\t\tlog.Debugf(\"Loading CA certs from: %s\", caPath)\n\t\t\tcertPool, err = LoadCAPath(caPath)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, maskAny(err)\n\t\t}\n\t}\n\n\ttransport := cleanhttp.DefaultTransport()\n\ttransport.Proxy = nil\n\ttransport.TLSClientConfig = &tls.Config{\n\t\tServerName: serverName,\n\t\tRootCAs: certPool,\n\t\t//InsecureSkipVerify: true,\n\t}\n\tclient := &http.Client{\n\t\tTransport: transport,\n\t}\n\tc := &vaultCollector{\n\t\taddress: addr,\n\t\tclient: client,\n\t\tvaultUnsealedDesc: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(vaultNamespace, \"\", \"server_unsealed\"),\n\t\t\t\"Vault unseal status (1=unsealed, 0=sealed)\", []string{\"address\"}, nil,\n\t\t),\n\t\tstatus: make(map[string]float64),\n\t}\n\tgo c.updateStatusLoop()\n\treturn c, nil\n}", "func newCollectionStatsCollector(ctx context.Context, client *mongo.Client, logger *logrus.Logger, compatible, discovery bool, topology labelsGetter, collections []string) *collstatsCollector {\n\treturn &collstatsCollector{\n\t\tctx: ctx,\n\t\tbase: newBaseCollector(client, logger),\n\n\t\tcompatibleMode: compatible,\n\t\tdiscoveringMode: discovery,\n\t\ttopologyInfo: topology,\n\n\t\tcollections: collections,\n\t}\n}", "func NewHTTPCollector(url string, options ...HTTPOption) (Collector, error) {\n\tc := &HTTPCollector{\n\t\tlogger: NewNopLogger(),\n\t\turl: url,\n\t\tclient: &http.Client{Timeout: defaultHTTPTimeout},\n\t\tbatchInterval: defaultHTTPBatchInterval * time.Second,\n\t\tbatchSize: defaultHTTPBatchSize,\n\t\tbatch: []*zipkincore.Span{},\n\t\tspanc: make(chan *zipkincore.Span, defaultHTTPBatchSize),\n\t\tquit: make(chan struct{}, 1),\n\t\tshutdown: make(chan error, 1),\n\t\tbatchPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn make([]*zipkincore.Span, 0, defaultHTTPBatchSize)\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\tgo c.loop()\n\treturn c, nil\n}", "func NewInfluxCollector(user, pass, addr string) (Collector, error) {\n\tc, err := client.NewHTTPClient(client.HTTPConfig{\n\t\tAddr: addr,\n\t\tUsername: user,\n\t\tPassword: pass,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinput := make(chan Collectable, 10)\n\n\tic := &InfluxCollector{\n\t\tclient: c,\n\t\tlock: &sync.RWMutex{},\n\t\tinput: input,\n\t\tlogger: log.Logger(context.Background()).Named(\"collector_influx\"),\n\t\t// TODO fix the point aggregation and find a sane batch size\n\t\tbatchSize: 1,\n\t\tbatchConfig: client.BatchPointsConfig{\n\t\t\tDatabase: databaseName,\n\t\t\tPrecision: \"ns\",\n\t\t},\n\t\ttimeout: 1000 * time.Millisecond,\n\t}\n\n\t// Create the database\n\tif err := ic.createDB(databaseName); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Initialize the processor\n\tgo ic.processor(context.Background(), input)\n\n\treturn ic, nil\n}", "func NewCollector(defaultGroup string) *MemoryMetricsCollector {\n\treturn &MemoryMetricsCollector{defaultGroup: defaultGroup, metrics: make([]operation.MetricOperation, 0)}\n}", "func NewCollector(ctx context.Context, cc *collector.CollectorContext, collectDuration prometheus.Observer) prometheus.Collector {\n\treturn &StorageDomainCollector{\n\t\trootCtx: ctx,\n\t\tcc: cc,\n\t\tcollectDuration: collectDuration,\n\t}\n}", "func (c *SkipperCollectorPlugin) NewCollector(hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (Collector, error) {\n\tif strings.HasPrefix(config.Metric.Name, rpsMetricName) {\n\t\tbackend, ok := config.Config[\"backend\"]\n\t\tif !ok {\n\t\t\t// TODO: remove the deprecated way of specifying\n\t\t\t// optional backend at a later point in time.\n\t\t\tif len(config.Metric.Name) > len(rpsMetricName) {\n\t\t\t\tmetricNameParts := strings.Split(config.Metric.Name, rpsMetricBackendSeparator)\n\t\t\t\tif len(metricNameParts) == 2 {\n\t\t\t\t\tbackend = metricNameParts[1]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn NewSkipperCollector(c.client, c.rgClient, c.plugin, hpa, config, interval, c.backendAnnotations, backend)\n\t}\n\treturn nil, fmt.Errorf(\"metric '%s' not supported\", config.Metric.Name)\n}", "func (*noOpConntracker) Collect(ch chan<- prometheus.Metric) {}", "func New(config Config) (*Collector, error) {\n\tif config.Logger == nil {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"%T.Logger must not be empty\", config)\n\t}\n\n\tif config.IFace == \"\" {\n\t\treturn nil, microerror.Maskf(invalidConfigError, \"%T.IFace must not be empty\", config)\n\t}\n\n\tcollector := &Collector{\n\t\tiface: config.IFace,\n\t}\n\n\tnicStats, err := ethtool.Stats(collector.iface)\n\tif err != nil {\n\t\treturn nil, microerror.Mask(err)\n\t}\n\n\tcollector.metrics = make(map[string]*prometheus.Desc)\n\tfor label, _ := range nicStats {\n\t\tfqName := prometheus.BuildFQName(nic_metric_namespace, \"\", label)\n\t\tcollector.metrics[label] = prometheus.NewDesc(fqName, fmt.Sprintf(\"Generated description for metric %#q\", label), []string{\"iface\"}, nil)\n\t}\n\n\treturn collector, nil\n}", "func newRemoteLoggingClient(ctx context.Context, conn *grpc.ClientConn) (*remoteLoggingClient, error) {\n\tcl := protocol.NewLoggingClient(conn)\n\tstream, err := cl.ReadLogs(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Read the initial response to check success and make sure we have been\n\t// subscribed to logs.\n\tif _, err := stream.Recv(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tl := &remoteLoggingClient{\n\t\tstream: stream,\n\t\tdoneCh: make(chan struct{}),\n\t}\n\n\t// Start a goroutine to call logger for every received ReadLogsResponse.\n\tgo l.runBackground(ctx)\n\n\treturn l, nil\n}", "func NewNVMeCollector(logger log.Logger) (Collector, error) {\n\tfs, err := sysfs.NewFS(*sysPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open sysfs: %w\", err)\n\t}\n\n\treturn &nvmeCollector{\n\t\tfs: fs,\n\t\tlogger: logger,\n\t}, nil\n}", "func NewUpgradeCollector(c client.Client) (prometheus.Collector, error) {\n\tupgradeConfigManager, err := upgradeconfigmanager.NewBuilder().NewManager(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmanagedMetrics := bootstrapMetrics()\n\n\treturn &UpgradeCollector{\n\t\tupgradeConfigManager,\n\t\tcv.NewCVClient(c),\n\t\tmanagedMetrics,\n\t}, nil\n}", "func NewMultiCollector(collectors ...Collector) Collector {\n\tif len(collectors) == 1 {\n\t\treturn collectors[0]\n\t}\n\treturn MultiCollector(collectors)\n}", "func NewTChanCollectorServer(handler TChanCollector) thrift.TChanServer {\n\treturn &tchanCollectorServer{\n\t\thandler,\n\t}\n}", "func NewLibvirtCollector() *Libvirt {\n\treturn &Libvirt{}\n\n}", "func NewLocalRouterCollector(ctx context.Context, logger *slog.Logger, errors *prometheus.CounterVec, client platform.LocalRouterClient) *LocalRouterCollector {\n\terrors.WithLabelValues(\"local_router\").Add(0)\n\n\tlocalRouterLabels := []string{\"id\", \"name\"}\n\tlocalRouterInfoLabels := append(localRouterLabels, \"tags\", \"description\")\n\tlocalRouterSwitchInfoLabels := append(localRouterLabels, \"category\", \"code\", \"zone_id\")\n\tlocalRouterServerNetworkInfoLabels := append(localRouterLabels, \"vip\", \"ipaddress1\", \"ipaddress2\", \"nw_mask_len\", \"vrid\")\n\tlocalRouterPeerLabels := append(localRouterLabels, \"peer_index\", \"peer_id\")\n\tlocalRouterPeerInfoLabels := append(localRouterPeerLabels, \"enabled\", \"description\")\n\tlocalRouterStaticRouteInfoLabels := append(localRouterLabels, \"route_index\", \"prefix\", \"next_hop\")\n\n\treturn &LocalRouterCollector{\n\t\tctx: ctx,\n\t\tlogger: logger,\n\t\terrors: errors,\n\t\tclient: client,\n\t\tUp: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_up\",\n\t\t\t\"If 1 the LocalRouter is available, 0 otherwise\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t\tLocalRouterInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_info\",\n\t\t\t\"A metric with a constant '1' value labeled by localRouter information\",\n\t\t\tlocalRouterInfoLabels, nil,\n\t\t),\n\t\tSwitchInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_switch_info\",\n\t\t\t\"A metric with a constant '1' value labeled by localRouter connected switch information\",\n\t\t\tlocalRouterSwitchInfoLabels, nil,\n\t\t),\n\t\tNetworkInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_network_info\",\n\t\t\t\"A metric with a constant '1' value labeled by network information of the localRouter\",\n\t\t\tlocalRouterServerNetworkInfoLabels, nil,\n\t\t),\n\t\tPeerInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_peer_info\",\n\t\t\t\"A metric with a constant '1' value labeled by peer information\",\n\t\t\tlocalRouterPeerInfoLabels, nil,\n\t\t),\n\t\tPeerUp: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_peer_up\",\n\t\t\t\"If 1 the Peer is available, 0 otherwise\",\n\t\t\tlocalRouterPeerLabels, nil,\n\t\t),\n\t\tStaticRouteInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_static_route_info\",\n\t\t\t\"A metric with a constant '1' value labeled by static route information\",\n\t\t\tlocalRouterStaticRouteInfoLabels, nil,\n\t\t),\n\t\tReceiveBytesPerSec: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_receive_per_sec\",\n\t\t\t\"Receive bytes per seconds\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t\tSendBytesPerSec: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_send_per_sec\",\n\t\t\t\"Send bytes per seconds\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t}\n}", "func NewRGWCollector(exporter *Exporter, background bool) *RGWCollector {\n\tlabels := make(prometheus.Labels)\n\tlabels[\"cluster\"] = exporter.Cluster\n\n\trgw := &RGWCollector{\n\t\tconfig: exporter.Config,\n\t\tbackground: background,\n\t\tlogger: exporter.Logger,\n\t\tgetRGWGCTaskList: rgwGetGCTaskList,\n\n\t\tActiveTasks: prometheus.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: cephNamespace,\n\t\t\t\tName: \"rgw_gc_active_tasks\",\n\t\t\t\tHelp: \"RGW GC active task count\",\n\t\t\t\tConstLabels: labels,\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t\tActiveObjects: prometheus.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: cephNamespace,\n\t\t\t\tName: \"rgw_gc_active_objects\",\n\t\t\t\tHelp: \"RGW GC active object count\",\n\t\t\t\tConstLabels: labels,\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t\tPendingTasks: prometheus.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: cephNamespace,\n\t\t\t\tName: \"rgw_gc_pending_tasks\",\n\t\t\t\tHelp: \"RGW GC pending task count\",\n\t\t\t\tConstLabels: labels,\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t\tPendingObjects: prometheus.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: cephNamespace,\n\t\t\t\tName: \"rgw_gc_pending_objects\",\n\t\t\t\tHelp: \"RGW GC pending object count\",\n\t\t\t\tConstLabels: labels,\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t}\n\n\tif rgw.background {\n\t\t// rgw stats need to be collected in the background as this can take a while\n\t\t// if we have a large backlog\n\t\tgo rgw.backgroundCollect()\n\t}\n\n\treturn rgw\n}", "func NewCollector() collector.RPCCollector {\n\treturn &accountingCollector{}\n}", "func NewRemoteFlowProvider(config *util.ServiceConfig, embeddedFlowMgr *support.EmbeddedFlowManager) *RemoteFlowProvider {\n\n\tvar service RemoteFlowProvider\n\tservice.flowCache = make(map[string]*flowdef.Definition)\n\tservice.mutex = &sync.Mutex{}\n\tservice.enabled = config.Enabled\n\tservice.embeddedMgr = embeddedFlowMgr\n\treturn &service\n}", "func NewFileCollector() FileCollector {\n\treturn make(FileCollector)\n}", "func New(chainID, remote string) (provider.Provider, error) {\n\thttpClient, err := rpcclient.NewHTTP(remote, \"/websocket\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewWithClient(chainID, httpClient), nil\n}", "func NewRemoteReplicator(\n\tctx context.Context,\n\tchannel *ReplicatorChannel,\n\tstateMgr storage.StateManager,\n\tcliFct rpc.ClientStreamFactory,\n) Replicator {\n\tr := &remoteReplicator{\n\t\tctx: ctx,\n\t\treplicator: replicator{\n\t\t\tchannel: channel,\n\t\t},\n\t\tcliFct: cliFct,\n\t\tstateMgr: stateMgr,\n\t\tisSuspend: atomic.NewBool(false),\n\t\tsuspend: make(chan struct{}),\n\t\tstatistics: metrics.NewStorageRemoteReplicatorStatistics(channel.State.Database, channel.State.ShardID.String()),\n\t\tlogger: logger.GetLogger(\"Replica\", \"RemoteReplicator\"),\n\t}\n\tr.state.Store(&state{state: models.ReplicatorInitState, errMsg: \"replicator initialized\"})\n\n\t// watch follower node state change\n\tstateMgr.WatchNodeStateChangeEvent(channel.State.Follower, r.handleNodeStateChangeEvent)\n\n\tr.logger.Info(\"start remote replicator\", logger.String(\"replica\", r.String()))\n\treturn r\n}", "func New(logger logrus.FieldLogger, conf Config) (*Collector, error) {\n\tproducer, err := sarama.NewSyncProducer(conf.Brokers, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Collector{\n\t\tProducer: producer,\n\t\tConfig: conf,\n\t\tlogger: logger,\n\t}, nil\n}", "func New() *IpmiCollector {\n\tcollector := &IpmiCollector{Initialized: false}\n\treturn collector\n}", "func createRemoteReadServer(t *testing.T, seriesToBeSent []prompb.TimeSeries) (*remoteReadServer, string) {\n\ts := httptest.NewServer(getReadHandler(t, seriesToBeSent))\n\treturn &remoteReadServer{\n\t\tserver: s,\n\t\tseries: seriesToBeSent,\n\t}, s.URL\n}", "func NewMetricCollector(logger *zap.SugaredLogger) *MetricCollector {\n\tcollector := &MetricCollector{\n\t\tlogger: logger,\n\t\tcollections: make(map[string]*collection),\n\t}\n\n\treturn collector\n}", "func NewNFSCollector(g getNFSStats) *nfsCollector {\n\treturn &nfsCollector{\n\t\tg,\n\t}\n}", "func NewSyncCollector() *SyncCollector {\n\tso := SyncCollector{c: make(Collector)}\n\treturn &so\n}", "func (p *LightningPool) new(ctx context.Context) (*amqp.Channel, error) {\n\treturn p.conn.Channel(ctx)\n}", "func New() *CPUCollector {\n\tcpuMetrics := newCPUMetrics()\n\tcpuStats := cpuclient.New()\n\n\treturn &CPUCollector{\n\t\tcpuMetrics: cpuMetrics,\n\t\tcpuStats: cpuStats,\n\t}\n}", "func New(\n\tlogger logrus.FieldLogger,\n\tconf Config, src *loader.SourceData, opts lib.Options, executionPlan []lib.ExecutionStep, version string,\n) (*Collector, error) {\n\tif err := MergeFromExternal(opts.External, &conf); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif conf.AggregationPeriod.Duration > 0 && (opts.SystemTags.Has(stats.TagVU) || opts.SystemTags.Has(stats.TagIter)) {\n\t\treturn nil, errors.New(\"Aggregation cannot be enabled if the 'vu' or 'iter' system tag is also enabled\")\n\t}\n\n\tif !conf.Name.Valid || conf.Name.String == \"\" {\n\t\tconf.Name = null.StringFrom(filepath.Base(src.URL.String()))\n\t}\n\tif conf.Name.String == \"-\" {\n\t\tconf.Name = null.StringFrom(TestName)\n\t}\n\n\tthresholds := make(map[string][]*stats.Threshold)\n\tfor name, t := range opts.Thresholds {\n\t\tthresholds[name] = append(thresholds[name], t.Thresholds...)\n\t}\n\n\tduration, testEnds := lib.GetEndOffset(executionPlan)\n\tif !testEnds {\n\t\treturn nil, errors.New(\"tests with unspecified duration are not allowed when outputting data to k6 cloud\")\n\t}\n\n\tif !conf.Token.Valid && conf.DeprecatedToken.Valid {\n\t\tlogger.Warn(\"K6CLOUD_TOKEN is deprecated and will be removed. Use K6_CLOUD_TOKEN instead.\")\n\t\tconf.Token = conf.DeprecatedToken\n\t}\n\n\tif !(conf.MetricPushConcurrency.Int64 > 0) {\n\t\treturn nil, errors.Errorf(\"metrics push concurrency must be a positive number but is %d\",\n\t\t\tconf.MetricPushConcurrency.Int64)\n\t}\n\n\tif !(conf.MaxMetricSamplesPerPackage.Int64 > 0) {\n\t\treturn nil, errors.Errorf(\"metric samples per package must be a positive number but is %d\",\n\t\t\tconf.MaxMetricSamplesPerPackage.Int64)\n\t}\n\n\treturn &Collector{\n\t\tconfig: conf,\n\t\tthresholds: thresholds,\n\t\tclient: NewClient(logger, conf.Token.String, conf.Host.String, version),\n\t\tanonymous: !conf.Token.Valid,\n\t\texecutionPlan: executionPlan,\n\t\tduration: int64(duration / time.Second),\n\t\topts: opts,\n\t\taggrBuckets: map[int64]map[[3]string]aggregationBucket{},\n\t\tstopSendingMetricsCh: make(chan struct{}),\n\t\tlogger: logger,\n\t}, nil\n}", "func New(meta interface{}) *Broadcaster {\n\tlistenc := make(chan (chan (chan broadcast)))\n\tsendc := make(chan interface{})\n\tgo func() {\n\t\tcurrc := make(chan broadcast, 1)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase v, ok := <-sendc:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tc := make(chan broadcast, 1)\n\t\t\t\tb := broadcast{c: c, v: v}\n\t\t\t\tcurrc <- b\n\t\t\t\tcurrc = c\n\t\t\tcase r := <-listenc:\n\t\t\t\tr <- currc\n\t\t\t}\n\t\t}\n\t}()\n\treturn &Broadcaster{\n\t\tlistenc: listenc,\n\t\tSendc: sendc,\n\t\tvalueType: reflect.TypeOf(meta),\n\t}\n}", "func (t *OpenconfigSystem_System_Logging_RemoteServers) NewRemoteServer(Host string) (*OpenconfigSystem_System_Logging_RemoteServers_RemoteServer, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.RemoteServer == nil {\n\t\tt.RemoteServer = make(map[string]*OpenconfigSystem_System_Logging_RemoteServers_RemoteServer)\n\t}\n\n\tkey := Host\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.RemoteServer[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list RemoteServer\", key)\n\t}\n\n\tt.RemoteServer[key] = &OpenconfigSystem_System_Logging_RemoteServers_RemoteServer{\n\t\tHost: &Host,\n\t}\n\n\treturn t.RemoteServer[key], nil\n}", "func newAtlassianUPMCollector() *atlassianUPMCollector {\n\treturn &atlassianUPMCollector{\n\t\tatlassianUPMTimeMetric: prometheus.NewDesc(\n\t\t\tmetricNamespace+\"_collect_duration_seconds\",\n\t\t\t\"metric used to keep track of how long the \"+exporterName+\" took to Collect\",\n\t\t\t[]string{\n\t\t\t\t\"url\",\n\t\t\t},\n\t\t\tnil,\n\t\t),\n\t\tatlassianUPMUpMetric: prometheus.NewDesc(\n\t\t\tmetricNamespace+\"_rest_url_up\",\n\t\t\t\"metric used to check if the \"+exporterName+\" rest endpoint is accessible (https://<app.fqdn>/rest/plugins/1.0/), value is true if up\",\n\t\t\t[]string{\n\t\t\t\t\"url\",\n\t\t\t},\n\t\t\tnil,\n\t\t),\n\t\tatlassianUPMPlugins: prometheus.NewDesc(\n\t\t\tmetricNamespace+\"_plugin\",\n\t\t\t\"metric used to display plugin information, value is 0\",\n\t\t\t[]string{\n\t\t\t\t\"enabled\",\n\t\t\t\t\"name\",\n\t\t\t\t\"key\",\n\t\t\t\t\"installedVersion\",\n\t\t\t\t\"userInstalled\",\n\t\t\t\t\"url\",\n\t\t\t},\n\t\t\tnil,\n\t\t),\n\t\tatlassianUPMVersionsMetric: prometheus.NewDesc(\n\t\t\tmetricNamespace+\"_plugin_version_available\",\n\t\t\t\"metric used to get back the application being monitored plugin versions available, value is true if update available\",\n\t\t\t[]string{\n\t\t\t\t\"name\",\n\t\t\t\t\"key\",\n\t\t\t\t\"availableVersion\",\n\t\t\t\t\"installedVersion\",\n\t\t\t\t\"enabled\",\n\t\t\t\t\"userInstalled\",\n\t\t\t\t\"url\",\n\t\t\t},\n\t\t\tnil,\n\t\t),\n\t}\n}", "func NewVpcCollector(logger log.Logger) (Collector, error) {\n\treturn &vpcCollector{\n\t\tdesc: vpcDesc,\n\t\tlogger: logger,\n\t}, nil\n}", "func New(bufnet *bufconn.Listener) *RemotePeer {\n\tif bufnet == nil {\n\t\tbufnet = bufconn.New()\n\t}\n\n\tremote := &RemotePeer{\n\t\tbufnet: bufnet,\n\t\tsrv: grpc.NewServer(),\n\t\tCalls: make(map[string]int),\n\t}\n\n\tapi.RegisterTRISANetworkServer(remote.srv, remote)\n\tapi.RegisterTRISAHealthServer(remote.srv, remote)\n\tgo remote.srv.Serve(remote.bufnet.Sock())\n\treturn remote\n}", "func New() ([]collector.Collector, error) {\n\tnone := []collector.Collector{}\n\n\tl := log.With().Str(\"pkg\", PackageName).Logger()\n\n\tenbledCollectors := viper.GetStringSlice(config.KeyCollectors)\n\tif len(enbledCollectors) == 0 {\n\t\tl.Info().Msg(\"no builtin collectors enabled\")\n\t\treturn none, nil\n\t}\n\n\tcollectors := make([]collector.Collector, 0, len(enbledCollectors))\n\tinitErrMsg := \"initializing builtin collector\"\n\tfor _, name := range enbledCollectors {\n\t\tif !strings.HasPrefix(name, NamePrefix) {\n\t\t\tcontinue\n\t\t}\n\t\tname = strings.ReplaceAll(name, NamePrefix, \"\")\n\t\tcfgBase := \"generic_\" + name + \"_collector\"\n\t\tswitch name {\n\t\tcase NameCPU:\n\t\t\tc, err := NewCPUCollector(path.Join(defaults.EtcPath, cfgBase), l)\n\t\t\tif err != nil {\n\t\t\t\tl.Error().Str(\"name\", name).Err(err).Msg(initErrMsg)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcollectors = append(collectors, c)\n\n\t\tcase NameDisk:\n\t\t\tc, err := NewDiskCollector(path.Join(defaults.EtcPath, cfgBase), l)\n\t\t\tif err != nil {\n\t\t\t\tl.Error().Str(\"name\", name).Err(err).Msg(initErrMsg)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcollectors = append(collectors, c)\n\n\t\tcase NameFS:\n\t\t\tc, err := NewFSCollector(path.Join(defaults.EtcPath, cfgBase), l)\n\t\t\tif err != nil {\n\t\t\t\tl.Error().Str(\"name\", name).Err(err).Msg(initErrMsg)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcollectors = append(collectors, c)\n\n\t\tcase NameLoad:\n\t\t\tc, err := NewLoadCollector(path.Join(defaults.EtcPath, cfgBase), l)\n\t\t\tif err != nil {\n\t\t\t\tl.Error().Str(\"name\", name).Err(err).Msg(initErrMsg)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcollectors = append(collectors, c)\n\n\t\tcase NameIF:\n\t\t\tc, err := NewNetIFCollector(path.Join(defaults.EtcPath, cfgBase), l)\n\t\t\tif err != nil {\n\t\t\t\tl.Error().Str(\"name\", name).Err(err).Msg(initErrMsg)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcollectors = append(collectors, c)\n\n\t\tcase NameProto:\n\t\t\tc, err := NewNetProtoCollector(path.Join(defaults.EtcPath, cfgBase), l)\n\t\t\tif err != nil {\n\t\t\t\tl.Error().Str(\"name\", name).Err(err).Msg(initErrMsg)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcollectors = append(collectors, c)\n\n\t\tcase NameVM:\n\t\t\tc, err := NewVMCollector(path.Join(defaults.EtcPath, cfgBase), l)\n\t\t\tif err != nil {\n\t\t\t\tl.Error().Str(\"name\", name).Err(err).Msg(initErrMsg)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcollectors = append(collectors, c)\n\n\t\tdefault:\n\t\t\tl.Warn().Str(\"name\", name).Msg(\"unknown builtin collector, ignoring\")\n\t\t}\n\t}\n\n\treturn collectors, nil\n}", "func NewResourceCollector() Collector {\n\treturn &ResourceCollector{}\n}", "func runMockCollector(t *testing.T) *mockCollector {\n\tt.Helper()\n\treturn runMockCollectorAtEndpoint(t, \"localhost:0\")\n}", "func NewCollector(m Metric) (prometheus.Collector, error) {\n\tif len(m.Name) == 0 {\n\t\treturn nil, errors.New(\"A name is required for a metric\")\n\t}\n\n\tvar (\n\t\tnamespace = m.Namespace\n\t\tsubsystem = m.Subsystem\n\t\thelp = m.Help\n\t)\n\n\tif len(namespace) == 0 {\n\t\tnamespace = DefaultNamespace\n\t}\n\n\tif len(subsystem) == 0 {\n\t\tsubsystem = DefaultSubsystem\n\t}\n\n\tif len(help) == 0 {\n\t\thelp = m.Name\n\t}\n\n\tswitch m.Type {\n\tcase CounterType:\n\t\treturn prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: m.Name,\n\t\t\tHelp: help,\n\t\t\tConstLabels: prometheus.Labels(m.ConstLabels),\n\t\t}, m.LabelNames), nil\n\n\tcase GaugeType:\n\t\treturn prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: m.Name,\n\t\t\tHelp: help,\n\t\t\tConstLabels: prometheus.Labels(m.ConstLabels),\n\t\t}, m.LabelNames), nil\n\n\tcase HistogramType:\n\t\treturn prometheus.NewHistogramVec(prometheus.HistogramOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: m.Name,\n\t\t\tHelp: help,\n\t\t\tBuckets: m.Buckets,\n\t\t\tConstLabels: prometheus.Labels(m.ConstLabels),\n\t\t}, m.LabelNames), nil\n\n\tcase SummaryType:\n\t\treturn prometheus.NewSummaryVec(prometheus.SummaryOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: m.Name,\n\t\t\tHelp: help,\n\t\t\tObjectives: m.Objectives,\n\t\t\tMaxAge: m.MaxAge,\n\t\t\tAgeBuckets: m.AgeBuckets,\n\t\t\tBufCap: m.BufCap,\n\t\t\tConstLabels: prometheus.Labels(m.ConstLabels),\n\t\t}, m.LabelNames), nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unsupported metric type: %s\", m.Type)\n\t}\n}" ]
[ "0.6678328", "0.6632261", "0.65414196", "0.6530185", "0.6512622", "0.64971226", "0.6375079", "0.63555616", "0.62438387", "0.6209447", "0.62021196", "0.6182788", "0.61450464", "0.61132157", "0.6028201", "0.5957508", "0.5919775", "0.59160614", "0.5884967", "0.584295", "0.5818363", "0.5813408", "0.5796612", "0.57958037", "0.57937145", "0.5763175", "0.57328385", "0.57328385", "0.5729203", "0.56940603", "0.5681324", "0.562854", "0.5611518", "0.5608728", "0.5590831", "0.55822337", "0.5556737", "0.55410874", "0.55182654", "0.5514137", "0.54964495", "0.5458126", "0.5452869", "0.5449635", "0.5426785", "0.54175997", "0.5395875", "0.5351163", "0.53433245", "0.532839", "0.53127676", "0.52667826", "0.5228756", "0.5219424", "0.52175856", "0.5157324", "0.5149614", "0.5131001", "0.51267165", "0.51158744", "0.50946003", "0.5080261", "0.5072781", "0.50422317", "0.5025364", "0.50229204", "0.5018788", "0.5005706", "0.50038433", "0.50032115", "0.50030875", "0.50000304", "0.49936917", "0.49897853", "0.49752948", "0.4953986", "0.4935506", "0.4928988", "0.49287137", "0.492823", "0.492333", "0.4909444", "0.49048173", "0.48751152", "0.487385", "0.4856579", "0.48553073", "0.48511878", "0.48499566", "0.48474383", "0.48390934", "0.48356548", "0.4813391", "0.48126405", "0.48084393", "0.4806013", "0.48043263", "0.48022977", "0.4794451", "0.4787403" ]
0.7760482
0
NewTLSRemoteCollector creates a RemoteCollector that uses TLS.
func NewTLSRemoteCollector(addr string, tlsConfig *tls.Config) *RemoteCollector { return &RemoteCollector{ addr: addr, dial: func() (net.Conn, error) { return tls.Dial("tcp", addr, tlsConfig) }, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewTLSConnection(\n\tsrvRemote Remote,\n\trootCerts []byte,\n\terrorUnwrapper ErrorUnwrapper,\n\thandler ConnectionHandler,\n\tlogFactory LogFactory,\n\tinstrumenterStorage NetworkInstrumenterStorage,\n\tlogOutput LogOutputWithDepthAdder,\n\tmaxFrameLength int32,\n\topts ConnectionOpts,\n) *Connection {\n\ttransport := &ConnectionTransportTLS{\n\t\trootCerts: rootCerts,\n\t\tsrvRemote: srvRemote,\n\t\tmaxFrameLength: maxFrameLength,\n\t\tlogFactory: logFactory,\n\t\tinstrumenterStorage: instrumenterStorage,\n\t\twef: opts.WrapErrorFunc,\n\t\tdialerTimeout: opts.DialerTimeout,\n\t\thandshakeTimeout: opts.HandshakeTimeout,\n\t\tlog: newConnectionLogUnstructured(logOutput, \"CONNTSPT\"),\n\t}\n\treturn newConnectionWithTransportAndProtocols(handler, transport, errorUnwrapper, logOutput, opts)\n}", "func NewTTLSListener(laddr string, x509Opts *X509Opts) (*TTLS, error) {\n\tt := TTLS{\n\t\tx509Opts: x509Opts,\n\t}\n\tconfig, err := t.getConfig()\n\tif err != nil {\n\t\treturn &t, err\n\t}\n\tlistener, err := tls.Listen(\"tcp\", laddr, config)\n\tif err != nil {\n\t\treturn &t, err\n\t}\n\tt.Listener = listener\n\treturn &t, nil\n}", "func newTLSConfig(target string, registry *prometheus.Registry, cfg *config.TLSConfig) (*tls.Config, error) {\n\ttlsConfig, err := config.NewTLSConfig(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif tlsConfig.ServerName == \"\" && target != \"\" {\n\t\ttargetAddress, _, err := net.SplitHostPort(target)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttlsConfig.ServerName = targetAddress\n\t}\n\n\ttlsConfig.VerifyConnection = func(state tls.ConnectionState) error {\n\t\treturn collectConnectionStateMetrics(state, registry)\n\t}\n\n\treturn tlsConfig, nil\n}", "func NewRemoteCollector(addr string) *RemoteCollector {\n\treturn &RemoteCollector{\n\t\taddr: addr,\n\t\tdial: func() (net.Conn, error) {\n\t\t\treturn net.Dial(\"tcp\", addr)\n\t\t},\n\t}\n}", "func NewServerTLS(addr string,\n\thandler func(conn Conn, cmd Command),\n\taccept func(conn Conn) bool,\n\tclosed func(conn Conn, err error),\n\tconfig *tls.Config,\n) *TLSServer {\n\treturn NewServerNetworkTLS(\"tcp\", addr, handler, accept, closed, config)\n}", "func GenerateTLS(hosts string, validity string) (*CertificateChain, error) {\n\treturn tls.GenerateTLS(hosts, validity)\n}", "func NewTLS(c Config, t *tls.Config) (*Asock, error) {\n\tl, err := tls.Listen(\"tcp\", c.Sockname, t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn commonNew(c, l), nil\n}", "func NewTLSConnectionWithTLSConfig(\n\tsrvRemote Remote,\n\ttlsConfig *tls.Config,\n\terrorUnwrapper ErrorUnwrapper,\n\thandler ConnectionHandler,\n\tlogFactory LogFactory,\n\tinstrumenterStorage NetworkInstrumenterStorage,\n\tlogOutput LogOutputWithDepthAdder,\n\tmaxFrameLength int32,\n\topts ConnectionOpts,\n) *Connection {\n\ttransport := &ConnectionTransportTLS{\n\t\tsrvRemote: srvRemote,\n\t\ttlsConfig: copyTLSConfig(tlsConfig),\n\t\tmaxFrameLength: maxFrameLength,\n\t\tlogFactory: logFactory,\n\t\tinstrumenterStorage: instrumenterStorage,\n\t\twef: opts.WrapErrorFunc,\n\t\tdialerTimeout: opts.DialerTimeout,\n\t\thandshakeTimeout: opts.HandshakeTimeout,\n\t\tlog: newConnectionLogUnstructured(logOutput, \"CONNTSPT\"),\n\t}\n\treturn newConnectionWithTransportAndProtocols(handler, transport, errorUnwrapper, logOutput, opts)\n}", "func NewListenerTLS(network, addr, certFile, keyFile string, readTimeout, writeTimeout time.Duration) (net.Listener, error) {\n\tconfig := &tls.Config{}\n\tif config.NextProtos == nil {\n\t\tconfig.NextProtos = []string{\"http/1.1\"}\n\t}\n\n\tvar err error\n\tconfig.Certificates = make([]tls.Certificate, 1)\n\tconfig.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn, err := net.Listen(network, addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttl := &Listener{\n\t\tListener: tls.NewListener(conn, config),\n\t\tReadTimeout: readTimeout,\n\t\tWriteTimeout: writeTimeout,\n\t}\n\treturn tl, nil\n}", "func NewTLSConn() TLSConn {\n\tc := TLSConn{}\n\n\tc.tlsVersions = []uint16{\n\t\ttls.VersionSSL30,\n\t\ttls.VersionTLS10,\n\t\ttls.VersionTLS11,\n\t\ttls.VersionTLS12,\n\t\ttls.VersionTLS13,\n\t}\n\n\tc.tlsCurves = []tls.CurveID{\n\t\ttls.CurveP256,\n\t\ttls.CurveP384,\n\t\ttls.CurveP521,\n\t\ttls.X25519,\n\t}\n\n\tc.conf = &tls.Config{}\n\n\treturn c\n}", "func NewTLSServer(cfg TLSServerConfig) (*TLSServer, error) {\n\tif err := cfg.CheckAndSetDefaults(); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\t// limiter limits requests by frequency and amount of simultaneous\n\t// connections per client\n\tlimiter, err := limiter.NewLimiter(cfg.LimiterConfig)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// sets up gRPC metrics interceptor\n\tgrpcMetrics := metrics.CreateGRPCServerMetrics(cfg.Metrics.GRPCServerLatency, prometheus.Labels{teleport.TagServer: \"teleport-auth\"})\n\terr = metrics.RegisterPrometheusCollectors(grpcMetrics)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tlocalClusterName, err := cfg.AccessPoint.GetClusterName()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// authMiddleware authenticates request assuming TLS client authentication\n\t// adds authentication information to the context\n\t// and passes it to the API server\n\tauthMiddleware := &Middleware{\n\t\tClusterName: localClusterName.GetClusterName(),\n\t\tAcceptedUsage: cfg.AcceptedUsage,\n\t\tLimiter: limiter,\n\t\tGRPCMetrics: grpcMetrics,\n\t}\n\n\tapiServer, err := NewAPIServer(&cfg.APIConfig)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tauthMiddleware.Wrap(apiServer)\n\t// Wrap sets the next middleware in chain to the authMiddleware\n\tlimiter.WrapHandle(authMiddleware)\n\t// force client auth if given\n\tcfg.TLS.ClientAuth = tls.VerifyClientCertIfGiven\n\tcfg.TLS.NextProtos = []string{http2.NextProtoTLS}\n\n\tsecurityHeaderHandler := httplib.MakeSecurityHeaderHandler(limiter)\n\ttracingHandler := httplib.MakeTracingHandler(securityHeaderHandler, teleport.ComponentAuth)\n\n\tserver := &TLSServer{\n\t\tcfg: cfg,\n\t\thttpServer: &http.Server{\n\t\t\tHandler: tracingHandler,\n\t\t\tReadTimeout: apidefaults.DefaultIOTimeout,\n\t\t\tReadHeaderTimeout: defaults.ReadHeadersTimeout,\n\t\t\tWriteTimeout: apidefaults.DefaultIOTimeout,\n\t\t\tIdleTimeout: apidefaults.DefaultIdleTimeout,\n\t\t},\n\t\tlog: logrus.WithFields(logrus.Fields{\n\t\t\ttrace.Component: cfg.Component,\n\t\t}),\n\t}\n\tserver.cfg.TLS.GetConfigForClient = server.GetConfigForClient\n\n\tserver.grpcServer, err = NewGRPCServer(GRPCServerConfig{\n\t\tTLS: server.cfg.TLS,\n\t\tMiddleware: authMiddleware,\n\t\tAPIConfig: cfg.APIConfig,\n\t\tUnaryInterceptors: authMiddleware.UnaryInterceptors(),\n\t\tStreamInterceptors: authMiddleware.StreamInterceptors(),\n\t})\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tserver.mux, err = multiplexer.NewTLSListener(multiplexer.TLSListenerConfig{\n\t\tListener: tls.NewListener(cfg.Listener, server.cfg.TLS),\n\t\tID: cfg.ID,\n\t})\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tif cfg.PluginRegistry != nil {\n\t\tif err := cfg.PluginRegistry.RegisterAuthServices(server.grpcServer); err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t}\n\n\treturn server, nil\n}", "func NewTLSConfig() *tls.Config {\n\treturn &tls.Config{\n\t\tInsecureSkipVerify: false,\n\t\tMinVersion: tls.VersionTLS12,\n\t}\n}", "func newTLSServer(handler http.Handler) *httptest.Server {\n\tts := httptest.NewUnstartedServer(handler)\n\tts.TLS = new(tls.Config)\n\tts.TLS.NextProtos = []string{\"h2\"}\n\tts.StartTLS()\n\treturn ts\n}", "func TestNewConfigTLS(t *testing.T) {\n\tconfig, err := NewConfig(\"configs/tls.yaml\")\n\trequire.NoError(t, err)\n\t// Liftbridge TLS\n\trequire.Equal(t, \"./configs/certs/server/server-key.pem\", config.TLSKey)\n\trequire.Equal(t, \"./configs/certs/server/server-cert.pem\", config.TLSCert)\n}", "func NewServerNetworkTLS(\n\tnet, laddr string,\n\thandler func(conn Conn, cmd Command),\n\taccept func(conn Conn) bool,\n\tclosed func(conn Conn, err error),\n\tconfig *tls.Config,\n) *TLSServer {\n\tif handler == nil {\n\t\tpanic(\"handler is nil\")\n\t}\n\ts := Server{\n\t\tnet: net,\n\t\tladdr: laddr,\n\t\thandler: handler,\n\t\taccept: accept,\n\t\tclosed: closed,\n\t\tconns: make(map[*conn]bool),\n\t}\n\n\ttls := &TLSServer{\n\t\tconfig: config,\n\t\tServer: &s,\n\t}\n\treturn tls\n}", "func newTLSRoutingTunnelDialer(ssh ssh.ClientConfig, keepAlivePeriod, dialTimeout time.Duration, discoveryAddr string, insecure bool) ContextDialer {\n\treturn ContextDialerFunc(func(ctx context.Context, network, addr string) (conn net.Conn, err error) {\n\t\tresp, err := webclient.Find(&webclient.Config{Context: ctx, ProxyAddr: discoveryAddr, Insecure: insecure})\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\tif !resp.Proxy.TLSRoutingEnabled {\n\t\t\treturn nil, trace.NotImplemented(\"TLS routing is not enabled\")\n\t\t}\n\n\t\ttunnelAddr, err := resp.Proxy.TunnelAddr()\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\tdialer := &net.Dialer{\n\t\t\tTimeout: dialTimeout,\n\t\t\tKeepAlive: keepAlivePeriod,\n\t\t}\n\t\tconn, err = dialer.DialContext(ctx, network, tunnelAddr)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\thost, _, err := webclient.ParseHostPort(tunnelAddr)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\ttlsConn := tls.Client(conn, &tls.Config{\n\t\t\tNextProtos: []string{constants.ALPNSNIProtocolReverseTunnel},\n\t\t\tInsecureSkipVerify: insecure,\n\t\t\tServerName: host,\n\t\t})\n\t\tif err := tlsConn.Handshake(); err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\tsconn, err := sshConnect(ctx, tlsConn, ssh, dialTimeout, tunnelAddr)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\treturn sconn, nil\n\t})\n}", "func NewTlsConfig(t *Tls, extra ...PeerVerifier) (*tls.Config, error) {\n\tif t == nil {\n\t\treturn nil, nil\n\t}\n\n\tif len(t.CertificateFile) == 0 || len(t.KeyFile) == 0 {\n\t\treturn nil, ErrTlsCertificateRequired\n\t}\n\n\tvar nextProtos []string\n\tif len(t.NextProtos) > 0 {\n\t\tnextProtos = append(nextProtos, t.NextProtos...)\n\t} else {\n\t\t// assume http/1.1 by default\n\t\tnextProtos = append(nextProtos, \"http/1.1\")\n\t}\n\n\ttc := &tls.Config{ // nolint: gosec\n\t\tMinVersion: t.MinVersion,\n\t\tMaxVersion: t.MaxVersion,\n\t\tServerName: t.ServerName,\n\t\tNextProtos: nextProtos,\n\n\t\t// disable vulnerable ciphers\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t},\n\t}\n\n\t// if no MinVersion was set, default to TLS 1.2\n\tif tc.MinVersion == 0 {\n\t\ttc.MinVersion = tls.VersionTLS12\n\t}\n\n\tif pvs := NewPeerVerifiers(t.PeerVerify, extra...); len(pvs) > 0 {\n\t\ttc.VerifyPeerCertificate = pvs.VerifyPeerCertificate\n\t}\n\n\tif cert, err := tls.LoadX509KeyPair(t.CertificateFile, t.KeyFile); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\ttc.Certificates = []tls.Certificate{cert}\n\t}\n\n\tif len(t.ClientCACertificateFile) > 0 {\n\t\tcaCert, err := os.ReadFile(t.ClientCACertificateFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcaCertPool := x509.NewCertPool()\n\t\tif !caCertPool.AppendCertsFromPEM(caCert) {\n\t\t\treturn nil, ErrUnableToAddClientCACertificate\n\t\t}\n\n\t\ttc.ClientCAs = caCertPool\n\t\ttc.ClientAuth = tls.RequireAndVerifyClientCert\n\t}\n\n\ttc.BuildNameToCertificate() // nolint: staticcheck\n\treturn tc, nil\n}", "func NewTLSConnectionWithConnectionLogFactory(\n\tsrvRemote Remote,\n\trootCerts []byte,\n\terrorUnwrapper ErrorUnwrapper,\n\thandler ConnectionHandler,\n\tlogFactory LogFactory,\n\tinstrumenterStorage NetworkInstrumenterStorage,\n\tconnectionLogFactory ConnectionLogFactory,\n\tmaxFrameLength int32,\n\topts ConnectionOpts,\n) *Connection {\n\ttransport := &ConnectionTransportTLS{\n\t\trootCerts: rootCerts,\n\t\tsrvRemote: srvRemote,\n\t\tmaxFrameLength: maxFrameLength,\n\t\tinstrumenterStorage: instrumenterStorage,\n\t\tlogFactory: logFactory,\n\t\twef: opts.WrapErrorFunc,\n\t\tdialerTimeout: opts.DialerTimeout,\n\t\thandshakeTimeout: opts.HandshakeTimeout,\n\t\tlog: connectionLogFactory.Make(\"conn_tspt\"),\n\t}\n\tconnLog := connectionLogFactory.Make(\"conn\")\n\treturn newConnectionWithTransportAndProtocolsWithLog(\n\t\thandler, transport, errorUnwrapper, connLog, opts)\n}", "func NewLocalRouterCollector(ctx context.Context, logger *slog.Logger, errors *prometheus.CounterVec, client platform.LocalRouterClient) *LocalRouterCollector {\n\terrors.WithLabelValues(\"local_router\").Add(0)\n\n\tlocalRouterLabels := []string{\"id\", \"name\"}\n\tlocalRouterInfoLabels := append(localRouterLabels, \"tags\", \"description\")\n\tlocalRouterSwitchInfoLabels := append(localRouterLabels, \"category\", \"code\", \"zone_id\")\n\tlocalRouterServerNetworkInfoLabels := append(localRouterLabels, \"vip\", \"ipaddress1\", \"ipaddress2\", \"nw_mask_len\", \"vrid\")\n\tlocalRouterPeerLabels := append(localRouterLabels, \"peer_index\", \"peer_id\")\n\tlocalRouterPeerInfoLabels := append(localRouterPeerLabels, \"enabled\", \"description\")\n\tlocalRouterStaticRouteInfoLabels := append(localRouterLabels, \"route_index\", \"prefix\", \"next_hop\")\n\n\treturn &LocalRouterCollector{\n\t\tctx: ctx,\n\t\tlogger: logger,\n\t\terrors: errors,\n\t\tclient: client,\n\t\tUp: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_up\",\n\t\t\t\"If 1 the LocalRouter is available, 0 otherwise\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t\tLocalRouterInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_info\",\n\t\t\t\"A metric with a constant '1' value labeled by localRouter information\",\n\t\t\tlocalRouterInfoLabels, nil,\n\t\t),\n\t\tSwitchInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_switch_info\",\n\t\t\t\"A metric with a constant '1' value labeled by localRouter connected switch information\",\n\t\t\tlocalRouterSwitchInfoLabels, nil,\n\t\t),\n\t\tNetworkInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_network_info\",\n\t\t\t\"A metric with a constant '1' value labeled by network information of the localRouter\",\n\t\t\tlocalRouterServerNetworkInfoLabels, nil,\n\t\t),\n\t\tPeerInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_peer_info\",\n\t\t\t\"A metric with a constant '1' value labeled by peer information\",\n\t\t\tlocalRouterPeerInfoLabels, nil,\n\t\t),\n\t\tPeerUp: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_peer_up\",\n\t\t\t\"If 1 the Peer is available, 0 otherwise\",\n\t\t\tlocalRouterPeerLabels, nil,\n\t\t),\n\t\tStaticRouteInfo: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_static_route_info\",\n\t\t\t\"A metric with a constant '1' value labeled by static route information\",\n\t\t\tlocalRouterStaticRouteInfoLabels, nil,\n\t\t),\n\t\tReceiveBytesPerSec: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_receive_per_sec\",\n\t\t\t\"Receive bytes per seconds\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t\tSendBytesPerSec: prometheus.NewDesc(\n\t\t\t\"sakuracloud_local_router_send_per_sec\",\n\t\t\t\"Send bytes per seconds\",\n\t\t\tlocalRouterLabels, nil,\n\t\t),\n\t}\n}", "func (in *TLS) DeepCopy() *TLS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TLS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TLS) DeepCopy() *TLS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TLS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func newServerTLSConfig(certPEM, keyPEM, caPEM []byte) (*tls.Config, error) {\n\tcfg, err := newBaseTLSConfig(certPEM, keyPEM, caPEM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcfg.ClientAuth = tls.VerifyClientCertIfGiven\n\tcfg.ClientCAs = cfg.RootCAs\n\t// Use the default cipher suite from golang (RC4 is going away in 1.5).\n\t// Prefer the server-specified suite.\n\tcfg.PreferServerCipherSuites = true\n\t// Should we disable session resumption? This may break forward secrecy.\n\t// cfg.SessionTicketsDisabled = true\n\treturn cfg, nil\n}", "func NewTLSServer(vfs vfs.FileSystem) *Server {\n\tts := NewUnstartedServer(vfs)\n\tts.StartTLS()\n\treturn ts\n}", "func NewCollector(rcClientId string, kubernetesClusterId string) TelemetryCollector {\n\treturn &telemetryCollector{\n\t\tclient: httputils.NewResetClient(httpClientResetInterval, httpClientFactory(httpClientTimeout)),\n\t\thost: utils.GetMainEndpoint(config.Datadog, mainEndpointPrefix, mainEndpointUrlKey),\n\t\tuserAgent: \"Datadog Cluster Agent\",\n\t\trcClientId: rcClientId,\n\t\tkubernetesClusterId: kubernetesClusterId,\n\t}\n}", "func NewHTTPCollector(url string, options ...HTTPOption) (Collector, error) {\n\tc := &HTTPCollector{\n\t\tlogger: NewNopLogger(),\n\t\turl: url,\n\t\tclient: &http.Client{Timeout: defaultHTTPTimeout},\n\t\tbatchInterval: defaultHTTPBatchInterval * time.Second,\n\t\tbatchSize: defaultHTTPBatchSize,\n\t\tbatch: []*zipkincore.Span{},\n\t\tspanc: make(chan *zipkincore.Span, defaultHTTPBatchSize),\n\t\tquit: make(chan struct{}, 1),\n\t\tshutdown: make(chan error, 1),\n\t\tbatchPool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn make([]*zipkincore.Span, 0, defaultHTTPBatchSize)\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\tgo c.loop()\n\treturn c, nil\n}", "func NewCollector(period time.Duration, collectFunc func() []Measurement) *Collector {\n\tcollector := &Collector{\n\t\tperiod: period,\n\t\tcollectFunc: collectFunc,\n\t\tlastSendingDate: -1,\n\t}\n\n\tif sources == nil {\n\t\tsources = make([]DataSource, 0)\n\t\tgo sendingLoop()\n\t}\n\n\tif UseGlobalEngine {\n\t\tcollector.Engine = Engine\n\t} else {\n\t\tcollector.Engine = &req.Engine{}\n\t}\n\n\tsources = append(sources, collector)\n\n\treturn collector\n}", "func NewCollector(username string, token string, source string, timeout time.Duration, waitGroup *sync.WaitGroup) Collector {\n\treturn &collector{\n\t\turl: metricsEndpont,\n\t\tusername: username,\n\t\ttoken: token,\n\t\tsource: source,\n\t\ttimeout: timeout,\n\n\t\thttpClient: &http.Client{\n\t\t\tTimeout: time.Second * 30,\n\t\t},\n\t\twaitGroup: waitGroup,\n\t\tstop: make(chan bool),\n\t\tbuffer: make(chan gauge, 10000),\n\t}\n}", "func TLS(v *tls.Config) Configer {\n\treturn func(c *clientv3.Config) {\n\t\tc.TLS = v\n\t}\n}", "func NewRemote(ctx context.Context, conn *grpc.ClientConn) Subjects {\n\treturn &remote{\n\t\tclient: NewServiceClient(conn),\n\t}\n}", "func newRemoteClusterHTTPTransport() *http.Transport {\n\ttr := &http.Transport{\n\t\tProxy: http.ProxyFromEnvironment,\n\t\tTLSClientConfig: &tls.Config{\n\t\t\tRootCAs: globalRootCAs,\n\t\t},\n\t}\n\treturn tr\n}", "func newTLSCACertPool(useSystemCertPool bool) *exampleTLSCACertPool {\n\tm := &exampleTLSCACertPool{}\n\tvar err error\n\tm.tlsCertPool, err = commtls.NewCertPool(useSystemCertPool)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func NewCollector(store *store.MemoryStore) *Collector {\n\treturn &Collector{\n\t\tstore: store,\n\t\tstopChan: make(chan struct{}),\n\t\tdoneChan: make(chan struct{}),\n\t}\n}", "func createTlsConfig() {\n\n}", "func NewCollector(cfg *config.AgentConfig) TelemetryCollector {\n\tif !cfg.TelemetryConfig.Enabled {\n\t\treturn &noopTelemetryCollector{}\n\t}\n\n\tvar endpoints []config.Endpoint\n\tfor _, endpoint := range cfg.TelemetryConfig.Endpoints {\n\t\tu, err := url.Parse(endpoint.Host)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tu.Path = \"/api/v2/apmtelemetry\"\n\t\tendpointWithPath := *endpoint\n\t\tendpointWithPath.Host = u.String()\n\n\t\tendpoints = append(endpoints, endpointWithPath)\n\t}\n\n\treturn &telemetryCollector{\n\t\tclient: cfg.NewHTTPClient(),\n\t\tendpoints: endpoints,\n\t\tuserAgent: fmt.Sprintf(\"Datadog Trace Agent/%s/%s\", cfg.AgentVersion, cfg.GitCommit),\n\n\t\tcfg: cfg,\n\t\tcollectedStartupError: &atomic.Bool{},\n\t}\n}", "func (socket *SocketTLS) New(name string, port string, tlsCert string, tlsKey string) (chan SocketEvent, error) {\n\tvar err error\n\n\tsocket.name = name\n\tsocket.port = port\n\tsocket.eventChan = make(chan SocketEvent, 1000)\n\n\t// Listen for incoming connections.\n\tcer, err := tls.LoadX509KeyPair(tlsCert, tlsKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig := &tls.Config{\n\t\tCertificates: []tls.Certificate{cer},\n\t\tClientAuth: tls.NoClientCert,\n\t\tMinVersion: tls.VersionSSL30,\n\t\tInsecureSkipVerify: true,\n\t\t//MaxVersion: tls.VersionSSL30,\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_RSA_WITH_RC4_128_SHA,\n\t\t},\n\t}\n\tsocket.listen, err = tls.Listen(\"tcp\", \"0.0.0.0:\"+socket.port, config)\n\n\tif err != nil {\n\t\tlog.Errorf(\"%s: Listening on 0.0.0.0:%s threw an error.\\n%v\", socket.name, socket.port, err)\n\t\treturn nil, err\n\t}\n\tlog.Noteln(socket.name + \": Listening on 0.0.0.0:\" + socket.port)\n\n\t// Accept new connections in a new Goroutine(\"thread\")\n\tgo socket.run()\n\n\treturn socket.eventChan, nil\n}", "func newOptionalTlsCreds() *optionalTlsCreds {\n\treturn &optionalTlsCreds{\n\t\ttlsForPort: make(map[string]credentials.TransportCredentials),\n\t}\n}", "func newTLSSecret(vr *api.VaultService, caKey *rsa.PrivateKey, caCrt *x509.Certificate, commonName, secretName string,\n\taddrs []string, fieldMap map[string]string) (*v1.Secret, error) {\n\ttc := tls.CertConfig{\n\t\tCommonName: commonName,\n\t\tOrganization: orgForTLSCert,\n\t\tAltNames: tls.NewAltNames(addrs),\n\t}\n\tkey, crt, err := newKeyAndCert(caCrt, caKey, tc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"new TLS secret failed: %v\", err)\n\t}\n\tsecret := &v1.Secret{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Secret\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: secretName,\n\t\t\tNamespace: vr.Namespace,\n\t\t\tLabels: labelsForVault(vr.Name),\n\t\t},\n\t\tData: map[string][]byte{\n\t\t\tfieldMap[\"key\"]: tls.EncodePrivateKeyPEM(key),\n\t\t\tfieldMap[\"cert\"]: tls.EncodeCertificatePEM(crt),\n\t\t\tfieldMap[\"ca\"]: tls.EncodeCertificatePEM(caCrt),\n\t\t},\n\t}\n\treturn secret, nil\n}", "func NewTLSConnectionWithDialable(\n\tsrvRemote Remote,\n\trootCerts []byte,\n\terrorUnwrapper ErrorUnwrapper,\n\thandler ConnectionHandler,\n\tlogFactory LogFactory,\n\tinstrumenterStorage NetworkInstrumenterStorage,\n\tlogOutput LogOutputWithDepthAdder,\n\tmaxFrameLength int32,\n\topts ConnectionOpts,\n\tdialable Dialable,\n) *Connection {\n\ttransport := &ConnectionTransportTLS{\n\t\trootCerts: rootCerts,\n\t\tsrvRemote: srvRemote,\n\t\tmaxFrameLength: maxFrameLength,\n\t\tlogFactory: logFactory,\n\t\tinstrumenterStorage: instrumenterStorage,\n\t\twef: opts.WrapErrorFunc,\n\t\tdialerTimeout: opts.DialerTimeout,\n\t\thandshakeTimeout: opts.HandshakeTimeout,\n\t\tlog: newConnectionLogUnstructured(logOutput, \"CONNTSPT\"),\n\t\tdialable: dialable,\n\t}\n\treturn newConnectionWithTransportAndProtocols(handler, transport, errorUnwrapper, logOutput, opts)\n}", "func newTLSCredentials(\n\tmountPath string,\n\tkey corev1.SecretKeySelector,\n\tcert monitoringv1.SecretOrConfigMap,\n\tclientCA monitoringv1.SecretOrConfigMap,\n) *tlsCredentials {\n\treturn &tlsCredentials{\n\t\tmountPath: mountPath,\n\t\tkeySecret: key,\n\t\tcert: cert,\n\t\tclientCA: clientCA,\n\t}\n}", "func DialTLS(tlsConfig *tls.Config) (*Conn, error) {\n\treturn DialToTLS(\"\", tlsConfig)\n}", "func NewSSLTransport(ctx context.Context, addr string, config *tls.Config) (*TCPTransport, error) {\n\tdialer := tls.Dialer{\n\t\tNetDialer: &net.Dialer{},\n\t\tConfig: config,\n\t}\n\tconn, err := dialer.DialContext(ctx, \"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttcp := &TCPTransport{\n\t\tconn: conn,\n\t\tresponses: make(chan []byte),\n\t\terrors: make(chan error),\n\t}\n\n\tgo tcp.listen()\n\n\treturn tcp, nil\n}", "func NewKubeletCerts() workflow.Phase {\n\treturn workflow.Phase{\n\t\tName: \"kubelet-certs\",\n\t\tShort: \"Kubelet certificate generation\",\n\t\tPhases: []workflow.Phase{\n\t\t\t{\n\t\t\t\tName: \"all\",\n\t\t\t\tShort: \"Prepares kubelet server certificates\",\n\t\t\t},\n\t\t},\n\t\tRun: runCerts,\n\t\tLong: cmdutil.MacroCommandLongDescription,\n\t}\n}", "func NewTLSTransport(config TLSConfig, inner Transport) (*TLSTransport, error) {\n\ttransport := &TLSTransport{inner: inner}\n\ttc := &transport.tlsConfig\n\n\tcert, err := tls.LoadX509KeyPair(config.Cert, config.Key)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to load key pair\")\n\t}\n\ttc.Certificates = append(tc.Certificates, cert)\n\n\tif len(config.CAs) == 0 {\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\tif len(config.ExtraCAs) > 0 {\n\t\t\t\treturn nil, errors.New(\n\t\t\t\t\t\"currently adding extra CA(s) to \" +\n\t\t\t\t\t\t\"system default CA pool is not supported on Windows\")\n\t\t\t}\n\t\t} else {\n\t\t\tif tc.RootCAs, err = x509.SystemCertPool(); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed to load system CA pool\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\ttc.RootCAs = x509.NewCertPool()\n\t}\n\tcaToAdd := append(config.CAs, config.ExtraCAs...)\n\tfor i := range caToAdd {\n\t\tif err := addCA(tc.RootCAs, caToAdd[i]); err != nil {\n\t\t\treturn nil, errors.Wrapf(\n\t\t\t\terr, \"failed to add %s to the root ca list\", caToAdd[i])\n\t\t}\n\t}\n\n\tif config.VerifyClient {\n\t\ttc.ClientAuth = tls.RequireAndVerifyClientCert\n\t}\n\n\tif len(config.ClientCAs) > 0 {\n\t\ttc.ClientCAs = x509.NewCertPool()\n\t\tfor i := range config.ClientCAs {\n\t\t\tif err := addCA(tc.ClientCAs, config.ClientCAs[i]); err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err,\n\t\t\t\t\t\"failed to add %s to the client ca list\",\n\t\t\t\t\tconfig.ClientCAs[i])\n\t\t\t}\n\t\t}\n\t}\n\n\ttc.MinVersion = tls.VersionTLS11\n\n\ttc.CipherSuites = []uint16{\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,\n\t}\n\n\ttc.ClientSessionCache = tls.NewLRUClientSessionCache(\n\t\tconfig.SessionCacheSize)\n\n\tif config.HandshakeTimeout != \"\" {\n\t\tt, err := time.ParseDuration(config.HandshakeTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"invalid handshake_timeout\")\n\t\t}\n\t\tif t <= 0 {\n\t\t\treturn nil, errors.New(\"handshake_timeout should be > 0\")\n\t\t}\n\t\ttransport.handshakeTimeout = t\n\t} else {\n\t\ttransport.handshakeTimeout = defaultTLSHandshakeTimeout\n\t}\n\n\treturn transport, nil\n}", "func newEtcdServerTLSSecret(vr *api.VaultService, caKey *rsa.PrivateKey, caCrt *x509.Certificate) (*v1.Secret, error) {\n\treturn newTLSSecret(vr, caKey, caCrt, \"etcd server\", etcdServerTLSSecretName(vr.Name),\n\t\t[]string{\n\t\t\t\"localhost\",\n\t\t\tfmt.Sprintf(\"*.%s.%s.svc\", etcdNameForVault(vr.Name), vr.Namespace),\n\t\t\tfmt.Sprintf(\"%s-client\", etcdNameForVault(vr.Name)),\n\t\t\tfmt.Sprintf(\"%s-client.%s\", etcdNameForVault(vr.Name), vr.Namespace),\n\t\t\tfmt.Sprintf(\"%s-client.%s.svc\", etcdNameForVault(vr.Name), vr.Namespace),\n\t\t\tfmt.Sprintf(\"*.%s.%s.svc.%s\", etcdNameForVault(vr.Name), vr.Namespace, defaultClusterDomain),\n\t\t\tfmt.Sprintf(\"%s-client.%s.svc.%s\", etcdNameForVault(vr.Name), vr.Namespace, defaultClusterDomain),\n\t\t},\n\t\tmap[string]string{\n\t\t\t\"key\": \"server.key\",\n\t\t\t\"cert\": \"server.crt\",\n\t\t\t\"ca\": \"server-ca.crt\",\n\t\t})\n}", "func ServeTLS(l net.Listener, handler Handler, certFile, keyFile string) error {\n\tsrv := &Server{Handler: handler}\n\treturn srv.ServeTLS(l, certFile, keyFile)\n}", "func NewCollector(l *logrus.Entry, updateInterval time.Duration) *Collector {\n\tcol := &Collector{\n\t\tMsgEvtChan: make(chan *discordgo.Message, 1000),\n\t\tinterval: updateInterval,\n\t\tl: l,\n\t\tchannels: make(map[int64]*entry),\n\t}\n\n\tgo col.run()\n\n\treturn col\n}", "func NewServerTLSConfig(certs []tls.Certificate, rootCAPool *x509.CertPool) (*tls.Config, error) {\n\tif rootCAPool == nil {\n\t\treturn nil, errors.New(\"valid root CA pool required\")\n\t}\n\n\treturn &tls.Config{\n\t\tCertificates: certs,\n\t\t// Since we're using the same CA server to issue Certificates to new nodes, we can't\n\t\t// use tls.RequireAndVerifyClientCert\n\t\tClientAuth: tls.VerifyClientCertIfGiven,\n\t\tRootCAs: rootCAPool,\n\t\tClientCAs: rootCAPool,\n\t\tPreferServerCipherSuites: true,\n\t\tMinVersion: tls.VersionTLS12,\n\t}, nil\n}", "func NewServer(l net.Listener, c Collector) *CollectorServer {\n\tcs := &CollectorServer{c: c, l: l}\n\treturn cs\n}", "func NewTLSStateMachine() State {\n\tnormal := &Normal{}\n\tauthedstream := &AuthedStream{Next: normal}\n\tauthedstart := &AuthedStart{Next: authedstream}\n\ttlsauth := &TLSAuth{Next: authedstart}\n\ttlsstartstream := &TLSStartStream{Next: tlsauth}\n\ttlsupgrade := &TLSUpgrade{Next: tlsstartstream}\n\tfirststream := &TLSUpgradeRequest{Next: tlsupgrade}\n\tstart := &Start{Next: firststream}\n\treturn start\n}", "func NewTlsInspectionPolicy(ctx *pulumi.Context,\n\tname string, args *TlsInspectionPolicyArgs, opts ...pulumi.ResourceOption) (*TlsInspectionPolicy, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.CaPool == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'CaPool'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource TlsInspectionPolicy\n\terr := ctx.RegisterResource(\"gcp:networksecurity/tlsInspectionPolicy:TlsInspectionPolicy\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c *Client) InitTLS(certFile string) error {\n\tserverCert, err := ioutil.ReadFile(certFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tCA_Pool := x509.NewCertPool()\n\tCA_Pool.AppendCertsFromPEM(serverCert)\n\tc.mutex.Lock()\n\tc.rootCAs = CA_Pool\n\tc.mutex.Unlock()\n\tif c.agentProvider != nil {\n\t\treturn c.agentProvider.Refresh()\n\t}\n\treturn nil\n}", "func NewDNSOverTLS(dial DialContextFunc, address string) DNSOverTCP {\n\treturn DNSOverTCP{\n\t\tdial: dial,\n\t\taddress: address,\n\t\tnetwork: \"dot\",\n\t\trequiresPadding: true,\n\t}\n}", "func NewTlsCipherPolicy(ctx *pulumi.Context,\n\tname string, args *TlsCipherPolicyArgs, opts ...pulumi.ResourceOption) (*TlsCipherPolicy, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Ciphers == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Ciphers'\")\n\t}\n\tif args.TlsCipherPolicyName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TlsCipherPolicyName'\")\n\t}\n\tif args.TlsVersions == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TlsVersions'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource TlsCipherPolicy\n\terr := ctx.RegisterResource(\"alicloud:slb/tlsCipherPolicy:TlsCipherPolicy\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewTLSHandshakerUTLS(logger model.DebugLogger, id *utls.ClientHelloID) model.TLSHandshaker {\n\treturn newTLSHandshaker(&tlsHandshakerConfigurable{\n\t\tNewConn: newUTLSConnFactory(id),\n\t}, logger)\n}", "func newVaultServerTLSSecret(vr *api.VaultService, caKey *rsa.PrivateKey, caCrt *x509.Certificate) (*v1.Secret, error) {\n\treturn newTLSSecret(vr, caKey, caCrt, \"vault server\", api.DefaultVaultServerTLSSecretName(vr.Name),\n\t\t[]string{\n\t\t\t\"localhost\",\n\t\t\tfmt.Sprintf(\"*.%s.pod\", vr.Namespace),\n\t\t\tfmt.Sprintf(\"%s.%s.svc\", vr.Name, vr.Namespace),\n\t\t},\n\t\tmap[string]string{\n\t\t\t\"key\": \"server.key\",\n\t\t\t\"cert\": \"server.crt\",\n\t\t\t// The CA is not used by the server\n\t\t\t\"ca\": \"server-ca.crt\",\n\t\t})\n}", "func NewCollector(config *Config) (coll *Collector, err error) {\n\tvar gelfWriter *gelf.Writer\n\n\tif gelfWriter, err = gelf.NewWriter(config.Graylog.Address); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcoll = new(Collector)\n\tcoll.writer = gelfWriter\n\tcoll.host = config.Collector.Hostname\n\n\treturn coll, nil\n}", "func NewCollector(bindIP, port string) (*SyslogCollector, error) {\n\tdefer TRA(CE())\n\tchannel := make(syslog.LogPartsChannel)\n\tsysServ := syslog.NewServer()\n\tsysServ.SetHandler(syslog.NewChannelHandler(channel))\n\t// uses RFC3164 because it is default for rsyslog\n\tsysServ.SetFormat(syslog.RFC3164)\n\terr := sysServ.ListenUDP(fmt.Sprintf(\"%s:%s\", bindIP, port))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func(channel syslog.LogPartsChannel) {\n\t\tfor logEntry := range channel {\n\t\t\tinfo, err := ctl.NewHostInfo()\n\t\t\tif err != nil {\n\t\t\t\tinfo = &ctl.HostInfo{}\n\t\t\t}\n\t\t\tevent, err := ctl.NewEvent(logEntry, *info)\n\t\t\tif err != nil {\n\t\t\t\tErrorLogger.Printf(\"cannot format syslog entry: %s\\n\", err)\n\t\t\t}\n\t\t\terr = event.Save(SubmitPath())\n\t\t\tif err != nil {\n\t\t\t\tErrorLogger.Printf(\"cannot save syslog entry to file: %s\\n\", err)\n\t\t\t}\n\t\t}\n\t}(channel)\n\treturn &SyslogCollector{\n\t\tserver: sysServ,\n\t\tport: port,\n\t}, nil\n}", "func NewServerTLSConfig(caCrtFile, certFile, keyFile string) (*tls.Config, error) {\n\ttc := &tls.Config{}\n\n\tpool := x509.NewCertPool()\n\tcaCertPath := caCrtFile\n\n\tcaCrt, err := ioutil.ReadFile(caCertPath)\n\tif err != nil {\n\t\tfmt.Println(\"ReadFile err:\", err)\n\t\treturn nil, err\n\t}\n\tpool.AppendCertsFromPEM(caCrt)\n\n\ttc.ClientCAs = pool\n\n\tif certFile != \"\" {\n\t\tcliCrt, err := tls.LoadX509KeyPair(certFile, keyFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttc.Certificates = []tls.Certificate{cliCrt}\n\t}\n\treturn tc, nil\n}", "func NewCollector(logicalSystem string) collector.RPCCollector {\n\treturn &bgpCollector{LogicalSystem: logicalSystem}\n}", "func NewListenerWithKeepAliveTLS(l net.Listener, tlsConfig *tls.Config) net.Listener {\n\tln := &listenerWithKeepAliveTLS{}\n\tln.Listener = l\n\tln.tlsConfig = tlsConfig\n\treturn ln\n}", "func (aps *ApiServer) RunTLS() error {\n\treturn aps.Engine.RunTLS(aps.ipAddr+\":\"+strconv.Itoa(aps.port), aps.certFile, aps.keyFile)\n}", "func TLSGenServer(c agent.Config, options ...tlsx.Option) (creds *tls.Config, err error) {\n\tvar (\n\t\tpool *x509.CertPool\n\t)\n\n\tif err = os.MkdirAll(c.CredentialsDir, 0700); err != nil {\n\t\treturn creds, errors.WithStack(err)\n\t}\n\n\tif pool, err = x509.SystemCertPool(); err != nil {\n\t\treturn creds, errors.WithStack(err)\n\t}\n\n\tm := NewDirectory(\n\t\tc.ServerName,\n\t\tc.CredentialsDir,\n\t\tc.CA,\n\t\tpool,\n\t)\n\n\tcreds = &tls.Config{\n\t\tServerName: c.ServerName,\n\t\tClientAuth: tls.RequireAndVerifyClientCert,\n\t\tGetCertificate: m.GetCertificate,\n\t\tGetClientCertificate: m.GetClientCertificate,\n\t\tClientCAs: pool,\n\t\tRootCAs: pool,\n\t\tNextProtos: []string{\"bw.mux\"},\n\t}\n\n\treturn tlsx.Clone(creds, options...)\n}", "func (m *cMux) ServeTLS(l net.Listener, tLSConfig *tls.Config, certFile, keyFile string) error {\n\tconfig := cloneTLSConfig(tLSConfig)\n\tif !strings.SliceContains(config.NextProtos, \"http/1.1\") {\n\t\tconfig.NextProtos = append(config.NextProtos, \"http/1.1\")\n\t}\n\n\tconfigHasCert := len(config.Certificates) > 0 || config.GetCertificate != nil\n\tif !configHasCert || certFile != \"\" || keyFile != \"\" {\n\t\tvar err error\n\t\tconfig.Certificates = make([]tls.Certificate, 1)\n\t\tconfig.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttlsListener := tls.NewListener(l, config)\n\treturn m.Serve(tlsListener)\n}", "func (instance *TLSProvider) CreateListener(network string, address string) (listener net.Listener, err error) {\n\tconfig := &tls.Config{\n\t\tClientAuth: tls.NoClientCert,\n\t\t//MinVersion: tls.VersionTLS10,\n\t\tNextProtos: []string{\"h2\", \"http/1.1\"},\n\t\tGetCertificate: instance.GetCertificate,\n\t\tPreferServerCipherSuites: true,\n\t\t// If CipherSuites is nil, a default list of secure cipher suites is used, with a preference order based on hardware performance.\n\t\t/*\n\t\t\tCipherSuites: []uint16{\n\t\t\t\t// https://pkg.go.dev/crypto/tls#pkg-constants\n\n\t\t\t\t// TLS 1.0 - 1.2 (for RSA server certifacte)\n\t\t\t\t//tls.TLS_RSA_WITH_RC4_128_SHA, // 142.03 req/s\n\t\t\t\t//tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, // 27.58 req/s\n\t\t\t\t//tls.TLS_RSA_WITH_AES_128_CBC_SHA, // 168.58 req/s\n\t\t\t\t//tls.TLS_RSA_WITH_AES_256_CBC_SHA, // 164.96 req/s\n\t\t\t\t//tls.TLS_RSA_WITH_AES_128_CBC_SHA256, // 128.54 req/s\n\t\t\t\t//tls.TLS_RSA_WITH_AES_128_GCM_SHA256, // 221.98 req/s\n\t\t\t\t//tls.TLS_RSA_WITH_AES_256_GCM_SHA384, // 214.77 req/s\n\t\t\t\t//tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, // 189.06 req/s\n\t\t\t\t//tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, // 183.72 req/s\n\t\t\t\t//tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, // 130.55 req/s\n\t\t\t\t// TLS 1.0 - 1.2 (for ECC server certificate)\n\t\t\t\t//tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, // ? req/s\n\t\t\t\t//tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, // ? req/s\n\t\t\t\t// TLS 1.3\n\t\t\t\t//tls.TLS_AES_128_GCM_SHA256, // ? req/s\n\t\t\t\t//tls.TLS_AES_256_GCM_SHA384, // ? req/s\n\t\t\t\t//tls.TLS_CHACHA20_POLY1305_SHA256, // ? req/s\n\t\t\t},\n\t\t*/\n\t}\n\tlistener, err = net.Listen(network, address)\n\tif err != nil {\n\t\treturn\n\t}\n\tlistener = tls.NewListener(listener, config)\n\treturn\n}", "func ConfigTLS(c Config) *tls.Config {\n\tsCert, err := tls.LoadX509KeyPair(c.CertFile, c.KeyFile)\n\tif err != nil {\n\t\tglog.Fatal(err)\n\t}\n\treturn &tls.Config{\n\t\tCertificates: []tls.Certificate{sCert},\n\t\t// TODO: uses mutual tls after we agree on what cert the apiserver should use.\n\t\t// ClientAuth: tls.RequireAndVerifyClientCert,\n\t}\n}", "func NewCollector(cfg *config.AgentConfig, ctx context.Context) (Collector, error) {\n\tsysInfo, err := checks.CollectSystemInfo(cfg)\n\tif err != nil {\n\t\treturn Collector{}, err\n\t}\n\n\tenabledChecks := make([]checks.Check, 0)\n\tfor _, c := range checks.All {\n\t\tif cfg.CheckIsEnabled(c.Name()) {\n\t\t\tc.Init(cfg, sysInfo)\n\t\t\tenabledChecks = append(enabledChecks, c)\n\t\t}\n\t}\n\n\treturn NewCollectorWithChecks(cfg, enabledChecks, ctx), nil\n}", "func NewRTCDtlsTransport(transport *RTCIceTransport, certificates []RTCCertificate) (*RTCDtlsTransport, error) {\n\tt := &RTCDtlsTransport{iceTransport: transport}\n\n\tif len(certificates) > 0 {\n\t\tnow := time.Now()\n\t\tfor _, x509Cert := range certificates {\n\t\t\tif !x509Cert.Expires().IsZero() && now.After(x509Cert.Expires()) {\n\t\t\t\treturn nil, &rtcerr.InvalidAccessError{Err: ErrCertificateExpired}\n\t\t\t}\n\t\t\tt.certificates = append(t.certificates, x509Cert)\n\t\t}\n\t} else {\n\t\tsk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\t\tif err != nil {\n\t\t\treturn nil, &rtcerr.UnknownError{Err: err}\n\t\t}\n\t\tcertificate, err := GenerateCertificate(sk)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tt.certificates = []RTCCertificate{*certificate}\n\t}\n\n\treturn t, nil\n}", "func NewTLSKey(tlsKeyPath, tlsCertPath string) error {\n\tpriv, err := rsa.GenerateKey(rand.Reader, 4096)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnotBefore := time.Now()\n\tnotAfter := notBefore.Add(certificateDuration)\n\tserialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)\n\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttemplate := x509.Certificate{\n\t\tSerialNumber: serialNumber,\n\t\tNotBefore: notBefore,\n\t\tNotAfter: notAfter,\n\t\tKeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t}\n\tderBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcertOut, err := os.Create(tlsCertPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer certOut.Close() // nolint: errcheck\n\tif err = pem.Encode(certOut, &pem.Block{Type: \"CERTIFICATE\", Bytes: derBytes}); err != nil {\n\t\treturn err\n\t}\n\n\tkeyOut, err := os.OpenFile(tlsKeyPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer keyOut.Close() // nolint: errcheck\n\terr = pem.Encode(keyOut, &pem.Block{\n\t\tType: \"RSA PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(priv),\n\t})\n\treturn err\n}", "func (i *MonitorInstance) setTLSConfig(ctx context.Context, enableTLS bool, configs map[string]any, paths meta.DirPaths) (map[string]any, error) {\n\treturn nil, nil\n}", "func NewLocalCollector(s Store) Collector {\n\treturn s\n}", "func NewVaultCollector() (Collector, error) {\n\taddr := os.Getenv(\"VAULT_ADDR\")\n\tcaCert := os.Getenv(\"VAULT_CACERT\")\n\tcaPath := os.Getenv(\"VAULT_CAPATH\")\n\tserverName := \"\"\n\tif addr != \"\" {\n\t\turl, err := url.Parse(addr)\n\t\tif err != nil {\n\t\t\treturn nil, maskAny(err)\n\t\t}\n\t\thost, _, err := net.SplitHostPort(url.Host)\n\t\tif err != nil {\n\t\t\treturn nil, maskAny(err)\n\t\t}\n\t\tserverName = host\n\t}\n\tvar certPool *x509.CertPool\n\tif caCert != \"\" || caPath != \"\" {\n\t\tvar err error\n\t\tif caCert != \"\" {\n\t\t\tlog.Debugf(\"Loading CA cert: %s\", caCert)\n\t\t\tcertPool, err = LoadCACert(caCert)\n\t\t} else {\n\t\t\tlog.Debugf(\"Loading CA certs from: %s\", caPath)\n\t\t\tcertPool, err = LoadCAPath(caPath)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, maskAny(err)\n\t\t}\n\t}\n\n\ttransport := cleanhttp.DefaultTransport()\n\ttransport.Proxy = nil\n\ttransport.TLSClientConfig = &tls.Config{\n\t\tServerName: serverName,\n\t\tRootCAs: certPool,\n\t\t//InsecureSkipVerify: true,\n\t}\n\tclient := &http.Client{\n\t\tTransport: transport,\n\t}\n\tc := &vaultCollector{\n\t\taddress: addr,\n\t\tclient: client,\n\t\tvaultUnsealedDesc: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(vaultNamespace, \"\", \"server_unsealed\"),\n\t\t\t\"Vault unseal status (1=unsealed, 0=sealed)\", []string{\"address\"}, nil,\n\t\t),\n\t\tstatus: make(map[string]float64),\n\t}\n\tgo c.updateStatusLoop()\n\treturn c, nil\n}", "func NewHTTPS(host string, port int) Static {\n\treturn Static{\n\t\tprotocol: ProtocolHTTPS,\n\t\thost: host,\n\t\tport: port,\n\t}\n}", "func upgradeTLS(c *v1Conn, line string, hooks EventHooks) (err error) {\n\tif c.tlsConfig == nil {\n\t\terr = c.printfLine(\"%s TLS not supported\", RPL_TLSRejected)\n\t} else {\n\t\terr = c.printfLine(\"%s Continue with TLS Negotiation\", RPL_TLSContinue)\n\t\tif err == nil {\n\t\t\ttconn := tls.Server(c.conn, c.tlsConfig)\n\t\t\terr = tconn.Handshake()\n\t\t\tif err == nil {\n\t\t\t\t// successful tls handshake\n\t\t\t\tc.tlsConn = tconn\n\t\t\t\tc.C = textproto.NewConn(c.tlsConn)\n\t\t\t} else {\n\t\t\t\t// tls failed\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"pkg\": \"nntp-conn\",\n\t\t\t\t\t\"addr\": c.conn.RemoteAddr(),\n\t\t\t\t\t\"state\": c.state,\n\t\t\t\t}).Warn(\"TLS Handshake failed \", err)\n\t\t\t\t// fall back to plaintext\n\t\t\t\terr = nil\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func New(chainID, remote string) (provider.Provider, error) {\n\thttpClient, err := rpcclient.NewHTTP(remote, \"/websocket\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewWithClient(chainID, httpClient), nil\n}", "func WithTLS(certs []tls.Certificate) Option {\n\treturn func(g *GRPC) {\n\t\tg.certs = certs\n\t}\n}", "func NewTLSField(name string) *ConfigField {\n\ttf := btls.FieldSpec()\n\ttf.Name = name\n\ttf.Type = docs.FieldTypeObject\n\tvar newChildren []docs.FieldSpec\n\tfor _, f := range tf.Children {\n\t\tif f.Name != \"enabled\" {\n\t\t\tnewChildren = append(newChildren, f)\n\t\t}\n\t}\n\ttf.Children = newChildren\n\treturn &ConfigField{field: tf}\n}", "func (c Control) ServeTLS(w http.ResponseWriter, r *http.Request) {\n\ttemplate := map[string]interface{}{}\n\tc.Config.RLock()\n\ttls, err := json.Marshal(c.Config.TLS)\n\tc.Config.RUnlock()\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t} else {\n\t\ttemplate[\"tls\"] = string(tls)\n\t\tserveTemplate(w, r, \"tls\", template)\n\t}\n}", "func New(subjectNames ...string) *tls.Config {\n\tif len(subjectNames) == 0 {\n\t\tsubjectNames = []string{\"localhost\"}\n\t}\n\tssconfig := SelfSignedConfig{\n\t\tSAN: subjectNames,\n\t\tKeyType: RSA4096,\n\t\tExpire: time.Now().Add(10 * time.Hour * 24 * 365),\n\t}\n\tcert, _ := newSelfSignedCertificate(ssconfig)\n\treturn &tls.Config{Certificates: []tls.Certificate{cert}}\n}", "func newTunnel(nc *nats.Conn, subject string, readTimeout time.Duration, respHandler func(response *Response)) *Tunnel {\n\treturn &Tunnel{\n\t\tsubject: subject,\n\t\tnc: nc,\n\t\tdone: make(chan bool),\n\t\trespHandler: respHandler,\n\t\trandSuffix: &RandomSuffix{\n\t\t\trandomGenerator: rand.New(rand.NewSource(time.Now().UnixNano())), //nolint gosec\n\t\t},\n\t\tmon: tunnelMon{\n\t\t\treadTimeout: readTimeout,\n\t\t},\n\t}\n}", "func NewCollector() collector.RPCCollector {\n\treturn &vpwsCollector{}\n}", "func (in *ListenerTLS) DeepCopy() *ListenerTLS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ListenerTLS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewTLSKey(tlsKeyPath, tlsCertPath string, keySize int) error {\n\tpriv, template, err := generateTLSTemplate(nil, keySize)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Self-signed certificate: template == parent\n\tderBytes, err := x509.CreateCertificate(rand.Reader, template, template, &priv.PublicKey, priv)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = writeCertificate(tlsCertPath, derBytes); err != nil {\n\t\treturn err\n\t}\n\treturn writePrivateKey(tlsKeyPath, priv)\n}", "func NewStatsCollector(cliContext *cli.Context) (*StatsCollector, error) {\n\n\t// fill the Collector struct\n\tcollector := &StatsCollector{\n\t\tcliContext: cliContext,\n\t\tsocketPath: cliContext.String(\"socketPath\"),\n\t\tkamailioHost: cliContext.String(\"host\"),\n\t\tkamailioPort: cliContext.Int(\"port\"),\n\t}\n\n\t// fine, return the created object struct\n\treturn collector, nil\n}", "func TelemetryHarvesterWithTLSConfig(tlsConfig *tls.Config) TelemetryHarvesterOpt {\n\n\treturn func(cfg *telemetry.Config) {\n\t\trt := cfg.Client.Transport\n\t\tif rt == nil {\n\t\t\trt = http.DefaultTransport\n\t\t}\n\n\t\tt, ok := rt.(*http.Transport)\n\t\tif !ok {\n\t\t\tlogrus.Warning(\n\t\t\t\t\"telemetry emitter TLS configuration couldn't be set, \",\n\t\t\t\t\"client transport is not an http.Transport.\",\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tt = t.Clone()\n\t\tt.TLSClientConfig = tlsConfig\n\t\tcfg.Client.Transport = http.RoundTripper(t)\n\t\treturn\n\t}\n}", "func newUTLSConnFactory(clientHello *utls.ClientHelloID) func(conn net.Conn, config *tls.Config) (TLSConn, error) {\n\treturn func(conn net.Conn, config *tls.Config) (TLSConn, error) {\n\t\treturn NewUTLSConn(conn, config, clientHello)\n\t}\n}", "func NewDialerWithTLSConfig(opts *DialerOptions, tls *tls.Config) *Dialer {\n\treturn &Dialer{opts: opts, tls: tls}\n}", "func NewSinker(rcm cm.RemoteConfManager) *Sinker {\n\tctx, cancel := context.WithCancel(context.Background())\n\ts := &Sinker{\n\t\ttasks: make(map[string]*task.Service),\n\t\trcm: rcm,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tstopped: make(chan struct{}),\n\t}\n\treturn s\n}", "func NewCmdCreateSecretTLS(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run]\",\n\t\tShort: i18n.T(\"Create a TLS secret\"),\n\t\tLong: secretForTLSLong,\n\t\tExample: secretForTLSExample,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\terr := CreateSecretTLS(f, cmdOut, cmd, args)\n\t\t\tcmdutil.CheckErr(err)\n\t\t},\n\t}\n\tcmdutil.AddApplyAnnotationFlags(cmd)\n\tcmdutil.AddValidateFlags(cmd)\n\tcmdutil.AddPrinterFlags(cmd)\n\tcmdutil.AddGeneratorFlags(cmd, cmdutil.SecretForTLSV1GeneratorName)\n\tcmd.Flags().String(\"cert\", \"\", i18n.T(\"Path to PEM encoded public key certificate.\"))\n\tcmd.Flags().String(\"key\", \"\", i18n.T(\"Path to private key associated with given certificate.\"))\n\treturn cmd\n}", "func NewAuth(bufnet *bufconn.Listener, certs *trust.Provider, pool trust.ProviderPool) (remote *RemotePeer, err error) {\n\tif bufnet == nil {\n\t\tbufnet = bufconn.New()\n\t}\n\n\tvar creds grpc.ServerOption\n\tif creds, err = mtls.ServerCreds(certs, pool); err != nil {\n\t\treturn nil, err\n\t}\n\n\tremote = &RemotePeer{\n\t\tbufnet: bufnet,\n\t\tsrv: grpc.NewServer(creds),\n\t\tCalls: make(map[string]int),\n\t}\n\n\tapi.RegisterTRISANetworkServer(remote.srv, remote)\n\tapi.RegisterTRISAHealthServer(remote.srv, remote)\n\tgo remote.srv.Serve(remote.bufnet.Sock())\n\treturn remote, nil\n}", "func (c *Client) DialTLS(ctx context.Context, target string, file string, name string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error) {\n\tvar creds credentials.TransportCredentials\n\tcreds, err = credentials.NewClientTLSFromFile(file, name)\n\tif err != nil {\n\t\terr = errors.WithStack(err)\n\t\treturn\n\t}\n\topts = append(opts, grpc.WithTransportCredentials(creds))\n\treturn c.dial(ctx, target, opts...)\n}", "func newServer(cert *shared.CertInfo, handler http.Handler) *httptest.Server {\n\tserver := httptest.NewUnstartedServer(handler)\n\tserver.TLS = util.ServerTLSConfig(cert)\n\tserver.StartTLS()\n\treturn server\n}", "func (s *Server) generateTLSConfig(opts *TLSOptions) (*tls.Config, error) {\n\treturn generateTLSConfig(opts)\n}", "func New(cfg smtpcf.SMTP, tlsConfig *tls.Config) (SMTP, error) {\n\tif tlsConfig == nil {\n\t\t/* #nosec */\n\t\t//nolint #nosec\n\t\ttlsConfig = &tls.Config{}\n\t}\n\n\tif cfg == nil {\n\t\treturn nil, ErrorParamEmpty.Error(nil)\n\t} else {\n\t\treturn &smtpClient{\n\t\t\tmut: sync.Mutex{},\n\t\t\tcfg: cfg,\n\t\t\ttls: tlsConfig,\n\t\t}, nil\n\t}\n}", "func NewListener(inner net.Listener, config *tls.Config,) net.Listener", "func MQTTNewTLSConfig(crtPath, keyPath string, skipVerify bool) (*tls.Config, error) {\n\t// Import trusted certificates from CAfile.pem.\n\t// Alternatively, manually add CA certificates to\n\t// default openssl CA bundle.\n\tcertpool := x509.NewCertPool()\n\tpemCerts, err := ioutil.ReadFile(\"samplecerts/CAfile.pem\")\n\tif err == nil {\n\t\tcertpool.AppendCertsFromPEM(pemCerts)\n\t}\n\n\t// Import client certificate/key pair\n\tcert, err := tls.LoadX509KeyPair(crtPath, keyPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create tls.Config with desired tls properties\n\treturn &tls.Config{\n\t\t// RootCAs = certs used to verify server cert.\n\t\tRootCAs: certpool,\n\t\t// ClientAuth = whether to request cert from server.\n\t\t// Since the server is set up for SSL, this happens\n\t\t// anyways.\n\t\tClientAuth: tls.NoClientCert,\n\t\t// ClientCAs = certs used to validate client cert.\n\t\tClientCAs: nil,\n\t\t// InsecureSkipVerify = verify that cert contents\n\t\t// match server. IP matches what is in cert etc.\n\t\tInsecureSkipVerify: skipVerify,\n\t\t// Certificates = list of certs client sends to server.\n\t\tCertificates: []tls.Certificate{cert},\n\t}, nil\n}", "func WithTLS(cfg *tls.Config) DialerOption {\n\treturn func(d *dialer) {\n\t\td.tlsConfig = cfg\n\t}\n}", "func newTLSConfig(clientCert, clientKey, caCert string) (*tls.Config, error) {\n\tvalid := false\n\n\tconfig := &tls.Config{}\n\n\tif clientCert != \"\" && clientKey != \"\" {\n\t\tcert, err := tls.X509KeyPair([]byte(clientCert), []byte(clientKey))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconfig.Certificates = []tls.Certificate{cert}\n\t\tconfig.BuildNameToCertificate()\n\t\tvalid = true\n\t}\n\n\tif caCert != \"\" {\n\t\tcaCertPool := x509.NewCertPool()\n\t\tcaCertPool.AppendCertsFromPEM([]byte(caCert))\n\t\tconfig.RootCAs = caCertPool\n\t\t// The CN of Heroku Kafka certs do not match the hostname of the\n\t\t// broker, but Go's default TLS behavior requires that they do.\n\t\tconfig.VerifyPeerCertificate = verifyCertSkipHostname(caCertPool)\n\t\tconfig.InsecureSkipVerify = true\n\t\tvalid = true\n\t}\n\n\tif !valid {\n\t\tconfig = nil\n\t}\n\n\treturn config, nil\n}", "func newTLSConfig(clientCert, clientKey, caCert string) (*tls.Config, error) {\n\tvalid := false\n\n\tconfig := &tls.Config{}\n\n\tif clientCert != \"\" && clientKey != \"\" {\n\t\tcert, err := tls.X509KeyPair([]byte(clientCert), []byte(clientKey))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconfig.Certificates = []tls.Certificate{cert}\n\t\tconfig.BuildNameToCertificate()\n\t\tvalid = true\n\t}\n\n\tif caCert != \"\" {\n\t\tcaCertPool := x509.NewCertPool()\n\t\tcaCertPool.AppendCertsFromPEM([]byte(caCert))\n\t\tconfig.RootCAs = caCertPool\n\t\t// The CN of Heroku Kafka certs do not match the hostname of the\n\t\t// broker, but Go's default TLS behavior requires that they do.\n\t\tconfig.VerifyPeerCertificate = verifyCertSkipHostname(caCertPool)\n\t\tconfig.InsecureSkipVerify = true\n\t\tvalid = true\n\t}\n\n\tif !valid {\n\t\tconfig = nil\n\t}\n\n\treturn config, nil\n}", "func New(opts Options) (*Transport, error) {\n\tswitch {\n\tcase opts.ServerCfg.ServerURI == \"\":\n\t\treturn nil, errors.New(\"missing server URI when creating a new transport\")\n\tcase opts.ServerCfg.CredsDialOption() == nil:\n\t\treturn nil, errors.New(\"missing credentials when creating a new transport\")\n\tcase opts.OnRecvHandler == nil:\n\t\treturn nil, errors.New(\"missing OnRecv callback handler when creating a new transport\")\n\tcase opts.OnErrorHandler == nil:\n\t\treturn nil, errors.New(\"missing OnError callback handler when creating a new transport\")\n\tcase opts.OnSendHandler == nil:\n\t\treturn nil, errors.New(\"missing OnSend callback handler when creating a new transport\")\n\t}\n\n\t// Dial the xDS management with the passed in credentials.\n\tdopts := []grpc.DialOption{\n\t\topts.ServerCfg.CredsDialOption(),\n\t\tgrpc.WithKeepaliveParams(keepalive.ClientParameters{\n\t\t\t// We decided to use these sane defaults in all languages, and\n\t\t\t// kicked the can down the road as far making these configurable.\n\t\t\tTime: 5 * time.Minute,\n\t\t\tTimeout: 20 * time.Second,\n\t\t}),\n\t}\n\tcc, err := grpcDial(opts.ServerCfg.ServerURI, dopts...)\n\tif err != nil {\n\t\t// An error from a non-blocking dial indicates something serious.\n\t\treturn nil, fmt.Errorf(\"failed to create a transport to the management server %q: %v\", opts.ServerCfg.ServerURI, err)\n\t}\n\n\tboff := opts.Backoff\n\tif boff == nil {\n\t\tboff = backoff.DefaultExponential.Backoff\n\t}\n\tret := &Transport{\n\t\tcc: cc,\n\t\tserverURI: opts.ServerCfg.ServerURI,\n\t\tonRecvHandler: opts.OnRecvHandler,\n\t\tonErrorHandler: opts.OnErrorHandler,\n\t\tonSendHandler: opts.OnSendHandler,\n\t\tlrsStore: load.NewStore(),\n\t\tbackoff: boff,\n\t\tnodeProto: opts.NodeProto,\n\t\tlogger: opts.Logger,\n\n\t\tadsStreamCh: make(chan adsStream, 1),\n\t\tadsRequestCh: buffer.NewUnbounded(),\n\t\tresources: make(map[string]map[string]bool),\n\t\tversions: make(map[string]string),\n\t\tnonces: make(map[string]string),\n\t\tadsRunnerDoneCh: make(chan struct{}),\n\t}\n\n\t// This context is used for sending and receiving RPC requests and\n\t// responses. It is also used by all the goroutines spawned by this\n\t// Transport. Therefore, cancelling this context when the transport is\n\t// closed will essentially cancel any pending RPCs, and cause the goroutines\n\t// to terminate.\n\tctx, cancel := context.WithCancel(context.Background())\n\tret.adsRunnerCancel = cancel\n\tgo ret.adsRunner(ctx)\n\n\tret.logger.Infof(\"Created transport to server %q\", ret.serverURI)\n\treturn ret, nil\n}", "func newDefaultTLSConfig(cert *tls.Certificate) (*tls.Config, error) {\n\ttlsConfig := &tls.Config{\n\t\tMinVersion: tls.VersionTLS12,\n\t\t// Prioritize cipher suites sped up by AES-NI (AES-GCM)\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\t},\n\t\tPreferServerCipherSuites: true,\n\t\t// Use curves which have assembly implementations\n\t\tCurvePreferences: []tls.CurveID{\n\t\t\ttls.CurveP256,\n\t\t\ttls.X25519,\n\t\t},\n\t\tCertificates: []tls.Certificate{*cert},\n\t\t// HTTP/2 must be enabled manually when using http.Serve\n\t\tNextProtos: []string{\"h2\"},\n\t}\n\ttlsConfig.BuildNameToCertificate()\n\treturn tlsConfig, nil\n}" ]
[ "0.62902963", "0.616452", "0.6161178", "0.58453023", "0.58117586", "0.5769236", "0.5683554", "0.5679266", "0.5537916", "0.5532538", "0.5434783", "0.5386184", "0.53491753", "0.53105533", "0.53019303", "0.5281855", "0.5261915", "0.5235258", "0.52274466", "0.52274024", "0.52274024", "0.5205211", "0.5201315", "0.5158286", "0.5151248", "0.5135499", "0.5133801", "0.5122583", "0.5095577", "0.5085333", "0.50828254", "0.50801593", "0.50666016", "0.5053201", "0.5033838", "0.5024432", "0.50233066", "0.5017911", "0.50106347", "0.5005666", "0.4993772", "0.49708512", "0.49609303", "0.49428183", "0.49413005", "0.4939193", "0.49371424", "0.49369955", "0.49331027", "0.49309513", "0.49226564", "0.49165308", "0.4911474", "0.4910168", "0.49100795", "0.48936152", "0.4893379", "0.48841503", "0.48833552", "0.48793432", "0.48759323", "0.48753542", "0.4872549", "0.48718435", "0.4869328", "0.48674065", "0.48665768", "0.48635638", "0.4851744", "0.48254755", "0.4822707", "0.48202437", "0.48189571", "0.4817854", "0.48170835", "0.4803029", "0.47877732", "0.4784633", "0.47816327", "0.477287", "0.47652274", "0.4764624", "0.47553542", "0.47547063", "0.47534838", "0.47520316", "0.4751933", "0.47461146", "0.4745169", "0.47401366", "0.47355446", "0.4735503", "0.47334158", "0.47314677", "0.47287577", "0.47281963", "0.4724802", "0.4724802", "0.47176978", "0.47147554" ]
0.8349122
0
Collect implements the Collector interface by sending the events that occured in the span to the remote collector server (see CollectorServer).
func (rc *RemoteCollector) Collect(span SpanID, anns ...Annotation) error { return rc.collectAndRetry(newCollectPacket(span, anns)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cc *ChunkedCollector) Collect(span SpanID, anns ...Annotation) error {\n\tcc.mu.Lock()\n\tdefer cc.mu.Unlock()\n\n\tif cc.stopped {\n\t\treturn errors.New(\"ChunkedCollector is stopped\")\n\t}\n\tif !cc.started {\n\t\tcc.start()\n\t}\n\n\tif cc.pendingBySpanID == nil {\n\t\tcc.pendingBySpanID = map[SpanID]*wire.CollectPacket{}\n\t}\n\n\tif p, present := cc.pendingBySpanID[span]; present {\n\t\tif len(anns) > 0 {\n\t\t\tp.Annotation = append(p.Annotation, Annotations(anns).wire()...)\n\t\t}\n\t} else {\n\t\tcc.pendingBySpanID[span] = newCollectPacket(span, anns)\n\t\tcc.pending = append(cc.pending, span)\n\t}\n\n\tif err := cc.lastErr; err != nil {\n\t\tcc.lastErr = nil\n\t\treturn err\n\t}\n\treturn nil\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\tif err := e.scrape(ch); err != nil {\n\t\tlog.Printf(\"Error scraping nightscout url: %s\", err)\n\t}\n\n\te.statusNightscout.Collect(ch)\n\n\treturn\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\tif err := e.scrape(); err != nil {\n\t\tlog.Error(err)\n\t\tnomad_up.Set(0)\n\t\tch <- nomad_up\n\t\treturn\n\t}\n\n\tch <- nomad_up\n\tch <- metric_uptime\n\tch <- metric_request_response_time_total\n\tch <- metric_request_response_time_avg\n\n\tfor _, metric := range metric_request_status_count_current {\n\t\tch <- metric\n\t}\n\tfor _, metric := range metric_request_status_count_total {\n\t\tch <- metric\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tlog.Infof(\"Syno exporter starting\")\n\tif e.Client == nil {\n\t\tlog.Errorf(\"Syno client not configured.\")\n\t\treturn\n\t}\n\terr := e.Client.Connect()\n\tif err != nil {\n\t\tlog.Errorln(\"Can't connect to Synology for SNMP: %s\", err)\n\t\treturn\n\t}\n\tdefer e.Client.SNMP.Conn.Close()\n\n\te.collectSystemMetrics(ch)\n\te.collectCPUMetrics(ch)\n\te.collectLoadMetrics(ch)\n\te.collectMemoryMetrics(ch)\n\te.collectNetworkMetrics(ch)\n\te.collectDiskMetrics(ch)\n\n\tlog.Infof(\"Syno exporter finished\")\n}", "func (collector *Collector) Collect(ch chan<- prometheus.Metric) {\n\tch <- prometheus.MustNewConstMetric(collector.incidentsCreatedCount, prometheus.CounterValue, collector.storage.GetIncidentsCreatedCount())\n}", "func (m httpReferenceDiscoveryMetrics) Collect(metrics chan<- prometheus.Metric) {\n\tm.firstPacket.Collect(metrics)\n\tm.totalTime.Collect(metrics)\n\tm.advertisedRefs.Collect(metrics)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\t// Reset metrics.\n\tfor _, vec := range e.gauges {\n\t\tvec.Reset()\n\t}\n\n\tfor _, vec := range e.counters {\n\t\tvec.Reset()\n\t}\n\n\tresp, err := e.client.Get(e.URI)\n\tif err != nil {\n\t\te.up.Set(0)\n\t\tlog.Printf(\"Error while querying Elasticsearch: %v\", err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tlog.Printf(\"Failed to read ES response body: %v\", err)\n\t\te.up.Set(0)\n\t\treturn\n\t}\n\n\te.up.Set(1)\n\n\tvar all_stats NodeStatsResponse\n\terr = json.Unmarshal(body, &all_stats)\n\n\tif err != nil {\n\t\tlog.Printf(\"Failed to unmarshal JSON into struct: %v\", err)\n\t\treturn\n\t}\n\n\t// Regardless of whether we're querying the local host or the whole\n\t// cluster, here we can just iterate through all nodes found.\n\n\tfor node, stats := range all_stats.Nodes {\n\t\tlog.Printf(\"Processing node %v\", node)\n\t\t// GC Stats\n\t\tfor collector, gcstats := range stats.JVM.GC.Collectors {\n\t\t\te.counters[\"jvm_gc_collection_count\"].WithLabelValues(all_stats.ClusterName, stats.Name, collector).Set(float64(gcstats.CollectionCount))\n\t\t\te.counters[\"jvm_gc_collection_time_in_millis\"].WithLabelValues(all_stats.ClusterName, stats.Name, collector).Set(float64(gcstats.CollectionTime))\n\t\t}\n\n\t\t// Breaker stats\n\t\tfor breaker, bstats := range stats.Breakers {\n\t\t\te.gauges[\"breakers_estimated_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name, breaker).Set(float64(bstats.EstimatedSize))\n\t\t\te.gauges[\"breakers_limit_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name, breaker).Set(float64(bstats.LimitSize))\n\t\t}\n\n\t\t// JVM Memory Stats\n\t\te.gauges[\"jvm_mem_heap_committed_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.HeapCommitted))\n\t\te.gauges[\"jvm_mem_heap_used_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.HeapUsed))\n\t\te.gauges[\"jvm_mem_heap_max_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.HeapMax))\n\t\te.gauges[\"jvm_mem_non_heap_committed_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.NonHeapCommitted))\n\t\te.gauges[\"jvm_mem_non_heap_used_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.JVM.Mem.NonHeapUsed))\n\n\t\t// Indices Stats\n\t\te.gauges[\"indices_fielddata_evictions\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.FieldData.Evictions))\n\t\te.gauges[\"indices_fielddata_memory_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.FieldData.MemorySize))\n\t\te.gauges[\"indices_filter_cache_evictions\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.FilterCache.Evictions))\n\t\te.gauges[\"indices_filter_cache_memory_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.FilterCache.MemorySize))\n\n\t\te.gauges[\"indices_docs_count\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Docs.Count))\n\t\te.gauges[\"indices_docs_deleted\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Docs.Deleted))\n\n\t\te.gauges[\"indices_segments_memory_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Segments.Memory))\n\n\t\te.gauges[\"indices_store_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Store.Size))\n\t\te.counters[\"indices_store_throttle_time_in_millis\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Store.ThrottleTime))\n\n\t\te.counters[\"indices_flush_total\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Flush.Total))\n\t\te.counters[\"indices_flush_time_in_millis\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Indices.Flush.Time))\n\n\t\t// Transport Stats\n\t\te.counters[\"transport_rx_count\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Transport.RxCount))\n\t\te.counters[\"transport_rx_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Transport.RxSize))\n\t\te.counters[\"transport_tx_count\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Transport.TxCount))\n\t\te.counters[\"transport_tx_size_in_bytes\"].WithLabelValues(all_stats.ClusterName, stats.Name).Set(float64(stats.Transport.TxSize))\n\t}\n\n\t// Report metrics.\n\tch <- e.up\n\n\tfor _, vec := range e.counters {\n\t\tvec.Collect(ch)\n\t}\n\n\tfor _, vec := range e.gauges {\n\t\tvec.Collect(ch)\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\tif err := e.collect(ch); err != nil {\n\t\tlog.Errorf(\"Error scraping ingestor: %s\", err)\n\t}\n\treturn\n}", "func (m *Monitoring) collect() {\n\tfor {\n\t\tevents, ok := <-m.ch\n\t\tif !ok {\n\t\t\tlog.Printf(\"event channel is closed\")\n\t\t\treturn\n\t\t}\n\n\t\tif err := m.w.Write(context.Background(), events); err != nil {\n\t\t\tlog.Printf(\"failed to write metric events %+v: %v\", events, err)\n\t\t}\n\t}\n\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tjunosTotalScrapeCount++\n\tch <- prometheus.MustNewConstMetric(junosDesc[\"ScrapesTotal\"], prometheus.CounterValue, junosTotalScrapeCount)\n\n\twg := &sync.WaitGroup{}\n\tfor _, collector := range e.Collectors {\n\t\twg.Add(1)\n\t\tgo e.runCollector(ch, collector, wg)\n\t}\n\twg.Wait()\n}", "func (e *exporter) Collect(ch chan<- prometheus.Metric) {\n\twg := sync.WaitGroup{}\n\twg.Add(len(e.Collectors))\n\tfor name, c := range e.Collectors {\n\t\tgo func(name string, c Collector) {\n\t\t\texecute(name, c, ch)\n\t\t\twg.Done()\n\t\t}(name, c)\n\t}\n\twg.Wait()\n}", "func Collect(metrics []Metric, c CloudWatchService, namespace string) {\n\tid, err := GetInstanceID()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor _, metric := range metrics {\n\t\tmetric.Collect(id, c, namespace)\n\t}\n}", "func (*noOpConntracker) Collect(ch chan<- prometheus.Metric) {}", "func (c *bgpCollector) Collect(client collector.Client, ch chan<- prometheus.Metric, labelValues []string) error {\n\terr := c.collect(client, ch, labelValues)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\t// Protect metrics from concurrent collects.\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\n\t// Scrape metrics from Tankerkoenig API.\n\tif err := e.scrape(ch); err != nil {\n\t\te.logger.Printf(\"error: cannot scrape tankerkoenig api: %v\", err)\n\t}\n\n\t// Collect metrics.\n\te.up.Collect(ch)\n\te.scrapeDuration.Collect(ch)\n\te.failedScrapes.Collect(ch)\n\te.totalScrapes.Collect(ch)\n}", "func (c *transportNodeCollector) Collect(ch chan<- prometheus.Metric) {\n\ttransportNodeMetrics := c.generateTransportNodeMetrics()\n\tfor _, metric := range transportNodeMetrics {\n\t\tch <- metric\n\t}\n}", "func (b *EBPFTelemetry) Collect(ch chan<- prometheus.Metric) {\n\tb.getHelpersTelemetry(ch)\n\tb.getMapsTelemetry(ch)\n}", "func (e *ebpfConntracker) Collect(ch chan<- prometheus.Metric) {\n\tebpfTelemetry := &netebpf.ConntrackTelemetry{}\n\tif err := e.telemetryMap.Lookup(unsafe.Pointer(&zero), unsafe.Pointer(ebpfTelemetry)); err != nil {\n\t\tlog.Tracef(\"error retrieving the telemetry struct: %s\", err)\n\t} else {\n\t\tdelta := ebpfTelemetry.Registers - conntrackerTelemetry.lastRegisters\n\t\tconntrackerTelemetry.lastRegisters = ebpfTelemetry.Registers\n\t\tch <- prometheus.MustNewConstMetric(conntrackerTelemetry.registersTotal, prometheus.CounterValue, float64(delta))\n\t}\n}", "func (a collectorAdapter) Collect(ch chan<- prometheus.Metric) {\n\tif err := a.Update(ch); err != nil {\n\t\tpanic(fmt.Sprintf(\"failed to update collector: %v\", err))\n\t}\n}", "func (c *Client) Collect(s stat.Stat) error {\n\tbuf, err := json.Marshal(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/collect\", c.url), bytes.NewBuffer(buf))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn errors.Wrap(errors.New(resp.Status), \"statscoll\")\n\t}\n\n\treturn nil\n}", "func (c *interfaceCollector) Collect(client *rpc.Client, ch chan<- prometheus.Metric, labelValues []string) error {\n\tstats, err := c.interfaceStats(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, s := range stats {\n\t\tc.collectForInterface(s, ch, labelValues)\n\t}\n\n\treturn nil\n}", "func (d *decorator) Collect(in chan<- prometheus.Metric) {\n\td.duration.Collect(in)\n\td.requests.Collect(in)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\tif err := e.collect(ch); err != nil {\n\t\tlog.Errorf(\"Error scraping: %s\", err)\n\t}\n\treturn\n}", "func (o *observer) Collect(ch chan<- prometheus.Metric) {\n\to.updateError.Collect(ch)\n\to.verifyError.Collect(ch)\n\to.expiration.Collect(ch)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mu.Lock()\n\tdefer e.mu.Unlock()\n\n\tfor _, cc := range e.collectors {\n\t\tcc.Collect(ch)\n\t}\n}", "func (m *ClientMetrics) Collect(ch chan<- prom.Metric) {\n\tm.clientStartedCounter.Collect(ch)\n\tm.clientHandledCounter.Collect(ch)\n\tm.clientStreamMsgReceived.Collect(ch)\n\tm.clientStreamMsgSent.Collect(ch)\n\tif m.clientHandledHistogramEnabled {\n\t\tm.clientHandledHistogram.Collect(ch)\n\t}\n}", "func (o *requestMetrics) Collect(ch chan<- prometheus.Metric) {\n\tmetricFamilies, err := o.stStore.GetPromDirectMetrics()\n\tif err != nil {\n\t\tklog.Errorf(\"fetch prometheus metrics failed: %v\", err)\n\t\treturn\n\t}\n\to.handleMetrics(metricFamilies, ch)\n}", "func (m *ClientMetrics) Collect(ch chan<- prometheus.Metric) {\n\tm.clientHandledSummary.Collect(ch)\n}", "func (c *CadvisorCollector) Collect(ch chan<- datapoint.Datapoint) {\n\tc.collectMachineInfo(ch)\n\tc.collectVersionInfo(ch)\n\tc.collectContainersInfo(ch)\n\t//c.errors.Collect(ch)\n}", "func (h *Metrics) Collect(in chan<- prometheus.Metric) {\n\th.duration.Collect(in)\n\th.totalRequests.Collect(in)\n\th.requestSize.Collect(in)\n\th.responseSize.Collect(in)\n\th.handlerStatuses.Collect(in)\n\th.responseTime.Collect(in)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\tup := e.scrape(ch)\n\n\tch <- prometheus.MustNewConstMetric(artifactoryUp, prometheus.GaugeValue, up)\n\tch <- e.totalScrapes\n\tch <- e.jsonParseFailures\n}", "func (collector *collector) Collect(ch chan<- prometheus.Metric) {\n\tcontainerNames, err := collector.server.GetContainerNames()\n\tif err != nil {\n\t\tcollector.logger.Printf(\"Can't query container names: %s\", err)\n\t\treturn\n\t}\n\n\tfor _, containerName := range containerNames {\n\t\tstate, _, err := collector.server.GetContainerState(containerName)\n\t\tif err != nil {\n\t\t\tcollector.logger.Printf(\n\t\t\t\t\"Can't query container state for `%s`: %s\", containerName, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tcollector.collectContainerMetrics(ch, containerName, state)\n\t}\n}", "func (c *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, cc := range c.collectors {\n\t\tcc.Collect(ch)\n\t}\n}", "func (c *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, cc := range c.collectors {\n\t\tcc.Collect(ch)\n\t}\n}", "func (c *Collector) Collect(ch chan<- prometheus.Metric) {\n\tc.mut.RLock()\n\tdefer c.mut.RUnlock()\n\n\tif c.inner != nil {\n\t\tc.inner.Collect(ch)\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.withCollectors(func(cs []prometheus.Collector) {\n\t\tfor _, c := range cs {\n\t\t\tc.Collect(ch)\n\t\t}\n\t})\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\n\te.scrape()\n\n\te.up.Collect(ch)\n\te.totalScrapes.Collect(ch)\n\te.exchangeStatus.Collect(ch)\n\te.ltp.Collect(ch)\n\te.bestBid.Collect(ch)\n\te.bestAsk.Collect(ch)\n\te.bestBidSize.Collect(ch)\n\te.bestAskSize.Collect(ch)\n\te.totalBidDepth.Collect(ch)\n\te.totalAskDepth.Collect(ch)\n\te.volume.Collect(ch)\n\te.volumeByProduct.Collect(ch)\n}", "func (c *Collector) Collect(ch chan<- prometheus.Metric) {\n\tsess, err := sessions.CreateAWSSession()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\t// Init WaitGroup. Without a WaitGroup the channel we write\n\t// results to will close before the goroutines finish\n\tvar wg sync.WaitGroup\n\twg.Add(len(c.Scrapers))\n\n\t// Iterate through all scrapers and invoke the scrape\n\tfor _, scraper := range c.Scrapers {\n\t\t// Wrape the scrape invocation in a goroutine, but we need to pass\n\t\t// the scraper into the function explicitly to re-scope the variable\n\t\t// the goroutine accesses. If we don't do this, we can sometimes hit\n\t\t// a case where the scraper reports results twice and the collector panics\n\t\tgo func(scraper *Scraper) {\n\t\t\t// Done call deferred until end of the scrape\n\t\t\tdefer wg.Done()\n\n\t\t\tlog.Debugf(\"Running scrape: %s\", scraper.ID)\n\t\t\tscrapeResults := scraper.Scrape(sess)\n\n\t\t\t// Iterate through scrape results and send the metric\n\t\t\tfor key, results := range scrapeResults {\n\t\t\t\tfor _, result := range results {\n\t\t\t\t\tch <- prometheus.MustNewConstMetric(scraper.Metrics[key].metric, result.Type, result.Value, result.Labels...)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Debugf(\"Scrape completed: %s\", scraper.ID)\n\t\t}(scraper)\n\t}\n\t// Wait\n\twg.Wait()\n}", "func (p *Collector) Collect(c chan<- prometheus.Metric) {\n\tp.Sink.mu.Lock()\n\tdefer p.Sink.mu.Unlock()\n\n\texpire := p.Sink.expiration != 0\n\tnow := time.Now()\n\tfor k, v := range p.Sink.gauges {\n\t\tlast := p.Sink.updates[k]\n\t\tif expire && last.Add(p.Sink.expiration).Before(now) {\n\t\t\tdelete(p.Sink.updates, k)\n\t\t\tdelete(p.Sink.gauges, k)\n\t\t} else {\n\t\t\tv.Collect(c)\n\t\t}\n\t}\n\tfor k, v := range p.Sink.summaries {\n\t\tlast := p.Sink.updates[k]\n\t\tif expire && last.Add(p.Sink.expiration).Before(now) {\n\t\t\tdelete(p.Sink.updates, k)\n\t\t\tdelete(p.Sink.summaries, k)\n\t\t} else {\n\t\t\tv.Collect(c)\n\t\t}\n\t}\n\tfor k, v := range p.Sink.counters {\n\t\tlast := p.Sink.updates[k]\n\t\tif expire && last.Add(p.Sink.expiration).Before(now) {\n\t\t\tdelete(p.Sink.updates, k)\n\t\t\tdelete(p.Sink.counters, k)\n\t\t} else {\n\t\t\tv.Collect(c)\n\t\t}\n\t}\n}", "func (c *VMCollector) Collect(ch chan<- prometheus.Metric) {\n\tfor _, m := range c.getMetrics() {\n\t\tch <- m\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\tif err := e.collect(ch); err != nil {\n\t\tglog.Error(fmt.Sprintf(\"Error collecting stats: %s\", err))\n\t}\n\treturn\n}", "func (c *Client) Collect(ch chan<- prometheus.Metric) {\n\tc.metrics.functionInvocation.Collect(ch)\n\tc.metrics.functionsHistogram.Collect(ch)\n\tc.metrics.queueHistogram.Collect(ch)\n\tc.metrics.functionInvocationStarted.Collect(ch)\n\tc.metrics.serviceReplicasGauge.Reset()\n\tfor _, service := range c.services {\n\t\tvar serviceName string\n\t\tif len(service.Namespace) > 0 {\n\t\t\tserviceName = fmt.Sprintf(\"%s.%s\", service.Name, service.Namespace)\n\t\t} else {\n\t\t\tserviceName = service.Name\n\t\t}\n\t\tc.metrics.serviceReplicasGauge.\n\t\t\tWithLabelValues(serviceName).\n\t\t\tSet(float64(service.Replicas))\n\t}\n\tc.metrics.serviceReplicasGauge.Collect(ch)\n}", "func (n NodeCollector) Collect(ch chan<- prometheus.Metric) {\n\twg := sync.WaitGroup{}\n\twg.Add(len(n.collectors))\n\tfor name, c := range n.collectors {\n\t\tgo func(name string, c collector.Collector) {\n\t\t\texecute(name, c, ch)\n\t\t\twg.Done()\n\t\t}(name, c)\n\t}\n\twg.Wait()\n\tscrapeDurations.Collect(ch)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tok := e.collectPeersMetric(ch)\n\tok = e.collectLeaderMetric(ch) && ok\n\tok = e.collectNodesMetric(ch) && ok\n\tok = e.collectMembersMetric(ch) && ok\n\tok = e.collectMembersWanMetric(ch) && ok\n\tok = e.collectServicesMetric(ch) && ok\n\tok = e.collectHealthStateMetric(ch) && ok\n\tok = e.collectKeyValues(ch) && ok\n\n\tif ok {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tup, prometheus.GaugeValue, 1.0,\n\t\t)\n\t} else {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tup, prometheus.GaugeValue, 0.0,\n\t\t)\n\t}\n}", "func (c *solarCollector) Collect(ch chan<- prometheus.Metric) {\n\tc.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer c.mutex.Unlock()\n\tif err := c.collect(ch); err != nil {\n\t\tlog.Printf(\"Error getting solar controller data: %s\", err)\n\t\tc.scrapeFailures.Inc()\n\t\tc.scrapeFailures.Collect(ch)\n\t}\n\treturn\n}", "func (e *UwsgiExporter) Collect(ch chan<- prometheus.Metric) {\n\tstartTime := time.Now()\n\terr := e.execute(ch)\n\td := time.Since(startTime).Seconds()\n\n\tif err != nil {\n\t\tlog.Errorf(\"ERROR: scrape failed after %fs: %s\", d, err)\n\t\te.uwsgiUp.Set(0)\n\t\te.scrapeDurations.WithLabelValues(\"error\").Observe(d)\n\t} else {\n\t\tlog.Debugf(\"OK: scrape successful after %fs.\", d)\n\t\te.uwsgiUp.Set(1)\n\t\te.scrapeDurations.WithLabelValues(\"success\").Observe(d)\n\t}\n\n\te.uwsgiUp.Collect(ch)\n\te.scrapeDurations.Collect(ch)\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n if err := e.scrape(ch); err != nil {\n\t\tlog.Infof(\"Error scraping tinystats: %s\", err)\n\t}\n e.ipv4QueryA.Collect(ch)\n e.ipv4QueryNS.Collect(ch)\n e.ipv4QueryCNAME.Collect(ch)\n e.ipv4QuerySOA.Collect(ch)\n e.ipv4QueryPTR.Collect(ch)\n e.ipv4QueryHINFO.Collect(ch)\n e.ipv4QueryMX.Collect(ch)\n e.ipv4QueryTXT.Collect(ch)\n e.ipv4QueryRP.Collect(ch)\n e.ipv4QuerySIG.Collect(ch)\n e.ipv4QueryKEY.Collect(ch)\n e.ipv4QueryAAAA.Collect(ch)\n e.ipv4QueryAXFR.Collect(ch)\n e.ipv4QueryANY.Collect(ch)\n e.ipv4QueryTOTAL.Collect(ch)\n e.ipv4QueryOTHER.Collect(ch)\n e.ipv4QueryNOTAUTH.Collect(ch)\n e.ipv4QueryNOTIMPL.Collect(ch)\n e.ipv4QueryBADCLASS.Collect(ch)\n e.ipv4QueryNOQUERY.Collect(ch)\n\n e.ipv6QueryA.Collect(ch)\n e.ipv6QueryNS.Collect(ch)\n e.ipv6QueryCNAME.Collect(ch)\n e.ipv6QuerySOA.Collect(ch)\n e.ipv6QueryPTR.Collect(ch)\n e.ipv6QueryHINFO.Collect(ch)\n e.ipv6QueryMX.Collect(ch)\n e.ipv6QueryTXT.Collect(ch)\n e.ipv6QueryRP.Collect(ch)\n e.ipv6QuerySIG.Collect(ch)\n e.ipv6QueryKEY.Collect(ch)\n e.ipv6QueryAAAA.Collect(ch)\n e.ipv6QueryAXFR.Collect(ch)\n e.ipv6QueryANY.Collect(ch)\n e.ipv6QueryTOTAL.Collect(ch)\n e.ipv6QueryOTHER.Collect(ch)\n e.ipv6QueryNOTAUTH.Collect(ch)\n e.ipv6QueryNOTIMPL.Collect(ch)\n e.ipv6QueryBADCLASS.Collect(ch)\n e.ipv6QueryNOQUERY.Collect(ch)\n\n\treturn\n}", "func (c *collector) Collect(ch chan<- prometheus.Metric) {\n\tc.m.Lock()\n\tfor _, m := range c.metrics {\n\t\tch <- m.metric\n\t}\n\tc.m.Unlock()\n}", "func (c *CephExporter) Collect(ch chan<- prometheus.Metric) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, cc := range c.collectors {\n\t\tcc.Collect(ch)\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\te.zpool.getStatus()\n\te.poolUsage.Set(float64(e.zpool.capacity))\n\te.providersOnline.Set(float64(e.zpool.online))\n\te.providersFaulted.Set(float64(e.zpool.faulted))\n\n\tch <- e.poolUsage\n\tch <- e.providersOnline\n\tch <- e.providersFaulted\n}", "func (c *TCPCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {\n\tif desc, err := c.collect(ctx, ch); err != nil {\n\t\t_ = level.Error(c.logger).Log(\"failed collecting tcp metrics\", \"desc\", desc, \"err\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *NetSocket) Collect(ctx context.Context) error {\n\tmetrics := cgm.Metrics{}\n\n\tc.Lock()\n\n\tif c.runTTL > time.Duration(0) {\n\t\tif time.Since(c.lastEnd) < c.runTTL {\n\t\t\tc.logger.Warn().Msg(collector.ErrTTLNotExpired.Error())\n\t\t\tc.Unlock()\n\t\t\treturn collector.ErrTTLNotExpired\n\t\t}\n\t}\n\tif c.running {\n\t\tc.logger.Warn().Msg(collector.ErrAlreadyRunning.Error())\n\t\tc.Unlock()\n\t\treturn collector.ErrAlreadyRunning\n\t}\n\n\tc.running = true\n\tc.lastStart = time.Now()\n\tc.Unlock()\n\n\tif err := c.sockstatCollect(ctx, &metrics); err != nil {\n\t\tc.logger.Warn().Err(err).Msg(\"sockstat\")\n\t}\n\n\tc.setStatus(metrics, nil)\n\treturn nil\n}", "func (as *AggregateStore) Collect(id SpanID, anns ...Annotation) error {\n\tas.mu.Lock()\n\tdefer as.mu.Unlock()\n\n\t// Initialization\n\tif as.groups == nil {\n\t\tas.groups = make(map[ID]*spanGroup)\n\t\tas.groupsByName = make(map[string]ID)\n\t\tas.pre = &LimitStore{\n\t\t\tMax: as.MaxRate,\n\t\t\tDeleteStore: NewMemoryStore(),\n\t\t}\n\t}\n\n\t// Collect into the limit store.\n\tif err := as.pre.Collect(id, anns...); err != nil {\n\t\treturn err\n\t}\n\n\t// Consider eviction of old data.\n\tif time.Since(as.lastEvicted) > as.MinEvictAge {\n\t\tif err := as.evictBefore(time.Now().Add(-1 * as.MinEvictAge)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Grab the group for our span.\n\tgroup, ok := as.group(id, anns...)\n\tif !ok {\n\t\t// We don't have a group for the trace, and can't create one (the\n\t\t// spanName event isn't present yet).\n\t\treturn nil\n\t}\n\n\t// Unmarshal the events.\n\tvar events []Event\n\tif err := UnmarshalEvents(anns, &events); err != nil {\n\t\treturn err\n\t}\n\n\t// Find the start and end time of the trace.\n\teStart, eEnd, ok := findTraceTimes(events)\n\tif !ok {\n\t\t// We didn't find any timespan events at all, so we're done here.\n\t\treturn nil\n\t}\n\n\t// Update the group to consider this trace being one of the slowest.\n\tgroup.update(eStart, eEnd, id.Trace, func(trace ID) {\n\t\t// Delete the request trace from the output store.\n\t\tif err := as.deleteOutput(trace); err != nil {\n\t\t\tlog.Printf(\"AggregateStore: failed to delete a trace: %s\", err)\n\t\t}\n\t})\n\n\t// Move traces from the limit store into the group, as needed.\n\tfor _, slowest := range group.Slowest {\n\t\t// Find the trace in the limit store.\n\t\ttrace, err := as.pre.Trace(slowest.TraceID)\n\t\tif err == ErrTraceNotFound {\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Place into output store.\n\t\tvar walk func(t *Trace) error\n\t\twalk = func(t *Trace) error {\n\t\t\terr := as.MemoryStore.Collect(t.Span.ID, t.Span.Annotations...)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, sub := range t.Sub {\n\t\t\t\tif err := walk(sub); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif err := walk(trace); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Delete from the limit store.\n\t\terr = as.pre.Delete(slowest.TraceID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Prepare the aggregation event (before locking below).\n\tev := &AggregateEvent{\n\t\tName: group.Name,\n\t\tTimes: group.Times,\n\t}\n\tfor _, slowest := range group.Slowest {\n\t\tif !slowest.empty() {\n\t\t\tev.Slowest = append(ev.Slowest, slowest.TraceID)\n\t\t}\n\t}\n\tif as.Debug && len(ev.Slowest) == 0 {\n\t\tlog.Printf(\"AggregateStore: no slowest traces for group %q (consider increasing MaxRate)\", group.Name)\n\t}\n\n\t// As we're updating the aggregation event, we go ahead and delete the old\n\t// one now. We do this all under as.MemoryStore.Lock otherwise users (e.g. the\n\t// web UI) can pull from as.MemoryStore when the trace has been deleted.\n\tas.MemoryStore.Lock()\n\tdefer as.MemoryStore.Unlock()\n\tif err := as.MemoryStore.deleteNoLock(group.Trace); err != nil {\n\t\treturn err\n\t}\n\n\t// Record an aggregate event with the given name.\n\trecEvent := func(e Event) error {\n\t\tanns, err := MarshalEvent(e)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn as.MemoryStore.collectNoLock(SpanID{Trace: group.Trace}, anns...)\n\t}\n\tif err := recEvent(spanName{Name: group.Name}); err != nil {\n\t\treturn err\n\t}\n\tif err := recEvent(ev); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m *MeterImpl) collect(ctx context.Context, labels []attribute.KeyValue, measurements []Measurement) {\n\tm.provider.addMeasurement(Batch{\n\t\tCtx: ctx,\n\t\tLabels: labels,\n\t\tMeasurements: measurements,\n\t\tLibrary: m.library,\n\t})\n}", "func (c *collector) Collect(ch chan<- prometheus.Metric) {\n\tif c.client == nil {\n\t\tsigChannel := make(chan os.Signal)\n\t\tsignal.Notify(sigChannel, os.Interrupt, syscall.SIGTERM)\n\t\tclientOptions := []hilink.Option{\n\t\t\thilink.URL(*c.options.Url),\n\t\t}\n\t\tif *c.options.Password != \"\" {\n\t\t\tclientOptions = append(clientOptions, hilink.Auth(*c.options.Username, *c.options.Password))\n\t\t}\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"url\": *c.options.Url,\n\t\t\t\"user\": *c.options.Username,\n\t\t}).Debug(\"Connecting\")\n\t\tclient, err := hilink.NewClient(clientOptions...)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Unable to contact device: %s\", err)\n\t\t}\n\t\tgo func() {\n\t\t\t<-sigChannel\n\t\t\tlog.Info(\"Stopping, disconnecting from device\")\n\t\t\tc.client.Disconnect()\n\t\t\tos.Exit(0)\n\t\t}()\n\t\tc.client = client\n\t\tdefer c.client.Disconnect()\n\t}\n\n\twg := sync.WaitGroup{}\n\tfor _, collector := range c.collectors {\n\t\tcol := collector\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tctx := &collectorContext{ch, c.client}\n\t\t\terr := col.collect(ctx)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\twg.Wait()\n\n}", "func (c *Collector) Collect(ch chan<- prometheus.Metric) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tc.totalScrapes.Inc()\n\terr := c.getDadataBalance()\n\tif err != nil {\n\t\tc.failedBalanceScrapes.Inc()\n\t}\n\terr = c.getDadataStats()\n\tif err != nil {\n\t\tc.failedStatsScrapes.Inc()\n\t}\n\n\tch <- c.totalScrapes\n\tch <- c.failedBalanceScrapes\n\tch <- c.failedStatsScrapes\n\tch <- c.CurrentBalance\n\tch <- c.ServicesClean\n\tch <- c.ServicesMerging\n\tch <- c.ServicesSuggestions\n}", "func (w *Writer) Collect(ch chan<- prometheus.Metric) {\n\tw.kafkaWriteStatus.Collect(ch)\n\tw.queuedForWrites.Collect(ch)\n}", "func (m *Client) Collect(ch chan<- prometheus.Metric) {\n\tm.storeMu.Lock()\n\tdefer m.storeMu.Unlock()\n\n\tch <- prometheus.MustNewConstMetric(m.storeValuesDesc, prometheus.GaugeValue, float64(len(m.store)))\n\n\tfor k, v := range m.store {\n\t\tch <- prometheus.MustNewConstMetric(m.storeSizesDesc, prometheus.GaugeValue, float64(len(v.value)), k)\n\t}\n}", "func (coll WmiCollector) Collect(ch chan<- prometheus.Metric) {\n\texecute(coll.collector, ch)\n}", "func collect(emit emitFn, c collector) {\n\tswitch cc := c.(type) {\n\tdefault:\n\t\tlog.Panicf(\"unsupported collector type: %T\", c)\n\n\tcase statsCollector:\n\t\tresp, err := Client.Stat.Get(c.Subsystem())\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\t\tlogPanics(func() {\n\t\t\tcc.CollectStats(emit, resp)\n\t\t})\n\n\tcase configCollector:\n\t\tresp, err := Client.Config.Get(c.Subsystem())\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\t\tlogPanics(func() {\n\t\t\tcc.CollectConfig(emit, resp)\n\t\t})\n\t}\n}", "func (sc *SlurmCollector) Collect(ch chan<- prometheus.Metric) {\n\tsc.mutex.Lock()\n\tdefer sc.mutex.Unlock()\n\n\tlog.Debugf(\"Time since last scrape: %f seconds\", time.Since(sc.lastScrape).Seconds())\n\tif time.Since(sc.lastScrape).Seconds() > float64(sc.scrapeInterval) {\n\t\tsc.updateDynamicJobIds()\n\t\tvar err error\n\t\tsc.sshClient, err = sc.sshConfig.NewClient()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Creating SSH client: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tdefer sc.sshClient.Close()\n\t\tlog.Infof(\"Collecting metrics from Slurm...\")\n\t\tsc.trackedJobs = make(map[string]bool)\n\t\tif sc.targetJobIds == \"\" {\n\t\t\t// sc.collectQueue()\n\t\t} else {\n\t\t\tsc.collectAcct()\n\t\t}\n\t\tif !sc.skipInfra {\n\t\t\tsc.collectInfo()\n\t\t}\n\t\tsc.lastScrape = time.Now()\n\t\tsc.delJobs()\n\n\t}\n\n\tsc.updateMetrics(ch)\n}", "func (c *beatCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n}", "func (n LXCCollector) Collect(ch chan<- prometheus.Metric) {\n\twg := sync.WaitGroup{}\n\twg.Add(len(n.collectors))\n\tfor name, c := range n.collectors {\n\t\tgo func(name string, c collector.Collector) {\n\t\t\texecute(name, c, ch)\n\t\t\twg.Done()\n\t\t}(name, c)\n\t}\n\twg.Wait()\n\tscrapeDurations.Collect(ch)\n}", "func (c *metricbeatCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n}", "func (c *analysisRunCollector) Collect(ch chan<- prometheus.Metric) {\n\tanalysisRuns, err := c.store.List(labels.NewSelector())\n\tif err != nil {\n\t\tlog.Warnf(\"Failed to collect analysisRuns: %v\", err)\n\t\treturn\n\t}\n\tfor _, ar := range analysisRuns {\n\t\tcollectAnalysisRuns(ch, ar)\n\t}\n}", "func (o *OSDCollector) Collect(ch chan<- prometheus.Metric) {\n\tif err := o.collectOSDPerf(); err != nil {\n\t\tlog.Println(\"failed collecting osd perf stats:\", err)\n\t}\n\n\tif err := o.collectOSDDump(); err != nil {\n\t\tlog.Println(\"failed collecting osd dump:\", err)\n\t}\n\n\tif err := o.collectOSDDF(); err != nil {\n\t\tlog.Println(\"failed collecting osd metrics:\", err)\n\t}\n\n\tif err := o.collectOSDTreeDown(ch); err != nil {\n\t\tlog.Println(\"failed collecting osd metrics:\", err)\n\t}\n\n\tfor _, metric := range o.collectorList() {\n\t\tmetric.Collect(ch)\n\t}\n\n\tif err := o.collectOSDScrubState(ch); err != nil {\n\t\tlog.Println(\"failed collecting osd scrub state:\", err)\n\t}\n}", "func (pc *PBSCollector) Collect(ch chan<- prometheus.Metric) {\n\tpc.mutex.Lock()\n\tdefer pc.mutex.Unlock()\n\tlog.Debugf(\"Time since last scrape: %f seconds\", time.Since(pc.lastScrape).Seconds())\n\n\tif time.Since(pc.lastScrape).Seconds() > float64(pc.scrapeInterval) {\n\t\tpc.updateDynamicJobIds()\n\t\tvar err error\n\t\tpc.sshClient, err = pc.sshConfig.NewClient()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Creating SSH client: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tdefer pc.sshClient.Close()\n\t\tlog.Infof(\"Collecting metrics from PBS...\")\n\t\tpc.trackedJobs = make(map[string]bool)\n\t\tif pc.targetJobIds != \"\" {\n\t\t\tpc.collectJobs(ch)\n\t\t}\n\t\tif !pc.skipInfra {\n\t\t\tpc.collectQueues(ch)\n\t\t}\n\t\tpc.lastScrape = time.Now()\n\t}\n\tpc.updateMetrics(ch)\n}", "func (c *auditdCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\n\tfor _, vec := range e.gauges {\n\t\tvec.Reset()\n\t}\n\n\tdefer func() { ch <- e.up }()\n\n\t// If we fail at any point in retrieving GPU status, we fail 0\n\te.up.Set(1)\n\n\te.GetTelemetryFromNVML()\n\n\tfor _, vec := range e.gauges {\n\t\tvec.Collect(ch)\n\t}\n}", "func (c *Collector) Collect(sampleContainers []stats.SampleContainer) {\n\tselect {\n\tcase <-c.stopSendingMetricsCh:\n\t\treturn\n\tdefault:\n\t}\n\n\tif c.referenceID == \"\" {\n\t\treturn\n\t}\n\n\tnewSamples := []*Sample{}\n\tnewHTTPTrails := []*httpext.Trail{}\n\n\tfor _, sampleContainer := range sampleContainers {\n\t\tswitch sc := sampleContainer.(type) {\n\t\tcase *httpext.Trail:\n\t\t\tsc = useCloudTags(sc)\n\t\t\t// Check if aggregation is enabled,\n\t\t\tif c.config.AggregationPeriod.Duration > 0 {\n\t\t\t\tnewHTTPTrails = append(newHTTPTrails, sc)\n\t\t\t} else {\n\t\t\t\tnewSamples = append(newSamples, NewSampleFromTrail(sc))\n\t\t\t}\n\t\tcase *netext.NetTrail:\n\t\t\t// TODO: aggregate?\n\t\t\tvalues := map[string]float64{\n\t\t\t\tmetrics.DataSent.Name: float64(sc.BytesWritten),\n\t\t\t\tmetrics.DataReceived.Name: float64(sc.BytesRead),\n\t\t\t}\n\n\t\t\tif sc.FullIteration {\n\t\t\t\tvalues[metrics.IterationDuration.Name] = stats.D(sc.EndTime.Sub(sc.StartTime))\n\t\t\t\tvalues[metrics.Iterations.Name] = 1\n\t\t\t}\n\n\t\t\tnewSamples = append(newSamples, &Sample{\n\t\t\t\tType: DataTypeMap,\n\t\t\t\tMetric: \"iter_li_all\",\n\t\t\t\tData: &SampleDataMap{\n\t\t\t\t\tTime: toMicroSecond(sc.GetTime()),\n\t\t\t\t\tTags: sc.GetTags(),\n\t\t\t\t\tValues: values,\n\t\t\t\t},\n\t\t\t})\n\t\tdefault:\n\t\t\tfor _, sample := range sampleContainer.GetSamples() {\n\t\t\t\tnewSamples = append(newSamples, &Sample{\n\t\t\t\t\tType: DataTypeSingle,\n\t\t\t\t\tMetric: sample.Metric.Name,\n\t\t\t\t\tData: &SampleDataSingle{\n\t\t\t\t\t\tType: sample.Metric.Type,\n\t\t\t\t\t\tTime: toMicroSecond(sample.Time),\n\t\t\t\t\t\tTags: sample.Tags,\n\t\t\t\t\t\tValue: sample.Value,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(newSamples) > 0 || len(newHTTPTrails) > 0 {\n\t\tc.bufferMutex.Lock()\n\t\tc.bufferSamples = append(c.bufferSamples, newSamples...)\n\t\tc.bufferHTTPTrails = append(c.bufferHTTPTrails, newHTTPTrails...)\n\t\tc.bufferMutex.Unlock()\n\t}\n}", "func (coll WmiCollector) Collect(ch chan<- prometheus.Metric) {\n\tdefer trace()()\n\twg := sync.WaitGroup{}\n\twg.Add(len(coll.collectors))\n\tfor name, c := range coll.collectors {\n\t\tgo func(name string, c collector.Collector) {\n\t\t\texecute(name, c, ch)\n\t\t\twg.Done()\n\t\t}(name, c)\n\t}\n\twg.Wait()\n\tscrapeDurations.Collect(ch)\n}", "func (c *filebeatCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tfor _, i := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(i.desc, i.valType, i.eval(c.stats))\n\t}\n\n}", "func (mg *oracleMetricGroup) Collect(db *sql.DB, wg *sync.WaitGroup, metricChan chan<- newrelicMetricSender) {\n\tdefer wg.Done()\n\n\trows, err := db.Query(mg.sqlQuery())\n\tif err != nil {\n\t\tlog.Error(\"Failed to execute query %s: %s\", mg.sqlQuery, err)\n\t\treturn\n\t}\n\n\tif err = mg.metricsGenerator(rows, mg.metrics, metricChan); err != nil {\n\t\tlog.Error(\"Failed to generate metrics from db response for query %s: %s\", mg.sqlQuery, err)\n\t\treturn\n\t}\n}", "func (c *OrchestratorCollector) Collect(ch chan<- prometheus.Metric) {\n\tc.mutex.Lock() // To protect metrics from concurrent collects\n\tdefer c.mutex.Unlock()\n\n\tstats, err := c.orchestratorClient.GetMetrics()\n\tif err != nil {\n\t\tc.upMetric.Set(serviceDown)\n\t\tch <- c.upMetric\n\t\tlog.Printf(\"Error getting Orchestrator stats: %v\", err)\n\t\treturn\n\t}\n\n\tc.upMetric.Set(serviceUp)\n\tch <- c.upMetric\n\n\tch <- prometheus.MustNewConstMetric(c.metrics[\"cluter_size\"],\n\t\tprometheus.GaugeValue, float64(len(stats.Status.Details.AvailableNodes)))\n\tch <- prometheus.MustNewConstMetric(c.metrics[\"is_active_node\"],\n\t\tprometheus.GaugeValue, boolToFloat64(stats.Status.Details.IsActiveNode))\n\tch <- prometheus.MustNewConstMetric(c.metrics[\"problems\"],\n\t\tprometheus.GaugeValue, float64(len(stats.Problems)))\n\tch <- prometheus.MustNewConstMetric(c.metrics[\"last_failover_id\"],\n\t\tprometheus.CounterValue, float64(stats.LastFailoverID))\n\tch <- prometheus.MustNewConstMetric(c.metrics[\"is_healthy\"],\n\t\tprometheus.GaugeValue, boolToFloat64(stats.Status.Details.Healthy))\n\tch <- prometheus.MustNewConstMetric(c.metrics[\"failed_seeds\"],\n\t\tprometheus.CounterValue, float64(stats.FailedSeeds))\n}", "func (p *plug) Collect(ch chan<- prometheus.Metric) {\n\tp.doStats(ch, doMetric)\n}", "func (c *MSCluster_ClusterCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {\n\tvar dst []MSCluster_Cluster\n\tq := queryAll(&dst, c.logger)\n\tif err := wmi.QueryNamespace(q, &dst, \"root/MSCluster\"); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range dst {\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.AddEvictDelay,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.AddEvictDelay),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.AdminAccessPoint,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.AdminAccessPoint),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.AutoAssignNodeSite,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.AutoAssignNodeSite),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.AutoBalancerLevel,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.AutoBalancerLevel),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.AutoBalancerMode,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.AutoBalancerMode),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.BackupInProgress,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.BackupInProgress),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.BlockCacheSize,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.BlockCacheSize),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusSvcHangTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusSvcHangTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusSvcRegroupOpeningTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusSvcRegroupOpeningTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusSvcRegroupPruningTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusSvcRegroupPruningTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusSvcRegroupStageTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusSvcRegroupStageTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusSvcRegroupTickInMilliseconds,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusSvcRegroupTickInMilliseconds),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusterEnforcedAntiAffinity,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusterEnforcedAntiAffinity),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusterFunctionalLevel,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusterFunctionalLevel),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusterGroupWaitDelay,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusterGroupWaitDelay),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusterLogLevel,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusterLogLevel),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusterLogSize,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusterLogSize),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ClusterUpgradeVersion,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ClusterUpgradeVersion),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.CrossSiteDelay,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.CrossSiteDelay),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.CrossSiteThreshold,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.CrossSiteThreshold),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.CrossSubnetDelay,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.CrossSubnetDelay),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.CrossSubnetThreshold,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.CrossSubnetThreshold),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.CsvBalancer,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.CsvBalancer),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.DatabaseReadWriteMode,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.DatabaseReadWriteMode),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.DefaultNetworkRole,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.DefaultNetworkRole),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.DetectedCloudPlatform,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.DetectedCloudPlatform),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.DetectManagedEvents,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.DetectManagedEvents),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.DetectManagedEventsThreshold,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.DetectManagedEventsThreshold),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.DisableGroupPreferredOwnerRandomization,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.DisableGroupPreferredOwnerRandomization),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.DrainOnShutdown,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.DrainOnShutdown),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.DynamicQuorumEnabled,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.DynamicQuorumEnabled),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.EnableSharedVolumes,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.EnableSharedVolumes),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.FixQuorum,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.FixQuorum),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.GracePeriodEnabled,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.GracePeriodEnabled),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.GracePeriodTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.GracePeriodTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.GroupDependencyTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.GroupDependencyTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.HangRecoveryAction,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.HangRecoveryAction),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.IgnorePersistentStateOnStartup,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.IgnorePersistentStateOnStartup),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.LogResourceControls,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.LogResourceControls),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.LowerQuorumPriorityNodeId,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.LowerQuorumPriorityNodeId),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.MaxNumberOfNodes,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.MaxNumberOfNodes),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.MessageBufferLength,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.MessageBufferLength),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.MinimumNeverPreemptPriority,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.MinimumNeverPreemptPriority),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.MinimumPreemptorPriority,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.MinimumPreemptorPriority),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.NetftIPSecEnabled,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.NetftIPSecEnabled),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.PlacementOptions,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.PlacementOptions),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.PlumbAllCrossSubnetRoutes,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.PlumbAllCrossSubnetRoutes),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.PreventQuorum,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.PreventQuorum),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.QuarantineDuration,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.QuarantineDuration),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.QuarantineThreshold,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.QuarantineThreshold),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.QuorumArbitrationTimeMax,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.QuorumArbitrationTimeMax),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.QuorumArbitrationTimeMin,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.QuorumArbitrationTimeMin),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.QuorumLogFileSize,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.QuorumLogFileSize),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.QuorumTypeValue,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.QuorumTypeValue),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.RequestReplyTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.RequestReplyTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ResiliencyDefaultPeriod,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ResiliencyDefaultPeriod),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ResiliencyLevel,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ResiliencyLevel),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ResourceDllDeadlockPeriod,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ResourceDllDeadlockPeriod),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.RootMemoryReserved,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.RootMemoryReserved),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.RouteHistoryLength,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.RouteHistoryLength),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.S2DBusTypes,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.S2DBusTypes),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.S2DCacheDesiredState,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.S2DCacheDesiredState),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.S2DCacheFlashReservePercent,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.S2DCacheFlashReservePercent),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.S2DCachePageSizeKBytes,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.S2DCachePageSizeKBytes),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.S2DEnabled,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.S2DEnabled),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.S2DIOLatencyThreshold,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.S2DIOLatencyThreshold),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.S2DOptimizations,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.S2DOptimizations),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.SameSubnetDelay,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.SameSubnetDelay),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.SameSubnetThreshold,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.SameSubnetThreshold),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.SecurityLevel,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.SecurityLevel),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.SecurityLevelForStorage,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.SecurityLevelForStorage),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.SharedVolumeVssWriterOperationTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.SharedVolumeVssWriterOperationTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.ShutdownTimeoutInMinutes,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.ShutdownTimeoutInMinutes),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.UseClientAccessNetworksForSharedVolumes,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.UseClientAccessNetworksForSharedVolumes),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.WitnessDatabaseWriteTimeout,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.WitnessDatabaseWriteTimeout),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.WitnessDynamicWeight,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.WitnessDynamicWeight),\n\t\t\tv.Name,\n\t\t)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tc.WitnessRestartInterval,\n\t\t\tprometheus.GaugeValue,\n\t\t\tfloat64(v.WitnessRestartInterval),\n\t\t\tv.Name,\n\t\t)\n\n\t}\n\n\treturn nil\n}", "func (ic *InfluxCollector) Collect(event Collectable) error {\n\tic.input <- event\n\treturn nil\n}", "func (c *TeamsCollector) Collect(ch chan<- prometheus.Metric) {\n\n\tteams := getTotalTeams()\n\n\tch <- prometheus.MustNewConstMetric(\n\t\tc.totalTeamsGaugeDesc,\n\t\tprometheus.GaugeValue,\n\t\tfloat64(teams),\n\t)\n}", "func (p PlanetCollector) Collect(ch chan<- prometheus.Metric) {\n\twg := sync.WaitGroup{}\n\twg.Add(len(p.Collectors))\n\n\tfor name, collector := range p.Collectors {\n\t\tgo func(name string, collector Collector) {\n\t\t\tcollectorExec(name, collector, ch)\n\n\t\t\twg.Done()\n\t\t}(name, collector)\n\t}\n\n\twg.Wait()\n}", "func Collect(collectionLimit int) *sif.DataFrameOperation {\n\treturn &sif.DataFrameOperation{\n\t\tTaskType: sif.CollectTaskType,\n\t\tDo: func(d sif.DataFrame) (*sif.DataFrameOperationResult, error) {\n\t\t\tif d.GetDataSource().IsStreaming() {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot collect() from a streaming DataSource\")\n\t\t\t}\n\t\t\treturn &sif.DataFrameOperationResult{\n\t\t\t\tTask: &collectTask{collectionLimit: collectionLimit},\n\t\t\t\tDataSchema: d.GetSchema().Clone(),\n\t\t\t}, nil\n\t\t},\n\t}\n}", "func (r *RGWCollector) Collect(ch chan<- prometheus.Metric, version *Version) {\n\tif !r.background {\n\t\tr.logger.WithField(\"background\", r.background).Debug(\"collecting RGW GC stats\")\n\t\terr := r.collect()\n\t\tif err != nil {\n\t\t\tr.logger.WithField(\"background\", r.background).WithError(err).Error(\"error collecting RGW GC stats\")\n\t\t}\n\t}\n\n\tfor _, metric := range r.collectorList() {\n\t\tmetric.Collect(ch)\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tvar (\n\t\tdata *Data\n\t\terr error\n\t)\n\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\te.resetGaugeVecs() // Clean starting point\n\n\tvar endpointOfAPI []string\n\tif strings.HasSuffix(rancherURL, \"v3\") || strings.HasSuffix(rancherURL, \"v3/\") {\n\t\tendpointOfAPI = endpointsV3\n\t} else {\n\t\tendpointOfAPI = endpoints\n\t}\n\n\tcacheExpired := e.IsCacheExpired()\n\n\t// Range over the pre-configured endpoints array\n\tfor _, p := range endpointOfAPI {\n\t\tif cacheExpired {\n\t\t\tdata, err = e.gatherData(e.rancherURL, e.resourceLimit, e.accessKey, e.secretKey, p, ch)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error getting JSON from URL %s\", p)\n\t\t\t\treturn\n\t\t\t}\n\t\t\te.cache[p] = data\n\t\t} else {\n\t\t\td, ok := e.cache[p]\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdata = d\n\t\t}\n\n\t\tif err := e.processMetrics(data, p, e.hideSys, ch); err != nil {\n\t\t\tlog.Errorf(\"Error scraping rancher url: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"Metrics successfully processed for %s\", p)\n\t}\n\n\tif cacheExpired {\n\t\te.RenewCache()\n\t}\n\n\tfor _, m := range e.gaugeVecs {\n\t\tm.Collect(ch)\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tfor _, db := range e.dbs {\n\t\t// logger.Log(\"Scraping\", db.String())\n\t\tgo e.scrapeDatabase(db)\n\t}\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\te.cpuPercent.Collect(ch)\n\te.dataIO.Collect(ch)\n\te.logIO.Collect(ch)\n\te.memoryPercent.Collect(ch)\n\te.workPercent.Collect(ch)\n\te.sessionPercent.Collect(ch)\n\te.storagePercent.Collect(ch)\n\te.dbUp.Collect(ch)\n\te.up.Set(1)\n}", "func (c *SVCResponse) Collect(ch chan<- prometheus.Metric) {\n\tvar err error\n\tc.totalScrapes.Inc()\n\tdefer func() {\n\t\tch <- c.up\n\t\tch <- c.totalScrapes\n\t\tch <- c.jsonParseFailures\n\t}()\n\n\tSVCResp, err := c.fetchDataAndDecode()\n\tif err != nil {\n\t\tc.up.Set(0)\n\t\t_ = level.Warn(*c.logger).Log(\n\t\t\t\"msg\", \"failed to fetch and decode data\",\n\t\t\t\"err\", err,\n\t\t)\n\t\treturn\n\t}\n\tc.up.Set(1)\n\n\tfor _, metric := range c.metrics {\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tmetric.Desc,\n\t\t\tmetric.Type,\n\t\t\tmetric.Value(&SVCResp),\n\t\t)\n\t}\n\n\tch <- prometheus.MustNewConstMetric(\n\t\tc.data.Desc,\n\t\tc.data.Type,\n\t\tc.data.Value(&SVCResp),\n\t\tSVCResp.UniqueID, SVCResp.Version, SVCResp.LongVersion, SVCResp.Platform,\n\t)\n}", "func (c *OSCollector) Collect(ch chan<- prometheus.Metric) {\n\tif desc, err := c.collect(ch); err != nil {\n\t\tlog.Println(\"[ERROR] failed collecting os metrics:\", desc, err)\n\t\treturn\n\t}\n}", "func (k *KACollector) Collect(ch chan<- prometheus.Metric) {\n\tk.mutex.Lock()\n\tdefer k.mutex.Unlock()\n\n\tvar err error\n\tvar kaStats []KAStats\n\n\tif k.useJSON {\n\t\tkaStats, err = k.json()\n\t\tif err != nil {\n\t\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_up\"], prometheus.GaugeValue, 0)\n\t\t\tlog.Printf(\"keepalived_exporter: %v\", err)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tkaStats, err = k.text()\n\t\tif err != nil {\n\t\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_up\"], prometheus.GaugeValue, 0)\n\t\t\tlog.Printf(\"keepalived_exporter: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_up\"], prometheus.GaugeValue, 1)\n\n\tfor _, st := range kaStats {\n\t\tstate := \"\"\n\t\tif _, ok := state2string[st.Data.State]; ok {\n\t\t\tstate = state2string[st.Data.State]\n\t\t}\n\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_advert_rcvd\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.AdvertRcvd), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_advert_sent\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.AdvertSent), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_become_master\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.BecomeMaster), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_release_master\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.ReleaseMaster), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_packet_len_err\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.PacketLenErr), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_advert_interval_err\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.AdvertIntervalErr), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_ip_ttl_err\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.AdvertIntervalErr), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_invalid_type_rcvd\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.InvalidTypeRcvd), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_addr_list_err\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.AddrListErr), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_invalid_authtype\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.InvalidAuthtype), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_authtype_mismatch\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.AuthtypeMismatch), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_auth_failure\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.AuthFailure), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_pri_zero_rcvd\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.PriZeroRcvd), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_vrrp_pri_zero_sent\"], prometheus.CounterValue,\n\t\t\tfloat64(st.Stats.PriZeroSent), st.Data.Iname, st.Data.IfpIfname, strconv.Itoa(st.Data.Vrid), state)\n\t}\n\n\tif k.handle == nil {\n\t\treturn\n\t}\n\n\tsvcs, err := k.handle.GetServices()\n\tif err != nil {\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_up\"], prometheus.GaugeValue, 0)\n\t\tlog.Printf(\"keepalived_exporter: services: %v\", err)\n\t\treturn\n\t}\n\n\tfor _, s := range svcs {\n\t\tdsts, err := k.handle.GetDestinations(s)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"keepalived_exporter: destinations: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\taddr := s.Address.String() + \":\" + strconv.Itoa(int(s.Port))\n\t\tproto := strconv.Itoa(int(s.Protocol))\n\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_vip_in_packets\"], prometheus.CounterValue,\n\t\t\tfloat64(s.Stats.PacketsIn), addr, proto)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_vip_out_packets\"], prometheus.CounterValue,\n\t\t\tfloat64(s.Stats.PacketsOut), addr, proto)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_vip_in_bytes\"], prometheus.CounterValue,\n\t\t\tfloat64(s.Stats.BytesIn), addr, proto)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_vip_out_bytes\"], prometheus.CounterValue,\n\t\t\tfloat64(s.Stats.BytesOut), addr, proto)\n\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_vip_conn\"], prometheus.CounterValue,\n\t\t\tfloat64(s.Stats.Connections), addr, proto)\n\n\t\tfor _, d := range dsts {\n\t\t\taddr := d.Address.String() + \":\" + strconv.Itoa(int(d.Port))\n\n\t\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_rs_in_packets\"], prometheus.CounterValue,\n\t\t\t\tfloat64(d.Stats.PacketsIn), addr, proto)\n\t\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_rs_out_packets\"], prometheus.CounterValue,\n\t\t\t\tfloat64(d.Stats.PacketsOut), addr, proto)\n\t\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_rs_in_bytes\"], prometheus.CounterValue,\n\t\t\t\tfloat64(d.Stats.BytesIn), addr, proto)\n\t\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_rs_out_bytes\"], prometheus.CounterValue,\n\t\t\t\tfloat64(d.Stats.BytesOut), addr, proto)\n\t\t\tch <- prometheus.MustNewConstMetric(k.metrics[\"keepalived_lvs_rs_conn\"], prometheus.CounterValue,\n\t\t\t\tfloat64(d.Stats.Connections), addr, proto)\n\t\t}\n\t}\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\te.mutex.Lock() // To protect metrics from concurrent collects.\n\tdefer e.mutex.Unlock()\n\n\tup, result := e.scrape(ch)\n\n\tch <- e.totalScrapes\n\tch <- e.jsonParseFailures\n\tch <- prometheus.MustNewConstMetric(iqAirUp, prometheus.GaugeValue, up)\n\tch <- prometheus.MustNewConstMetric(iqAirCO2, prometheus.GaugeValue, float64(result.CO2))\n\tch <- prometheus.MustNewConstMetric(iqAirP25, prometheus.GaugeValue, float64(result.P25))\n\tch <- prometheus.MustNewConstMetric(iqAirP10, prometheus.GaugeValue, float64(result.P10))\n\tch <- prometheus.MustNewConstMetric(iqAirTemp, prometheus.GaugeValue, float64(result.Temperature))\n\tch <- prometheus.MustNewConstMetric(iqAirHumidity, prometheus.GaugeValue, float64(result.Humidity))\n}", "func (c *MosquittoCounter) Collect(ch chan<- prometheus.Metric) {\n\tch <- prometheus.MustNewConstMetric(\n\t\tc.Desc,\n\t\tprometheus.CounterValue,\n\t\tc.counter.value,\n\t)\n}", "func (c *Collector) Collect(scs []stats.SampleContainer) {\n\tc.lock.Lock()\n\tfor _, sc := range scs {\n\t\tc.Samples = append(c.Samples, sc.GetSamples()...)\n\t}\n\tc.lock.Unlock()\n}", "func (e *Exporter) Collect(ch chan<- prometheus.Metric) {\n\tvar up float64 = 1\n\n\tglobalMutex.Lock()\n\tdefer globalMutex.Unlock()\n\n\tif e.config.resetStats && !globalResetExecuted {\n\t\t// Its time to try to reset the stats\n\t\tif e.resetStatsSemp1() {\n\t\t\tlevel.Info(e.logger).Log(\"msg\", \"Statistics successfully reset\")\n\t\t\tglobalResetExecuted = true\n\t\t\tup = 1\n\t\t} else {\n\t\t\tup = 0\n\t\t}\n\t}\n\n\tif e.config.details {\n\t\tif up > 0 {\n\t\t\tup = e.getClientSemp1(ch)\n\t\t}\n\t\tif up > 0 {\n\t\t\tup = e.getQueueSemp1(ch)\n\t\t}\n\t\tif up > 0 && e.config.scrapeRates {\n\t\t\tup = e.getQueueRatesSemp1(ch)\n\t\t}\n\t} else { // Basic\n\t\tif up > 0 {\n\t\t\tup = e.getRedundancySemp1(ch)\n\t\t}\n\t\tif up > 0 {\n\t\t\tup = e.getSpoolSemp1(ch)\n\t\t}\n\t\tif up > 0 {\n\t\t\tup = e.getHealthSemp1(ch)\n\t\t}\n\t\tif up > 0 {\n\t\t\tup = e.getVpnSemp1(ch)\n\t\t}\n\t}\n\n\tch <- prometheus.MustNewConstMetric(solaceUp, prometheus.GaugeValue, up)\n}", "func (c *StorageDomainCollector) Collect(ch chan<- prometheus.Metric) {\n\tctx, span := c.cc.Tracer().Start(c.rootCtx, \"StorageDomainCollector.Collect\")\n\tdefer span.End()\n\n\tc.cc.SetMetricsCh(ch)\n\n\ttimer := prometheus.NewTimer(c.collectDuration)\n\tdefer timer.ObserveDuration()\n\n\ts := StorageDomains{}\n\terr := c.cc.Client().GetAndParse(ctx, \"storagedomains\", &s)\n\tif err != nil {\n\t\tc.cc.HandleError(err, span)\n\t\treturn\n\t}\n\n\tfor _, h := range s.Domains {\n\t\tc.collectMetricsForDomain(h)\n\t}\n}", "func (m httpPostMetrics) Collect(metrics chan<- prometheus.Metric) {\n\tm.totalTime.Collect(metrics)\n\tm.firstProgressPacket.Collect(metrics)\n\tm.firstPackPacket.Collect(metrics)\n\tm.packBytes.Collect(metrics)\n}", "func (p *statefulSyncInstrument[N, Storage, Methods]) Collect(seq data.Sequence, output *[]data.Instrument) {\n\tp.instLock.Lock()\n\tdefer p.instLock.Unlock()\n\n\tioutput := p.appendInstrument(output)\n\n\tfor set, entry := range p.data {\n\t\tp.appendPoint(ioutput, set, &entry.storage, aggregation.CumulativeTemporality, seq.Start, seq.Now, false)\n\t}\n}", "func (mlw *Wrapper) Collect() {\n\tmlw.ml.Collect()\n\tsort.Sort(byLatency(mlw.ml.Results))\n}", "func (n DellHWCollector) Collect(ch chan<- prometheus.Metric) {\n\twg := sync.WaitGroup{}\n\twg.Add(len(n.collectors))\n\tfor name, c := range n.collectors {\n\t\tgo func(name string, c collector.Collector) {\n\t\t\texecute(name, c, ch)\n\t\t\twg.Done()\n\t\t}(name, c)\n\t}\n\twg.Wait()\n}", "func (c *SystemCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error {\n\tif desc, err := c.collect(ctx, ch); err != nil {\n\t\t_ = level.Error(c.logger).Log(\"failed collecting system metrics\", \"desc\", desc, \"err\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *grpcClientManagerCollector) Collect(ch chan<- prometheus.Metric) {\n\tfor _, con := range c.cm.Metrics().Connections {\n\t\tl := []string{con.Target}\n\t\tch <- prometheus.MustNewConstMetric(connectionStateDesc, prometheus.GaugeValue, float64(con.State), l...)\n\t}\n}", "func (c *DebugFsStatCollector) Collect(ch chan<- prometheus.Metric) {\n\tc.updateProbeStats(0, \"kprobe\", ch)\n\tc.updateProbeStats(0, \"uprobe\", ch)\n}", "func newCollectPacket(s SpanID, as Annotations) *wire.CollectPacket {\n\treturn &wire.CollectPacket{\n\t\tSpanid: s.wire(),\n\t\tAnnotation: as.wire(),\n\t}\n}", "func (c *PTVMetricsCollector) Collect(ch chan<- prometheus.Metric) {\n\tdefer timeTrack(time.Now(), \"PTVMetricsCollector.Collect\")\n\n\t// External call to PTV here:\n\trawMetrics, err := c.scraper.Scrape()\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"error\": err,\n\t\t}).Error(\"Scrape error\")\n\n\t\tc.metrics.SetPtvDown(ch)\n\t\treturn\n\t}\n\n\tc.metrics.SetPtvUp(ch, rawMetrics)\n}" ]
[ "0.7156506", "0.6469556", "0.6441961", "0.64078486", "0.6387556", "0.6346833", "0.63250047", "0.6303169", "0.62795997", "0.6277225", "0.62503505", "0.6235564", "0.6233566", "0.6229621", "0.62251043", "0.622124", "0.6186137", "0.6175919", "0.6171378", "0.61642337", "0.6159943", "0.6154859", "0.6150749", "0.6133624", "0.6129656", "0.61272067", "0.611891", "0.61111695", "0.6098132", "0.6095981", "0.60887575", "0.60858965", "0.6073409", "0.6073409", "0.6073146", "0.6073037", "0.60533875", "0.60522723", "0.60501456", "0.6027057", "0.6013016", "0.60115284", "0.6010402", "0.600868", "0.600867", "0.6005286", "0.59973246", "0.5996902", "0.5988822", "0.59878886", "0.59872586", "0.5979073", "0.5968154", "0.59672767", "0.5959471", "0.59566724", "0.59522516", "0.59491175", "0.5947003", "0.59371084", "0.5928653", "0.58929974", "0.588496", "0.5868721", "0.58659536", "0.58507586", "0.58420396", "0.5832083", "0.58164567", "0.5812656", "0.57890815", "0.5771212", "0.57518005", "0.573076", "0.5721413", "0.5717119", "0.57135844", "0.5707055", "0.5688516", "0.5669863", "0.56651187", "0.5663494", "0.5647196", "0.56469995", "0.5637074", "0.5621544", "0.562061", "0.5614467", "0.5607966", "0.56072617", "0.5606757", "0.5589677", "0.5582809", "0.558098", "0.5580728", "0.5568123", "0.55627346", "0.5551951", "0.55477065", "0.55388063" ]
0.6961146
1
connect makes a connection to the collector server. It must be called with rc.mu held.
func (rc *RemoteCollector) connect() error { if rc.pconn != nil { rc.pconn.Close() rc.pconn = nil } c, err := rc.dial() if err == nil { // Create a protobuf delimited writer wrapping the connection. When the // writer is closed, it also closes the underlying connection (see // source code for details). rc.pconn = pio.NewDelimitedWriter(c) } return err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Slave) connect(uri string, options Options) (err error) {\n\tdsn, opts, err := parseOptions(uri, options)\n\tif err != nil {\n\t\treturn\n\t}\n\tconn, err := newConn(context.Background(), dsn.Scheme, dsn.Host, opts)\n\tif err != nil {\n\t\treturn\n\t}\n\ts.c = conn\n\ts.cr = bufio.NewReaderSize(s.c.tcpConn, DefaultReaderBufSize)\n\t// for better error checking while writing to connection\n\ts.cw = bufio.NewWriter(s.c.tcpConn)\n\treturn\n}", "func (ch *ServerChannel) Connect(c *Client) {}", "func (c *Connection) connect(ctx context.Context) error {\n\tc.log.Debug(\"Connection: %s\",\n\t\tLogField{Key: ConnectionLogMsgKey, Value: \"dialing transport\"})\n\n\t// connect\n\ttransport, err := c.transport.Dial(ctx)\n\tif err != nil {\n\t\tc.log.Warning(\"Connection: error %s: %v\",\n\t\t\tLogField{Key: ConnectionLogMsgKey, Value: \"dialing transport\"},\n\t\t\tLogField{Key: \"error\", Value: err})\n\t\treturn err\n\t}\n\n\tclient := NewClient(transport, c.errorUnwrapper, c.tagsFunc)\n\tserver := NewServer(transport, c.wef)\n\n\tfor _, p := range c.protocols {\n\t\tif err := server.Register(p); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// call the connect handler\n\tc.log.Debug(\"Connection: %s\", LogField{Key: ConnectionLogMsgKey, Value: \"calling OnConnect\"})\n\terr = c.handler.OnConnect(ctx, c, client, server)\n\tif err != nil {\n\t\tc.log.Warning(\"Connection: error calling %s handler: %v\",\n\t\t\tLogField{Key: ConnectionLogMsgKey, Value: \"OnConnect\"},\n\t\t\tLogField{Key: \"error\", Value: err})\n\t\treturn err\n\t}\n\n\t// set the client for other callers.\n\t// we wait to do this so the handler has time to do\n\t// any setup required, e.g. authenticate.\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tc.client = client\n\tc.server = server\n\tc.transport.Finalize()\n\n\tc.log.Debug(\"Connection: %s\", LogField{Key: ConnectionLogMsgKey, Value: \"connected\"})\n\treturn nil\n}", "func (c *Notification2Client) connect() error {\n\tif c.dialer == nil {\n\t\tpanic(\"Missing dialer for realtime client\")\n\t}\n\tws, err := c.createWebsocket()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\n\tc.ws = ws\n\tif c.tomb == nil {\n\t\tc.tomb = &tomb.Tomb{}\n\t\tc.tomb.Go(c.worker)\n\t}\n\tc.connected = true\n\n\treturn nil\n}", "func (s *service) connect() {\n\tif s.destroyed {\n\t\ts.logger.Warnf(\"connect already destroyed\")\n\t\treturn\n\t}\n\n\taddr := fmt.Sprintf(\"%s:%d\", s.Host, s.Port)\n\n\ts.logger.Infof(\"start %s %s\", s.Name, addr)\n\n\ts.Connecting = true\n\tconn, err := net.Dial(\"tcp\", addr)\n\tfor err != nil {\n\t\tif s.destroyed {\n\t\t\ts.logger.Warnf(\"dial already destroyed\")\n\t\t\treturn\n\t\t}\n\t\tif s.restarted {\n\t\t\ts.logger.WithError(err).Warnf(\"dial %v\", err)\n\t\t} else {\n\t\t\ts.logger.WithError(err).Errorf(\"dial %v\", err)\n\t\t}\n\t\ttime.Sleep(time.Duration(1) * time.Second)\n\t\tconn, err = net.Dial(\"tcp\", addr)\n\t}\n\ts.conn = conn\n\ts.restarted = false\n\ts.Connecting = false\n\ts.logger.Infof(\"connected %s %s\", s.Name, addr)\n\n\tquit := make(chan struct{})\n\ts.Send = s.makeSendFun(conn)\n\tmsg := types.Message{\n\t\tRouterHeader: constants.RouterHeader.Connect,\n\t\tUserID: s.RouterID,\n\t\tPayloadURI: types.PayloadURI(s.Caller),\n\t}\n\ts.Send(msg)\n\tgo common.WithRecover(func() { s.readPump(conn, quit) }, \"read-pump\")\n\ts.startHB(conn, quit)\n}", "func (c *cpu) connect() {\n\tsp, addrlen := popU32(c.sp)\n\tsp, addr := popPtr(sp)\n\tfd := readI32(sp)\n\t_, _, err := syscall.Syscall(unix.SYS_CONNECT, uintptr(fd), addr, uintptr(addrlen))\n\tif strace {\n\t\tfmt.Fprintf(os.Stderr, \"connext(%#x, %#x, %#x) %v\\t; %s\\n\", fd, addr, addrlen, err, c.pos())\n\t}\n\tif err != 0 {\n\t\tc.setErrno(err)\n\t\twriteI32(c.rp, -1)\n\t\treturn\n\t}\n\n\twriteI32(c.rp, 0)\n}", "func (ch *InternalChannel) Connect(c *Client) {}", "func connect(pool chan *pooledClient, target *core.ServiceInstance) (Client, error) {\n\taddr := target.RemoteAddr.String()\n\tconn, err := net.Dial(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcountlog.Trace(\"event!client.connect\",\n\t\t\"qualifier\", target.Kind.Qualifier(),\n\t\t\"conn\", conn.LocalAddr())\n\tclt := &pooledClient{\n\t\tTCPConn: conn.(*net.TCPConn),\n\t\tpool: pool,\n\t\tcodec: codec.Codecs[target.Kind.Protocol],\n\t}\n\tclt.reader = bufio.NewReaderSize(clt, 2048)\n\treturn clt, nil\n}", "func (c *Config) connect() {\n\tc.emitEvent(Event{Type: EventConnected})\n}", "func (a *agent) connect() error {\n\terr := backoff.Retry(func() error {\n\t\tif a.amqpURL == \"\" {\n\t\t\treturn fmt.Errorf(\"no mq URL\")\n\t\t}\n\t\tparts := strings.Split(a.amqpURL, \"@\")\n\t\thostport := parts[len(parts)-1]\n\n\t\ta.logger.InfoF(\"dialing %q\", hostport)\n\t\tconn, err := amqp.Dial(a.amqpURL)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"dialing %q\", hostport)\n\t\t}\n\t\t// Set connection to agent for reference\n\t\ta.mu.Lock()\n\t\ta.conn = conn\n\t\ta.mu.Unlock()\n\n\t\tif err := a.openChannel(); err != nil {\n\t\t\treturn errors.Wrapf(err, \"openChannel\")\n\t\t}\n\n\t\tif err := a.runWorker(); err != nil {\n\t\t\treturn errors.Wrapf(err, \"startWorkers\")\n\t\t}\n\n\t\ta.wg.Add(1)\n\t\tgo func() {\n\t\t\tdefer a.wg.Done()\n\t\t\ta.waitChannel()\n\t\t}()\n\t\ta.logger.InfoF(\"connected %q\", hostport)\n\t\treturn nil\n\t}, backoff.WithContext(a.connBackOff, a.ctx))\n\tif err != nil {\n\t\ta.logger.ErrorF(\"connect failed: %q\", err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "func (mon *SocketMonitor) Connect() error {\n\tenc := json.NewEncoder(mon.c)\n\tdec := json.NewDecoder(mon.c)\n\n\t// Check for banner on startup\n\tvar ban banner\n\tif err := dec.Decode(&ban); err != nil {\n\t\treturn err\n\t}\n\tmon.Version = &ban.QMP.Version\n\tmon.Capabilities = ban.QMP.Capabilities\n\n\t// Issue capabilities handshake\n\tcmd := Command{Execute: qmpCapabilities}\n\tif err := enc.Encode(cmd); err != nil {\n\t\treturn err\n\t}\n\n\t// Check for no error on return\n\tvar r response\n\tif err := dec.Decode(&r); err != nil {\n\t\treturn err\n\t}\n\tif err := r.Err(); err != nil {\n\t\treturn err\n\t}\n\n\t// Initialize socket listener for command responses and asynchronous\n\t// events\n\tevents := make(chan Event)\n\tstream := make(chan streamResponse)\n\tgo mon.listen(mon.c, events, stream)\n\n\tmon.events = events\n\tmon.stream = stream\n\n\treturn nil\n}", "func (ctl *Control) connectServer() (conn net.Conn, err error) {\n\treturn ctl.cm.Connect()\n}", "func (c *Easee) connect(ts oauth2.TokenSource) func() (signalr.Connection, error) {\n\tbo := backoff.NewExponentialBackOff()\n\tbo.MaxInterval = time.Minute\n\n\treturn func() (conn signalr.Connection, err error) {\n\t\tdefer func() {\n\t\t\tif err != nil {\n\t\t\t\ttime.Sleep(bo.NextBackOff())\n\t\t\t} else {\n\t\t\t\tbo.Reset()\n\t\t\t}\n\t\t}()\n\n\t\ttok, err := ts.Token()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), request.Timeout)\n\t\tdefer cancel()\n\n\t\treturn signalr.NewHTTPConnection(ctx, \"https://streams.easee.com/hubs/chargers\",\n\t\t\tsignalr.WithHTTPClient(c.Client),\n\t\t\tsignalr.WithHTTPHeaders(func() (res http.Header) {\n\t\t\t\treturn http.Header{\n\t\t\t\t\t\"Authorization\": []string{fmt.Sprintf(\"Bearer %s\", tok.AccessToken)},\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t}\n}", "func (c *RedialConnection) connect() {\n\tif c.closed {\n\t\t// We don't really want to connect\n\t\treturn\n\t}\n\tif c.conn != nil && !c.conn.IsClosed() {\n\t\t// We already have a connection\n\t\treturn\n\t}\n\tfailCount := 0\n\tfor {\n\t\tconn, err := net.Dial(\"tcp\", c.address.String())\n\t\tif err == nil {\n\t\t\tc.conn = NewBasicConnection(conn, c.inbox)\n\t\t\treturn\n\t\t}\n\n\t\tfailCount++\n\t\ttimer := time.NewTimer(time.Duration(failCount) * time.Second)\n\t\tselect {\n\t\tcase <-c.quit:\n\t\t\treturn\n\t\tcase <-timer.C:\n\t\t\t// Looping again will try to reconnect\n\t\t}\n\t}\n}", "func (l *LogWriter) connect() {\n\tif l.connecting {\n\t\treturn\n\t}\n\tl.connecting = true\n\tvar err error\n\tfor l.conn == nil {\n\t\tl.conn, err = net.Dial(\"tcp\", l.Addr)\n\t\tif err != nil {\n\t\t\ttime.Sleep(time.Second)\n\t\t\tcontinue\n\t\t}\n\t\terr = l.sendMsg([]byte(fmt.Sprintf(\"!!cutelog!!format=%s\", l.Format)))\n\t\tif err != nil {\n\t\t\tl.Close()\n\t\t}\n\t}\n\tl.connecting = false\n}", "func (s *Server) connect() {\n\tln, err := net.Listen(\"tcp\", \":\"+strconv.Itoa(s.port))\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t} else {\n\t\ts.listener = ln\n\t\tlog.Println(\"Listening on port :\" + strconv.Itoa(s.port))\n\t}\n}", "func (d *RMQ) Connect() error { return nil }", "func (c *GatewayClient) connect() error {\n\tif !c.ready {\n\t\treturn errors.New(\"already tried to connect and failed\")\n\t}\n\n\tc.ready = false\n\tc.resuming = false\n\tc.heartbeatAcknowledged = true\n\tc.lastIdentify = time.Time{}\n\n\tc.Logf(\"connecting\")\n\t// TODO Need to set read deadline for hello packet and I also need to set write deadlines.\n\t// TODO also max message\n\tvar err error\n\tc.wsConn, _, err = websocket.DefaultDialer.Dial(c.GatewayURL, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo c.manager()\n\n\treturn nil\n}", "func (s *Server) Connect(client *Client) {\n s.Clients.Store(client.Id, client)\n\n s.GM.Log.Debugf(\"Connecting new client %s\", client.Id)\n\n go client.Conn.Reader(client, s)\n go client.Conn.Writer(client, s)\n\n s.GM.FireEvent(NewDirectEvent(\"connected\", client, client.Id))\n}", "func (c *rpcclient) connect(ctx context.Context) (err error) {\n\tvar success bool\n\n\tc.clients = make([]*ethConn, 0, len(c.endpoints))\n\tc.neverConnectedEndpoints = make([]endpoint, 0, len(c.endpoints))\n\n\tfor _, endpoint := range c.endpoints {\n\t\tec, err := c.connectToEndpoint(ctx, endpoint)\n\t\tif err != nil {\n\t\t\tc.log.Errorf(\"Error connecting to %q: %v\", endpoint, err)\n\t\t\tc.neverConnectedEndpoints = append(c.neverConnectedEndpoints, endpoint)\n\t\t\tcontinue\n\t\t}\n\n\t\tdefer func() {\n\t\t\t// If all connections are outdated, we will not start, so close any open connections.\n\t\t\tif !success {\n\t\t\t\tec.Close()\n\t\t\t}\n\t\t}()\n\n\t\tc.clients = append(c.clients, ec)\n\t}\n\n\tsuccess = c.sortConnectionsByHealth(ctx)\n\n\tif !success {\n\t\treturn fmt.Errorf(\"failed to connect to an up-to-date ethereum node\")\n\t}\n\n\tgo c.monitorConnectionsHealth(ctx)\n\n\treturn nil\n}", "func (l *Logger) connect() (err error) {\n\tif l.conn != nil {\n\t\t// ignore err from close, it makes sense to continue anyway\n\t\tl.conn.close()\n\t\tl.conn = nil\n\t}\n\n\tif l.network == \"\" {\n\t\tl.conn, err = unixSyslog()\n\t\tif l.hostname == \"\" {\n\t\t\tl.hostname = \"localhost\"\n\t\t}\n\t} else {\n\t\tvar c net.Conn\n\t\tc, err = net.Dial(l.network, l.raddr)\n\t\tif err == nil {\n\t\t\tl.conn = &netConn{conn: c}\n\t\t\tif l.hostname == \"\" {\n\t\t\t\tl.hostname = c.LocalAddr().String()\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (r *CacheRedis) connect() {\n\n}", "func (c *client) Connect(ctx context.Context) error {\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tc.ctx = ctx\n\n\tremote := c.cfg.GetURL()\n\n\tvar subList []string\n\n\tfor topic := range c.SubscribedTopics {\n\t\tif IsPublicTopic(topic) {\n\t\t\tc.createCache(topic)\n\n\t\t\tsubList = append(subList, c.normalizeTopic(topic))\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif IsPrivateTopic(topic) && c.hasAuth() {\n\t\t\tc.createCache(topic)\n\n\t\t\tsubList = append(subList, c.normalizeTopic(topic))\n\t\t}\n\t}\n\n\tif len(subList) > 0 {\n\t\tremote.RawQuery = \"subscribe=\" + strings.Join(subList, \",\")\n\t}\n\n\tlog.Info(\"Connecting to: \", remote.String())\n\n\tconn, rsp, err := websocket.DefaultDialer.DialContext(\n\t\tctx, remote.String(), c.getHeader())\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Fail to connect[%s]: %v, %v\",\n\t\t\tremote.String(), err, rsp)\n\t}\n\n\tdefer func() {\n\t\tgo c.messageHandler()\n\t\tgo c.heartbeatHandler()\n\t}()\n\n\tc.ws = conn\n\tc.connected = true\n\tc.ws.SetCloseHandler(c.closeHandler)\n\n\treturn nil\n}", "func (m *MqttClientBase) connect() {\n\tif token := m.Client.Connect(); token.Wait() && token.Error() != nil {\n\t\tif !m.Connecting {\n\t\t\tlog.Printf(\"MQTT client %v\", token.Error())\n\t\t\tm.retryConnect()\n\t\t}\n\t}\n}", "func (self *discovery) connect() error {\n\n\tself.Lock()\n\tdefer self.Unlock()\n\n\tlog.Trace(\"[Discovery] Connecting\")\n\tif err := self.callDiscoveryService(\"multiregister\", true); err != nil {\n\t\tself.isMultiRegistered = false\n\t\treturn err\n\t}\n\n\t// now connected - set auth scope for service-to-service\n\t// @todo ask moddie if this is the place to do this?\n\t// I've put it here because i want the login service to work the same way, and it needs to message itself\n\tif serviceToServiceAuth {\n\t\tauth.SetCurrentService(Name)\n\t}\n\n\tself.isMultiRegistered = true\n\n\treturn nil\n}", "func (ch *Channel) Connect(c *Client) {\n ch.Clients.Store(c.Id, c)\n}", "func (w *Watcher) Connect(ctx context.Context, service string, conf bconf.Bconf) (sdr.SourceConn, error) {\n\treq := addService{\n\t\tctx: ctx,\n\t\tservice: service,\n\t\tdone: make(chan struct{}),\n\t}\n\tw.commCh <- &req\n\t<-req.done\n\tif req.conn == nil {\n\t\treturn nil, req.err\n\t}\n\treturn req.conn, req.err\n}", "func (rpc *LibvirtRPCMonitor) Connect() error {\n\treturn rpc.l.Connect()\n}", "func (a *amqpPubSub) connect(ctx context.Context) (*amqp.Session, error) {\n\turi, err := url.Parse(a.metadata.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclientOpts := a.createClientOptions(uri)\n\n\ta.logger.Infof(\"Attempting to connect to %s\", a.metadata.URL)\n\tclient, err := amqp.Dial(ctx, a.metadata.URL, &clientOpts)\n\tif err != nil {\n\t\ta.logger.Fatal(\"Dialing AMQP server:\", err)\n\t}\n\n\t// Open a session\n\tsession, err := client.NewSession(ctx, nil)\n\tif err != nil {\n\t\ta.logger.Fatal(\"Creating AMQP session:\", err)\n\t}\n\n\treturn session, nil\n}", "func (s *Service) Connect(ctx context.Context) error {\n\treturn s.Call(ctx, \"Connect\").Err\n}", "func (transport *IRCTransport) connect() error {\n\tvar conn net.Conn\n\tvar err error\n\t// Establish the connection.\n\tif transport.tlsConfig == nil {\n\t\ttransport.log.Infof(\"Connecting to %s...\", transport.server)\n\t\tconn, err = net.Dial(\"tcp\", transport.server)\n\t} else {\n\t\ttransport.log.Infof(\"Connecting to %s using TLS...\", transport.server)\n\t\tconn, err = tls.Dial(\"tcp\", transport.server, transport.tlsConfig)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Store connection.\n\ttransport.connection = conn\n\ttransport.decoder = irc.NewDecoder(conn)\n\ttransport.encoder = irc.NewEncoder(conn)\n\n\t// Send initial messages.\n\tif transport.password != \"\" {\n\t\ttransport.SendRawMessage(irc.PASS, []string{transport.password}, \"\")\n\t}\n\ttransport.SendRawMessage(irc.NICK, []string{transport.name}, \"\")\n\ttransport.SendRawMessage(irc.USER, []string{transport.user, \"0\", \"*\"}, transport.user)\n\n\ttransport.log.Debugf(\"Succesfully connected.\")\n\treturn nil\n}", "func (s *cinemaServiceServer) connect(ctx context.Context) (*sql.Conn, error) {\n\tc, err := s.db.Conn(ctx)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Unknown, \"failed to connect to database-> \"+err.Error())\n\t}\n\treturn c, nil\n}", "func (rhost *rhostData) connect() {\n\n\t// Get local IP list\n\tips, _ := rhost.getIPs()\n\n\t// Create command buffer\n\tbuf := new(bytes.Buffer)\n\t_, port := rhost.teo.td.GetAddr()\n\tbinary.Write(buf, binary.LittleEndian, byte(len(ips)))\n\tfor _, addr := range ips {\n\t\tbinary.Write(buf, binary.LittleEndian, []byte(addr))\n\t\tbinary.Write(buf, binary.LittleEndian, byte(0))\n\t}\n\tbinary.Write(buf, binary.LittleEndian, uint32(port))\n\tdata := buf.Bytes()\n\tfmt.Printf(\"Connect to r-host, send local IPs\\nip: %v\\nport: %d\\n\", ips, port)\n\n\t// Send command to r-host\n\trhost.teo.sendToTcd(rhost.tcd, CmdConnectR, data)\n\trhost.connected = true\n}", "func Connect(config *viper.Viper) (Connection, error) {\n\tvar c Connection\n\n\terr := c.InitLog(\"\")\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\thost := config.GetString(\"server.host\")\n\tport := config.GetString(\"server.controlPort\")\n\n\tserver := host + \":\" + port\n\tc.connection, err = net.Dial(\"tcp\", server)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\treturn c, nil\n}", "func connect() (client *mongo.Client) {\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(NEWSURI))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn client\n}", "func (c *NATSTestClient) Connect() error {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tc.subs = make(map[string]*Subscription)\n\tc.reqs = make(chan *Request, 256)\n\tc.connected = true\n\treturn nil\n}", "func (m *MongoDB) connect() error {\n\tvar url string\n\tif m.config.GetUser() != \"\" {\n\t\turl = m.config.GetUser()\n\t}\n\tif m.config.GetPassword() != \"\" {\n\t\turl += \":\" + m.config.GetPassword()\n\t}\n\tif m.config.GetUser() != \"\" || m.config.GetPassword() != \"\" {\n\t\turl += \"@\"\n\t}\n\turl += m.config.GetHost() + \":\" + strconv.Itoa(m.config.GetPort())\n\n\tsession, err := mgo.Dial(\"mongodb://\" + url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm.db = session.DB(m.config.GetDatabase())\n\tm.db.Session = session\n\treturn nil\n}", "func (n *Node) connect(entryPoint *peer.Peer) *NodeErr {\n\t// Create the request using a connection message.\n\tmsg := new(message.Message).SetType(message.ConnectType).SetFrom(n.Self)\n\treq, err := composeRequest(msg, entryPoint)\n\tif err != nil {\n\t\treturn ParseErr(\"error encoding message to request\", err)\n\t}\n\n\t// Try to join into the network through the provided peer\n\tres, err := n.client.Do(req)\n\tif err != nil {\n\t\treturn ConnErr(\"error trying to connect to a peer\", err)\n\t}\n\n\tif code := res.StatusCode; code != http.StatusOK {\n\t\terr := fmt.Errorf(\"%d http status received from %s\", code, entryPoint)\n\t\treturn ConnErr(\"error making the request to a peer\", err)\n\t}\n\n\t// Reading the list of current members of the network from the peer\n\t// response.\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn ParseErr(\"error reading peer response body\", err)\n\t}\n\tres.Body.Close()\n\n\t// Parsing the received list\n\treceivedMembers := peer.NewMembers()\n\tif receivedMembers, err = receivedMembers.FromJSON(body); err != nil {\n\t\treturn ParseErr(\"error parsing incoming member list\", err)\n\t}\n\n\t// Update current members and send a connection request to all of them,\n\t// discarting the response received (the list of current members).\n\tfor _, member := range receivedMembers.Peers() {\n\t\t// If a received peer is not the same that contains the current node try\n\t\t// to connect directly.\n\t\tif !n.Self.Equal(member) {\n\t\t\tif req, err := composeRequest(msg, member); err != nil {\n\t\t\t\treturn ParseErr(\"error decoding request to message\", err)\n\t\t\t} else if _, err := n.client.Do(req); err != nil {\n\t\t\t\treturn ConnErr(\"error trying to perform the request\", err)\n\t\t\t}\n\t\t\tn.Members.Append(member)\n\t\t}\n\t}\n\n\t// Set node status as connected.\n\tn.setConnected(true)\n\t// Append the entrypoint to the current members.\n\tn.Members.Append(entryPoint)\n\treturn nil\n}", "func (a *Agent) Connect() error {\n\tfor _, sink := range a.Config.Sinks {\n\t\tswitch st := sink.Sink.(type) {\n\t\tcase optic.ServiceSink:\n\t\t\tif err := st.Start(); err != nil {\n\t\t\t\tlog.Printf(\"ERROR Service for sink '%s' failed to start, exiting\\n%s\\n\",\n\t\t\t\t\tsink.Name(), err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tlog.Printf(\"DEBUG Attempting connection to sink: %s\\n\", sink.Config.Name)\n\n\t\terr := sink.Sink.Connect()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"ERROR Failed to connect to sink %s, retrying in 15s, error was '%s' \\n\",\n\t\t\t\tsink.Name(), err)\n\t\t\ttime.Sleep(15 * time.Second)\n\t\t\terr = sink.Sink.Connect()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tlog.Printf(\"DEBUG Successfully connected to sink: %s\\n\", sink.Config.Name)\n\t}\n\treturn nil\n}", "func (e *ECU) authConnect(ctx *ipc.Context) (*conn.Seesaw, error) {\n\tif ctx == nil {\n\t\treturn nil, errors.New(\"context is nil\")\n\t}\n\tauthCtx, err := e.authenticate(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"authentication failed: %v\", err)\n\t}\n\n\tseesawConn, err := conn.NewSeesawIPC(authCtx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to connect to engine: %v\", err)\n\t}\n\tif err := seesawConn.Dial(e.cfg.EngineSocket); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to connect to engine: %v\", err)\n\t}\n\n\treturn seesawConn, nil\n}", "func connect(dialOpts *DialOpts, grpcServer *grpc.Server, yDialer *YamuxDialer) error {\n\t// dial underlying tcp connection\n\tvar conn net.Conn\n\tvar err error\n\n\tif dialOpts.TLS {\n\t\t// use tls\n\t\tcfg := dialOpts.TLSConfig\n\t\tif cfg == nil {\n\t\t\tcfg = &tls.Config{}\n\t\t}\n\t\tconn, err = tls.Dial(\"tcp\", dialOpts.Addr, cfg)\n\n\t} else {\n\t\tconn, err = (&net.Dialer{}).DialContext(context.Background(), \"tcp\", dialOpts.Addr)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tsession, err := yamux.Client(conn, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\n\t// now that we have a connection, create both clients & servers\n\n\t// setup client\n\tyDialer.SetSession(session)\n\n\t// start grpc server in a separate goroutine. this will exit when the\n\t// underlying session (conn) closes and clean itself up.\n\tgo grpcServer.Serve(session)\n\n\t// return when the conn closes so we can try reconnecting\n\t<-session.CloseChan()\n\treturn nil\n}", "func (b *Backend) connect() (*Op, error) {\n\tif b.session != nil {\n\t\tb.session.Refresh()\n\t\treturn b.newOp(), nil\n\t}\n\tsession, err := b.dial()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb.session = session\n\terr = b.createMongoIndexes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b.newOp(), nil\n}", "func (c *Client) connect() (conn *net.TCPConn, err error) {\n\n\ttype DialResp struct {\n\t\tConn *net.TCPConn\n\t\tError error\n\t}\n\n\t// Open connection to Zabbix host\n\tiaddr, err := c.getTCPAddr()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// dial tcp and handle timeouts\n\tch := make(chan DialResp)\n\n\tgo func() {\n\t\tconn, err = net.DialTCP(\"tcp\", nil, iaddr)\n\t\tch <- DialResp{Conn: conn, Error: err}\n\t}()\n\n\tselect {\n\tcase <-time.After(5 * time.Second):\n\t\terr = fmt.Errorf(\"Connection Timeout\")\n\tcase resp := <-ch:\n\t\tif resp.Error != nil {\n\t\t\terr = resp.Error\n\t\t\tbreak\n\t\t}\n\n\t\tconn = resp.Conn\n\t}\n\n\treturn\n}", "func connect(\n\tladdr string,\n\traddr string,\n\tproto uint,\n\thbint time.Duration,\n) *net.IPConn {\n\tc, err := net.DialIP(\n\t\tfmt.Sprintf(\"ip:%v\", proto),\n\t\tresolve(laddr),\n\t\tresolve(raddr),\n\t)\n\tif nil != err {\n\t\tlog.Fatalf(\"Dial: %v\", err)\n\t}\n\n\t/* Start to heartbeet */\n\tgo heartbeet(c, hbint)\n\n\treturn c\n}", "func connect() ([]client.Client, error) {\n\treturn influx.ConnectService(\"MDS_DB_ADDRESS\", MDS_PORT, \"MDS_USER\", \"MDS_PASSWORD\")\n}", "func (d *DBGenerator) connect(ctx context.Context) error {\n\tif d.Conn == nil {\n\t\tconnStr := fmt.Sprintf(\"vertica://%s:%s@%s:%d/%s?tlsmode=%s\",\n\t\t\td.Opts.User, d.Opts.Password, d.Opts.Host, d.Opts.Port, d.Opts.DBName, d.Opts.TLSMode,\n\t\t)\n\t\tconn, err := sql.Open(\"vertica\", connStr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.Conn = conn\n\t}\n\n\treturn d.Conn.PingContext(ctx)\n}", "func (z *ZkRegistry) connect() error {\n\tif !z.isConnected() {\n\t\tconn, connChan, err := zk.Connect(z.NodeParams.Servers, time.Second)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor {\n\t\t\tisConnected := false\n\n\t\t\tselect {\n\t\t\tcase connEvent := <-connChan:\n\t\t\t\tif connEvent.State == zk.StateConnected {\n\t\t\t\t\tisConnected = true\n\t\t\t\t}\n\t\t\tcase _ = <-time.After(time.Second * 3):\n\t\t\t\treturn errors.New(\"Connect to zookeeper server timeout!\")\n\t\t\t}\n\n\t\t\tif isConnected {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\terr = conn.AddAuth(\"digest\", []byte(z.node.User.UserName+\":\"+z.node.User.Password))\n\t\tif err != nil {\n\t\t\treturn errors.New(\"AddAuth error: \\n\" + err.Error())\n\t\t}\n\n\t\tz.Conn = conn\n\t}\n\n\treturn nil\n}", "func (s *Sender) connect() net.Conn {\n\tbaseGap := 500 * time.Millisecond\n\tfor {\n\t\tconn, err := net.Dial(\"tcp\", s.addr)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\ttime.Sleep(baseGap)\n\t\t\tbaseGap *= 2\n\t\t\tif baseGap > time.Second*30 {\n\t\t\t\tbaseGap = time.Second * 30\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tdebugInfo(fmt.Sprintf(\"local addr:%s\\n\", conn.LocalAddr()))\n\t\treturn conn\n\t}\n}", "func connect() (*websocket.Conn, error) {\n\thost := fmt.Sprintf(\"%s:%s\", configuration.TV.Host, *configuration.TV.Port)\n\tpath := \"/api/v2/channels/samsung.remote.control\"\n\tquery := fmt.Sprintf(\"name=%s\", base64.StdEncoding.EncodeToString([]byte(configuration.Controller.Name)))\n\tu := url.URL{Scheme: *configuration.TV.Protocol, Host: host, Path: path, RawQuery: query}\n\n\tlog.Infof(\"Opening connection to %s ...\", u.String())\n\n\twebsocket.DefaultDialer.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\n\tconnection, _, err := websocket.DefaultDialer.Dial(u.String(), nil)\n\tif err != nil {\n\t\tlog.Debugf(\"%v\", err)\n\t\treturn nil, err\n\t}\n\n\tlog.Infof(\"Connection is established.\")\n\n\treturn connection, nil\n}", "func (cg *CandlesGroup) connect() {\n\tcg.wsClient = websocket.NewClient(wsURL, cg.httpProxy)\n\tif err := cg.wsClient.Connect(); err != nil {\n\t\tlog.Println(\"[BITFINEX] Error connecting to bitfinex API: \", err)\n\t\tcg.restart()\n\t\treturn\n\t}\n\tcg.wsClient.Listen(cg.bus.dch, cg.bus.ech)\n}", "func connect() *r.Session {\n\tsession, _ := r.Connect(r.ConnectOpts{\n\t\tAddress: \"localhost:28015\",\n\t})\n\treturn session\n}", "func (pe *providerEndpoint) Connect(args *ConnectRequest, resp *ConnectResponse) error {\n\tdefer metrics.IncrCounter([]string{\"scada\", \"connect\", args.Capability}, 1)\n\tpe.p.logger.Printf(\"[INFO] scada-client: connect requested (capability: %s)\",\n\t\targs.Capability)\n\n\t// Handle potential flash\n\tif args.Severity != \"\" && args.Message != \"\" {\n\t\tpe.p.logger.Printf(\"[%s] scada-client: %s\", args.Severity, args.Message)\n\t}\n\n\t// Look for the handler\n\thandler := pe.p.config.Handlers[args.Capability]\n\tif handler == nil {\n\t\tpe.p.logger.Printf(\"[WARN] scada-client: requested capability '%s' not available\",\n\t\t\targs.Capability)\n\t\treturn fmt.Errorf(\"invalid capability\")\n\t}\n\n\t// Hijack the connection\n\tpe.setHijack(func(a io.ReadWriteCloser) {\n\t\tif err := handler(args.Capability, args.Meta, a); err != nil {\n\t\t\tpe.p.logger.Printf(\"[ERR] scada-client: '%s' handler error: %v\",\n\t\t\t\targs.Capability, err)\n\t\t}\n\t})\n\tresp.Success = true\n\treturn nil\n}", "func connect(ctx context.Context, session liveshare.LiveshareSession) (Invoker, error) {\n\tlistener, err := listenTCP()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlocalAddress := listener.Addr().String()\n\n\tinvoker := &invoker{\n\t\tsession: session,\n\t\tlistener: listener,\n\t}\n\n\t// Create a cancelable context to be able to cancel background tasks\n\t// if we encounter an error while connecting to the gRPC server\n\tconnectctx, cancel := context.WithCancel(context.Background())\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t}\n\t}()\n\n\tch := make(chan error, 2) // Buffered channel to ensure we don't block on the goroutine\n\n\t// Ensure we close the port forwarder if we encounter an error\n\t// or once the gRPC connection is closed. pfcancel is retained\n\t// to close the PF whenever we close the gRPC connection.\n\tpfctx, pfcancel := context.WithCancel(connectctx)\n\tinvoker.cancelPF = pfcancel\n\n\t// Tunnel the remote gRPC server port to the local port\n\tgo func() {\n\t\tfwd := liveshare.NewPortForwarder(session, codespacesInternalSessionName, codespacesInternalPort, true)\n\t\tch <- fwd.ForwardToListener(pfctx, listener)\n\t}()\n\n\tvar conn *grpc.ClientConn\n\tgo func() {\n\t\t// Attempt to connect to the port\n\t\topts := []grpc.DialOption{\n\t\t\tgrpc.WithTransportCredentials(insecure.NewCredentials()),\n\t\t\tgrpc.WithBlock(),\n\t\t}\n\t\tconn, err = grpc.DialContext(connectctx, localAddress, opts...)\n\t\tch <- err // nil if we successfully connected\n\t}()\n\n\t// Wait for the connection to be established or for the context to be cancelled\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase err := <-ch:\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tinvoker.conn = conn\n\tinvoker.jupyterClient = jupyter.NewJupyterServerHostClient(conn)\n\tinvoker.codespaceClient = codespace.NewCodespaceHostClient(conn)\n\tinvoker.sshClient = ssh.NewSshServerHostClient(conn)\n\n\t// Send initial connection heartbeat (no need to throw if we fail to get a response from the server)\n\t_ = invoker.notifyCodespaceOfClientActivity(ctx, connectedEventName)\n\n\t// Start the activity heatbeats\n\tgo invoker.heartbeat(pfctx, 1*time.Minute)\n\n\treturn invoker, nil\n}", "func (h *Handler) Connect(ctx context.Context, in *backend.StatusRequest, out *backend.StatusResponse) error {\n\t// nothing to do\n\treturn nil\n}", "func (m *MysqlRepository) connect() error {\n\tif !m.connected {\n\t\tdb, err := sql.Open(\"mysql\", m.Credentials)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tm.db = db\n\t\tm.connected = true\n\t}\n\n\treturn nil\n}", "func connect() (Publisher, error) {\n\tif publisher != nil {\n\t\treturn publisher, nil\n\t}\n\tconfigNSQ := nsq.NewConfig()\n\tclient, err := nsq.NewProducer(os.Getenv(\"NSQ_PUBLISHER\"), configNSQ)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.SetLogger(nullLogger, nsq.LogLevelInfo)\n\tpublisher = &Produce{\n\t\tInstance: client,\n\t}\n\treturn publisher, nil\n}", "func (kms *kmipKMS) connect() (*tls.Conn, error) {\n\tconn, err := tls.Dial(\"tcp\", kms.endpoint, kms.tlsConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to dial kmip connection endpoint: %w\", err)\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tconn.Close()\n\t\t}\n\t}()\n\tif kms.readTimeout != 0 {\n\t\terr = conn.SetReadDeadline(time.Now().Add(time.Second * time.Duration(kms.readTimeout)))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to set read deadline: %w\", err)\n\t\t}\n\t}\n\tif kms.writeTimeout != 0 {\n\t\terr = conn.SetReadDeadline(time.Now().Add(time.Second * time.Duration(kms.writeTimeout)))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to set write deadline: %w\", err)\n\t\t}\n\t}\n\n\terr = conn.Handshake()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to perform connection handshake: %w\", err)\n\t}\n\n\terr = kms.discover(conn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "func (h *Health) Connect() error {\n\tauthHandler := internal.BasicAuthHandler(h.BasicUsername, h.BasicPassword, \"health\", onAuthError)\n\n\th.server = &http.Server{\n\t\tAddr: h.ServiceAddress,\n\t\tHandler: authHandler(h),\n\t\tReadTimeout: time.Duration(h.ReadTimeout),\n\t\tWriteTimeout: time.Duration(h.WriteTimeout),\n\t\tTLSConfig: h.tlsConf,\n\t}\n\n\tlistener, err := h.listen()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\th.origin = h.getOrigin(listener)\n\n\th.Log.Infof(\"Listening on %s\", h.origin)\n\n\th.wg.Add(1)\n\tgo func() {\n\t\tdefer h.wg.Done()\n\t\terr := h.server.Serve(listener)\n\t\tif err != http.ErrServerClosed {\n\t\t\th.Log.Errorf(\"Serve error on %s: %v\", h.origin, err)\n\t\t}\n\t\th.origin = \"\"\n\t}()\n\n\treturn nil\n}", "func (s *MQ) connect(name string) (*amqp.Connection, error) {\n\tif name == \"\" {\n\t\tname = s.ConnectionName\n\t}\n\tif name == \"\" {\n\t\tname = s.name\n\t}\n\ts.Log(\"connecting %q\", name)\n\n\tvar heartBeat = s.HeartBeat\n\tif heartBeat == 0 {\n\t\theartBeat = 10\n\t}\n\n\t// Use the user provided client name\n\tconnection, err := amqp.DialConfig(s.Url, amqp.Config{\n\t\tHeartbeat: time.Duration(heartBeat) * time.Second,\n\t\tProperties: amqp.Table{\n\t\t\t\"product\": s.Product,\n\t\t\t\"version\": s.Version,\n\t\t\t\"connection_name\": name,\n\t\t},\n\t\tLocale: \"en_US\",\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.Log(\"connected\")\n\treturn connection, nil\n}", "func (network *tcp_net) connect(channels int) {\n\t// Resolving address of endpoint\n\taddr, err := net.ResolveTCPAddr(\"tcp\", network.api.endpoint)\n\tif err != nil {\n\t\tgo network.api.trigger_local(EVENT_ON_ERROR,\n\t\t\t[]byte(fmt.Sprintf(\"Unable to resolve given endpoint %s from TCP -> %s\", network.api.endpoint, err.Error())))\n\t\treturn\n\t}\n\n\t// getting handshake from TreeApi\n\thandshake_data := network.api.firstHandshake()\n\n\tfor i := 0; i < channels; i++ {\n\t\tconn, err := net.DialTCP(\"tcp\", nil, addr)\n\t\tif err != nil {\n\t\t\tgo network.api.trigger_local(EVENT_ON_ERROR,\n\t\t\t\t[]byte(fmt.Sprintf(\"Unable to connect to given endpoint %s from TCP -> %s\", network.api.endpoint, err.Error())))\n\t\t} else {\n\t\t\tnetwork.connection_locker.Lock()\n\t\t\tnetwork.connections[tcp_conn_index] = conn\n\t\t\tgo network.handle_connection(tcp_conn_index, conn, handshake_data)\n\t\t\tgo network.api.trigger_local(EVENT_ON_CHANNEL_CONNECTION, []byte{})\n\t\t\ttcp_conn_index++\n\t\t\tnetwork.connection_locker.Unlock()\n\t\t}\n\t}\n}", "func (ds *gcdatastore) connect() (err error) {\n\tctx := context.Background()\n\n\tds.Client, err = datastore.NewClient(ctx, ds.gcloudProjectID, ds.gcloudClientOpts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (conn *Conn) internalConnect(ctx context.Context) error {\n\tconn.mu.Lock()\n\tdefer conn.mu.Unlock()\n\tconn.initialise()\n\n\tif conn.cfg.Server == \"\" {\n\t\treturn fmt.Errorf(\"irc.Connect(): cfg.Server must be non-empty\")\n\t}\n\tif conn.connected {\n\t\treturn fmt.Errorf(\"irc.Connect(): Cannot connect to %s, already connected.\", conn.cfg.Server)\n\t}\n\n\tif !hasPort(conn.cfg.Server) {\n\t\tif conn.cfg.SSL {\n\t\t\tconn.cfg.Server = net.JoinHostPort(conn.cfg.Server, \"6697\")\n\t\t} else {\n\t\t\tconn.cfg.Server = net.JoinHostPort(conn.cfg.Server, \"6667\")\n\t\t}\n\t}\n\n\tif conn.cfg.Proxy != \"\" {\n\t\tproxyURL, err := url.Parse(conn.cfg.Proxy)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tproxyDialer, err := proxy.FromURL(proxyURL, conn.dialer)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcontextProxyDialer, ok := proxyDialer.(proxy.ContextDialer)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Dialer for proxy does not support context\")\n\t\t}\n\t\tconn.proxyDialer = contextProxyDialer\n\t\tlogging.Info(\"irc.Connect(): Connecting to %s.\", conn.cfg.Server)\n\t\tif s, err := conn.proxyDialer.DialContext(ctx, \"tcp\", conn.cfg.Server); err == nil {\n\t\t\tconn.sock = s\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlogging.Info(\"irc.Connect(): Connecting to %s.\", conn.cfg.Server)\n\t\tif s, err := conn.dialer.DialContext(ctx, \"tcp\", conn.cfg.Server); err == nil {\n\t\t\tconn.sock = s\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif conn.cfg.SSL {\n\t\tlogging.Info(\"irc.Connect(): Performing SSL handshake.\")\n\t\ts := tls.Client(conn.sock, conn.cfg.SSLConfig)\n\t\tif err := s.Handshake(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tconn.sock = s\n\t}\n\n\tconn.postConnect(ctx, true)\n\tconn.connected = true\n\treturn nil\n}", "func (observer *Observer) Connect(id int32, port int32) {\n\tobserver.connector.Connect(id, port)\n}", "func (s *Stackdriver) Connect() error {\n\tif s.Project == \"\" {\n\t\treturn fmt.Errorf(\"project is a required field for stackdriver output\")\n\t}\n\n\tif s.Namespace == \"\" {\n\t\ts.Log.Warn(\"plugin-level namespace is empty\")\n\t}\n\n\tif s.ResourceType == \"\" {\n\t\ts.ResourceType = \"global\"\n\t}\n\n\tif s.ResourceLabels == nil {\n\t\ts.ResourceLabels = make(map[string]string, 1)\n\t}\n\n\tif s.counterCache == nil {\n\t\ts.counterCache = NewCounterCache(s.Log)\n\t}\n\n\ts.ResourceLabels[\"project_id\"] = s.Project\n\n\tif s.client == nil {\n\t\tctx := context.Background()\n\t\tclient, err := monitoring.NewMetricClient(ctx, option.WithUserAgent(internal.ProductToken()))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.client = client\n\t}\n\n\treturn nil\n}", "func connect() *websocket.Conn {\n\turl := url.URL{Scheme: \"ws\", Host: *addr, Path: \"/ws\"}\n\tlog.Info(\"Connecting to \", url.String())\n\tconn, _, err := dialer.Dial(url.String(), nil)\n\tcheckError(err)\n\tlog.Info(\"Connected to \", url.String())\n\n\t// Read the message from server with deadline of ResponseWait(30) seconds\n\tconn.SetReadDeadline(time.Now().Add(utils.ResponseWait * time.Second))\n\n\treturn conn\n}", "func (a *Agent) connect(addrs []string) {\n\n\tfor _, addr := range addrs {\n\t\tconn, err := net.Dial(\"tcp\", addr)\n\t\tif err != nil {\n\t\t\t// warn := fmt.Sprintf(\"could not connect to '%s' : %v\", addr, err)\n\t\t\t// a.warningCh <- warn\n\t\t\tcontinue\n\t\t}\n\t\ta.logger.Printf(\"[INFO] node '%v' : established an outgoing connection to peer with address %v\", a.ID(), conn.LocalAddr().String())\n\t\t// peer := NewPeer(conn)\n\t\t// if err := peerManager.Handshake(peer); err != nil {\n\t\t// \tlog.Fatalf(\"Error adding initial peer %s: %s\", peer, err)\n\t\t// }\n\t}\n}", "func (bp *Processer) Connect(addr string) (err error) {\n\tbp.log(\"Connect:%s\", addr)\n\tbp.CloseServer()\n\tbp.svr, err = GetServer(addr)\n\tif err != nil {\n\t\treturn\n\t}\n\tbp.svr.AddProcesser(bp, 0)\n\tbp.log(\"Connect finish \")\n\treturn\n}", "func (c *Client) Connect(url *common.URL) error {\n\tinitClient(url.Protocol)\n\tc.conf = *clientConf\n\tc.sslEnabled = c.conf.SSLEnabled\n\t// codec\n\tc.codec = remoting.GetCodec(url.Protocol)\n\tc.addr = url.Location\n\t_, _, err := c.selectSession(c.addr)\n\tif err != nil {\n\t\tlogger.Errorf(\"try to connect server %v failed for : %v\", url.Location, err)\n\t}\n\treturn err\n}", "func (l *Writer) connect() error {\n\tif l.writer != nil {\n\t\tl.writer.Close()\n\t\tl.writer = nil\n\t}\n\n\tc, err := net.Dial(\"udp\", l.raddr)\n\tif err == nil {\n\t\tl.writer = c\n\t}\n\treturn err\n}", "func (s *MultipassServer) Connect(ctx context.Context, request *apigrpc.ConnectRequest) (*apigrpc.ConnectReply, error) {\n\tglog.V(5).Infof(\"Call server Connect: %v\", request)\n\n\tif request.GetProviderID() != s.Configuration.ProviderID {\n\t\tglog.Errorf(errMismatchingProvider)\n\t\treturn nil, fmt.Errorf(errMismatchingProvider)\n\t}\n\n\tif request.GetResourceLimiter() != nil {\n\t\ts.ResourceLimiter = &ResourceLimiter{\n\t\t\tMinLimits: request.ResourceLimiter.MinLimits,\n\t\t\tMaxLimits: request.ResourceLimiter.MaxLimits,\n\t\t}\n\t}\n\n\ts.NodesDefinition = request.GetNodes()\n\ts.AutoProvision = request.GetAutoProvisionned()\n\n\tif request.GetKubeAdmConfiguration() != nil {\n\t\ts.KubeAdmConfiguration = request.GetKubeAdmConfiguration()\n\t}\n\n\tif s.AutoProvision {\n\t\tif err := s.doAutoProvision(); err != nil {\n\t\t\tglog.Errorf(errUnableToAutoProvisionNodeGroup, err)\n\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &apigrpc.ConnectReply{\n\t\tResponse: &apigrpc.ConnectReply_Connected{\n\t\t\tConnected: true,\n\t\t},\n\t}, nil\n}", "func (c *client) Connect(ctx context.Context) error {\n\tctx, cancel := context.WithTimeout(ctx, c.timeout)\n\tdefer cancel()\n\n\tconn, err := grpc.DialContext(ctx, c.uri, grpc.WithInsecure(), grpc.WithBlock())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not connect to store at %s: %w\", c.uri, err)\n\t}\n\n\tc.services = &services{\n\t\tkvc: eventstore.NewKVClient(conn),\n\t\tmapc: eventstore.NewMapClient(conn),\n\t\tqueuec: eventstore.NewQueueClient(conn),\n\t}\n\n\treturn nil\n}", "func (rc *Store) connectInit() error {\n\trc.conn = memcache.New(rc.conninfo...)\n\treturn nil\n}", "func connect() {\n\tconn, err := http.NewConnection(http.ConnectionConfig{\n\t\tEndpoints: []string{hlp.Conf.DB.URL},\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create HTTP connection: %v\", err)\n\t}\n\n\tclient, err := driver.NewClient(driver.ClientConfig{\n\t\tConnection: conn,\n\t\tAuthentication: driver.BasicAuthentication(\n\t\t\thlp.Conf.DB.User,\n\t\t\thlp.Conf.DB.Pass,\n\t\t),\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create new client: %v\", err)\n\t}\n\n\tctx := context.Background()\n\tdb, err := client.Database(ctx, \"cardo_dev\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to open database: %v\", err)\n\t}\n\n\tDatabase = db\n}", "func connectRemote() {\n\taddress := *server + \":\" + *port\n\tfmt.Println(\"Attempting to connect to remote @\" + address)\n\tconn, err := net.Dial(\"tcp\", address)\n\tif err != nil {\n\t\tremoteError(err)\n\t}\n\tfmt.Println(\"Connected to remote @\" + address)\n\tRemoteServer = conn\n\n\t//TODO reply to the keep alive messages?\n\n}", "func (c *Connection) Start(options connection.ConnectOptions) (err error) {\n\tvar config wg.ServiceConfig\n\tif err := json.Unmarshal(options.SessionConfig, &config); err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmarshal connection config\")\n\t}\n\tc.config.Provider = config.Provider\n\tc.config.Consumer.IPAddress = config.Consumer.IPAddress\n\n\t// We do not need port mapping for consumer, since it initiates the session\n\tfakePortMapper := func(port int) (releasePortMapping func()) {\n\t\treturn func() {}\n\t}\n\n\tresourceAllocator := connectionResourceAllocator()\n\tc.connectionEndpoint, err = endpoint.NewConnectionEndpoint(location.ServiceLocationInfo{}, resourceAllocator, fakePortMapper, 0)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create new connection endpoint\")\n\t}\n\n\tc.connection.Add(1)\n\tc.stateChannel <- connection.Connecting\n\n\tif err := c.connectionEndpoint.Start(&c.config); err != nil {\n\t\tc.stateChannel <- connection.NotConnected\n\t\tc.connection.Done()\n\t\treturn errors.Wrap(err, \"failed to start connection endpoint\")\n\t}\n\n\t// Provider requests to delay consumer connection since it might be in a process of setting up NAT traversal for given consumer\n\tif config.Consumer.ConnectDelay > 0 {\n\t\tlog.Infof(\"%s delaying connect for %v milliseconds\", logPrefix, config.Consumer.ConnectDelay)\n\t\ttime.Sleep(time.Duration(config.Consumer.ConnectDelay) * time.Millisecond)\n\t}\n\n\tif err := c.connectionEndpoint.AddPeer(c.config.Provider.PublicKey, &c.config.Provider.Endpoint); err != nil {\n\t\tc.stateChannel <- connection.NotConnected\n\t\tc.connection.Done()\n\t\treturn errors.Wrap(err, \"failed to add peer to the connection endpoint\")\n\t}\n\n\tif err := c.connectionEndpoint.ConfigureRoutes(c.config.Provider.Endpoint.IP); err != nil {\n\t\tc.stateChannel <- connection.NotConnected\n\t\tc.connection.Done()\n\t\treturn errors.Wrap(err, \"failed to configure routes for connection endpoint\")\n\t}\n\n\tif err := c.waitHandshake(); err != nil {\n\t\tc.stateChannel <- connection.NotConnected\n\t\tc.connection.Done()\n\t\treturn errors.Wrap(err, \"failed while waiting for a peer handshake\")\n\t}\n\n\tgo c.runPeriodically(time.Second)\n\n\tc.stateChannel <- connection.Connected\n\treturn nil\n}", "func connect(host string) (*ldap.Conn, error) {\n\tc, err := net.DialTimeout(\"tcp\", host, time.Second*8)\n\tif err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tconn := ldap.NewConn(c, false)\n\tconn.Start()\n\treturn conn, nil\n}", "func Connect(ctx context.Context, drCSIAddress string, metricsManager metrics.CSIMetricsManager) (conn *grpc.ClientConn, err error) {\n\tvar m sync.Mutex\n\tvar canceled bool\n\tready := make(chan bool)\n\tgo func() {\n\t\tconn, err = connection.Connect(drCSIAddress, metricsManager)\n\n\t\tm.Lock()\n\t\tdefer m.Unlock()\n\t\tif err != nil && canceled {\n\t\t\t_ = conn.Close()\n\t\t}\n\n\t\tclose(ready)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\tm.Lock()\n\t\tdefer m.Unlock()\n\t\tcanceled = true\n\t\treturn nil, ctx.Err()\n\n\tcase <-ready:\n\t\treturn conn, err\n\t}\n}", "func (a *Application) Connect(conn *connection.Connection) {\n\tlog.Infof(\"adding a new Connection %s to Application %s\", conn.SocketID, a.Name)\n\ta.Lock()\n\tdefer a.Unlock()\n\n\ta.connections[conn.SocketID] = conn\n\n\ta.Stats.Add(\"TotalConnections\", 1)\n}", "func (client *Client) connect(connType string) net.Conn {\n\tconn, err := net.Dial(connType, client.ipAddr+\":\"+client.port)\n\tif err != nil {\n\t\tlog.Fatal(\"Error during the connection :\", err)\n\t}\n\treturn conn\n}", "func (h *handler) Connect(c *session.Client) {\n\tif c == nil {\n\t\th.logger.Error(LogErrFailedConnect + (ErrClientNotInitialized).Error())\n\t\treturn\n\t}\n\th.logger.Info(fmt.Sprintf(LogInfoConnected, c.ID))\n}", "func (m *RPCModule) connect(host string, port int, user, pass string) util.Map {\n\n\t// Create a client\n\tc := client.NewClient(&types2.Options{\n\t\tHost: host,\n\t\tPort: port,\n\t\tUser: user,\n\t\tPassword: pass,\n\t})\n\n\t// Create a RPC context\n\tctx := m.ClientContextMaker(c)\n\n\t// Add call function for raw calls\n\tctx.Objects[\"call\"] = ctx.call\n\n\t// Attempt to query the methods from the RPC server.\n\t// Panics if not successful.\n\tmethods := ctx.call(\"rpc_methods\")\n\n\t// Build RPC namespaces and add methods into them\n\tfor _, method := range methods[\"methods\"].([]interface{}) {\n\t\to := objx.New(method)\n\t\tnamespace := o.Get(\"namespace\").String()\n\t\tname := o.Get(\"name\").String()\n\t\tnsObj, ok := ctx.Objects[namespace]\n\t\tif !ok {\n\t\t\tnsObj = make(map[string]interface{})\n\t\t\tctx.Objects[namespace] = nsObj\n\t\t}\n\t\tnsObj.(map[string]interface{})[name] = func(params ...interface{}) interface{} {\n\t\t\treturn ctx.call(fmt.Sprintf(\"%s_%s\", namespace, name), params...)\n\t\t}\n\t}\n\n\treturn ctx.Objects\n}", "func (this Scanner) connect(user, host string, conf ssh.ClientConfig) (*ssh.Client, *ssh.Session, error) {\n\t// Develop the network connection out\n\tconn, err := ssh.Dial(\"tcp\", host, &conf)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Actually perform our connection\n\tsession, err := conn.NewSession()\n\tif err != nil {\n\t\tconn.Close()\n\t\treturn nil, nil, err\n\t}\n\n\treturn conn, session, nil\n}", "func doConnect(qmName string) error {\n\n\t// Set connection configuration\n\tvar connConfig mqmetric.ConnectionConfig\n\tconnConfig.ClientMode = false\n\tconnConfig.UserId = \"\"\n\tconnConfig.Password = \"\"\n\n\t// Connect to the queue manager - open the command and dynamic reply queues\n\terr := mqmetric.InitConnectionStats(qmName, \"SYSTEM.DEFAULT.MODEL.QUEUE\", \"\", &connConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to connect to queue manager %s: %v\", qmName, err)\n\t}\n\n\t// Discover available metrics for the queue manager and subscribe to them\n\terr = mqmetric.DiscoverAndSubscribe(\"\", true, \"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to discover and subscribe to metrics: %v\", err)\n\t}\n\n\treturn nil\n}", "func (b *broker) connect() error {\n\tvar err error\n\turi := fmt.Sprintf(\n\t\t\"%v://%v:%v@%v:%v/\",\n\t\tb.Scheme,\n\t\tb.User,\n\t\tb.Pass,\n\t\tb.Host,\n\t\tb.Port,\n\t)\n\tif b.connection, err = amqp.Dial(uri); err != nil {\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"url\": uri,\n\t\t\t\"error\": err,\n\t\t}).Warn(\"error while dialling AMQP broker\")\n\t\treturn errors.Wrap(err, \"while dialling AMQP broker\")\n\t}\n\tif b.achannel, err = b.connection.Channel(); err != nil {\n\t\treturn errors.Wrap(err, \"could not open AMQP channel\")\n\t}\n\t// Best practice for AMQP is to unconditionally declare the exchange on connection\n\tif err = b.achannel.ExchangeDeclare(\n\t\tb.Exchange, // name of the exchange\n\t\t\"topic\", // type is always topic\n\t\ttrue, // durable\n\t\tfalse, // delete when complete\n\t\tfalse, // internal\n\t\tfalse, // noWait\n\t\tnil, // arguments\n\t); err != nil {\n\t\treturn errors.Wrap(err, \"could not declare AMQP exchange\")\n\t}\n\tb.closed = make(chan *amqp.Error)\n\tb.achannel.NotifyClose(b.closed)\n\n\treturn nil\n}", "func connect() (connection mysql.Conn) {\n\tuser := \"root\"\n\tpass := \"toor\"\n\tdbname := \"trackerdb\"\n\tproto := \"tcp\"\n\taddr := \"127.0.0.1:3306\"\n\n\tdb := mysql.New(proto, \"\", addr, user, pass, dbname)\n\n\terr := db.Connect()\n\tif err != nil {\n\t\tfmt.Println(\"Database Connection Error:\", err)\n\t}\n\n\treturn db\n}", "func (c *Client) Connect() error {\n\t//c.handlers = make(map[string]func(Event))\n\t//c.respQ = make(chan map[string]interface{}, bufferSize)\n\n\tconn, err := connectWS(c.Host, c.Port)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Conn = conn\n\n\tglobal.LOG.Info(\"logged in (authentication successful)\")\n\tc.connected = true\n\treturn nil\n}", "func (c *Driver) Connect() error {\n\tif !IsChannelValid(c.channel) {\n\t\treturn InvalidChanName\n\t}\n\n\tc.clean()\n\tconn, err := net.Dial(\"tcp\", fmt.Sprintf(\"%s:%d\", c.Host, c.Port))\n\tif err != nil {\n\t\treturn err\n\t} \n\t\n\tc.closed = false\n\tc.conn = conn\n\tc.reader = bufio.NewReader(c.conn)\n\n\terr = c.write(fmt.Sprintf(\"START %s %s\", c.channel, c.Password))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.read()\n\t_, err = c.read()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func on_connect(c net.Conn) {\n conn := create_connection(c)\n connected_clients_mutex.Lock()\n conn_id, _ := strconv.Atoi(conn.id)\n connected_clients[conn_id] = conn\n connected_clients_mutex.Unlock()\n handle_conn(conn)\n}", "func (s *bookingServiceServer) connect(ctx context.Context) (*sql.Conn, error) {\n\tc, err := s.db.Conn(ctx)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Unknown, \"failed to connect to database-> \"+err.Error())\n\t}\n\treturn c, nil\n}", "func (l *Lock) Connect(ctx context.Context) (err error) {\n\tl.logger.Debug(\"node %s connecting to consul lock %s\", l.id, l.config.Consul.Address)\n\tif l.client != nil {\n\t\treturn fmt.Errorf(\"node %s already connected\", l.id)\n\t}\n\n\tl.client, err = consul.NewClient(l.config.Consul)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (i *IrcClient) Connect(uri string, sslCert string, sslKey string) {\n\tlog(\"IRC connect - connecting to \" + uri)\n\n\ti.Outgoing = make(chan []byte, 100)\n\t\n\tvar err error\n\tcert, err := tls.LoadX509KeyPair(sslCert, sslKey)\n\tif err != nil {\n\t\tlog(\"IRC connect - error loading X509 Key Pair\")\n\t\tlog(err.Error())\n\t\treturn\n\t}\n\n config := tls.Config{Certificates: []tls.Certificate{cert}, InsecureSkipVerify: true}\n\ti.Conn, err = tls.Dial(\"tcp\", uri, &config)\n\n\tif err != nil {\n\t\tlog(\"IRC connect - error connecting to \" + uri)\n\t\tlog(err.Error())\n\t\treturn \n\t}\n\n\ti.Connected = true\n\n\tlog(\"IRC connect - connection successful to \" + uri + \" \" + i.Conn.RemoteAddr().String())\n}", "func (r *Rmq) Connect() {\n\tconn, err := amqp.Dial(r.uri)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tr.conn = conn\n\n\tch, err := conn.Channel()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tr.ch = ch\n}", "func (c *CommunicationClient) Connect() error{\r\n\r\n if c.conn != nil{\r\n if c.conn.IsClosed() {\r\n conn, err := amqp.Dial(c.host)\r\n\r\n if err != nil {\r\n return err\r\n }\r\n\r\n ch, err := conn.Channel()\r\n\r\n if err != nil {\r\n return err\r\n }\r\n\r\n c.conn = conn\r\n c.ch = ch\r\n\r\n return nil\r\n }else{\r\n\r\n ch, err := c.conn.Channel()\r\n\r\n if err != nil {\r\n return err\r\n }\r\n\r\n c.ch = ch\r\n\r\n return nil\r\n }\r\n }else{\r\n conn, err := amqp.Dial(c.host)\r\n\r\n if err != nil {\r\n return err\r\n }\r\n\r\n ch, err := conn.Channel()\r\n\r\n if err != nil {\r\n return err\r\n }\r\n\r\n c.conn = conn\r\n c.ch = ch\r\n\r\n return nil\r\n }\r\n\r\n\r\n}", "func (s *Server) Connect() {\n\tconnectionAddr := fmt.Sprintf(\"amqp://%s:%s@%s\", s.RabbitMQUsername, s.RabbitMQPassword, s.RabbitMQHost)\n\tconn, err := amqp.Dial(connectionAddr)\n\tFailOnError(err, \"Failed to connect to RabbitMQ\")\n\ts.Conn = conn\n}", "func (c *client) connect() error {\n\tvar connection *sql.DB\n\tvar err error\n\tif os.Getenv(\"MODE\") == \"development\" {\n\t\tvar connectionString = fmt.Sprintf(\n\t\t\t\"host=%s port=%s user=%s password=%s dbname=%s sslmode=disable\",\n\t\t\tos.Getenv(\"PGHOST\"),\n\t\t\tos.Getenv(\"PGPORT\"),\n\t\t\tos.Getenv(\"PGUSER\"),\n\t\t\tos.Getenv(\"PGPASSWORD\"),\n\t\t\tos.Getenv(\"PGDATABASE\"),\n\t\t)\n\t\tc.connectionString = connectionString\n\t\tconnection, err = sql.Open(\"postgres\", connectionString)\n\t} else if os.Getenv(\"MODE\") == \"production\" {\n\t\tconnection, err = sql.Open(\"postgres\", os.Getenv(\"DATABASE_URL\"))\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"connection to pg failed: %v\", err)\n\t}\n\n\tc.db = connection\n\n\tfmt.Println(\"postgres connection established...\")\n\treturn nil\n}", "func (r *Runtime) Connect(ta TaskAssigner) (e error) {\n\tif r.isConnected {\n\t\te = errors.New(\"Already allocated worker\")\n\t\treturn\n\t}\n\n\tr.isConnected = true\n\tr.taskAssigner = ta\n\n\treturn\n}", "func ExampleConnect() {\n\terrChan := make(chan error)\n\n\topts := &Options{\n\t\tUsername: \"username\",\n\t\tPassword: \"password\",\n\t}\n\n\t// connect to the server\n\tconn, err := Connect(\"ws://localhost:9191/channel\", opts, errChan)\n\tif err != nil {\n\t\tlog.Printf(\"connect failed: %s\", err)\n\t\treturn\n\t}\n\n\t// disconnect from the server when done with the connection\n\tdefer conn.Disconnect()\n\n\t// listen for asynnchronous errors\n\tgo func() {\n\t\tfor err := range errChan {\n\t\t\tlog.Printf(\"connection error: %s\", err)\n\t\t}\n\t}()\n\t// Output:\n}", "func (s *Realm) OnConnect(c *connection.Connection) {\r\n\tslog.Printf(\"New Connection from: %s\\n\", c.PeerAddr())\r\n\r\n\tsess := &RealmSession{\r\n\t\tConn: c,\r\n\t\tStartTime: time.Now(),\r\n\t}\r\n\r\n\ts.mtx.Lock()\r\n\te := s.conns.PushBack(sess)\r\n\ts.mtx.Unlock()\r\n\tc.SetContext(e)\r\n\r\n\tc.Send([]byte(\"fvpvTbKVC\\\\WnpqQvh_xdY\\\\\\\\\"))\r\n}", "func (tg *TradesGroup) connect() {\n\ttg.wsClient = websocket.NewClient(wsURL, tg.httpProxy)\n\tif err := tg.wsClient.Connect(); err != nil {\n\t\tlog.Println(\"[BITFINEX] Error connecting to bitfinex API: \", err)\n\t\treturn\n\t}\n\ttg.wsClient.Listen(tg.bus.dch, tg.bus.ech)\n}", "func (metrics *Metrics) Connect() error {\n\t// Make sure the connection isn't open\n\tif metrics.conn != nil {\n\t\t_ = metrics.conn.Close()\n\t}\n\t// Prepare connection string\n\tconnString := fmt.Sprintf(\"%s:%d\", metrics.Host, metrics.Port)\n\t// Check timeout\n\tif metrics.Timeout == 0 {\n\t\tmetrics.Timeout = defaultTimeout * time.Second\n\t}\n\tvar err error\n\tvar conn net.Conn\n\tvar udpAddr *net.UDPAddr\n\t// Establish connection by type\n\tif metrics.Protocol == \"udp\" {\n\t\tudpAddr, err = net.ResolveUDPAddr(\"udp\", connString)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tconn, err = net.DialUDP(metrics.Protocol, nil, udpAddr)\n\t} else {\n\t\tconn, err = net.DialTimeout(metrics.Protocol, connString, metrics.Timeout)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tmetrics.conn = conn\n\n\treturn nil\n}" ]
[ "0.67077905", "0.6634654", "0.6631335", "0.65912145", "0.6491219", "0.64541703", "0.64315164", "0.6377671", "0.6353071", "0.63220286", "0.6295981", "0.62878853", "0.626565", "0.6226095", "0.6194442", "0.6186907", "0.6164935", "0.6159773", "0.61356914", "0.6104107", "0.61007744", "0.6068302", "0.603995", "0.60278696", "0.60051", "0.5998215", "0.5992943", "0.59671515", "0.59588516", "0.5957083", "0.5942206", "0.5936303", "0.59344125", "0.59227145", "0.5921486", "0.5911093", "0.5904933", "0.590149", "0.5899057", "0.58863455", "0.58858293", "0.58787376", "0.58680916", "0.5862187", "0.5862025", "0.5856846", "0.5850692", "0.5844529", "0.58437955", "0.58320504", "0.58240944", "0.5814951", "0.57989436", "0.57944036", "0.5790564", "0.5779234", "0.5769868", "0.5753728", "0.57514966", "0.5745133", "0.57359046", "0.57336456", "0.5708663", "0.5706979", "0.57029796", "0.5702311", "0.569683", "0.5693575", "0.5691396", "0.56771964", "0.56662804", "0.56610626", "0.5660661", "0.5657735", "0.5656118", "0.5651937", "0.56512475", "0.5645267", "0.5642474", "0.56396514", "0.56363964", "0.56362575", "0.56346434", "0.56323576", "0.56299764", "0.5627739", "0.56276566", "0.5619894", "0.5613247", "0.5612177", "0.5604068", "0.56025994", "0.560107", "0.559706", "0.55924183", "0.55908036", "0.5580322", "0.55776775", "0.5571728", "0.55670136" ]
0.7555079
0
Close closes the connection to the server.
func (rc *RemoteCollector) Close() error { rc.mu.Lock() defer rc.mu.Unlock() if rc.pconn != nil { err := rc.pconn.Close() rc.pconn = nil return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Server) Close() {\n\ts.conn.Close()\n}", "func (c *SodaClient) Close() {\n\tc.conn.Close()\n}", "func (n *NSCAServer) Close() {\n\tif n.conn != nil {\n\t\tn.conn.Close()\n\t\tn.conn = nil\n\t}\n\tn.serverTimestamp = 0\n\tn.encryption = nil\n}", "func (s *Server) CloseConnection() {}", "func (s *APIServer) Close() {\n\tif s.conn == nil {\n\t\treturn\n\t}\n\ts.conn.Close()\n\ts.conn = nil\n}", "func (s *Server) Close() {\n\ts.closed = true\n\ts.conn.Close()\n}", "func (s *JS8Server) Close() error {\n\tclose(s.shutdown)\n\treturn s.conn.Close()\n}", "func (s *Server) Close() {\n\ts.Conn.Close()\n}", "func (c *client) Close() error { return c.c.Close() }", "func (s *Server) Close() {\n s.setupConn.Close()\n}", "func (server *TempestServer) Close() error {\n\treturn server.conn.Close()\n}", "func (c *Client) Close() {}", "func (c *Client) Close() {}", "func (c *Conn) Close() error { return nil }", "func (c *Client) Close() {\n\t_ = c.conn.Close()\n}", "func (v *connection) Close() error {\n\tconnectionLogger.Trace(\"connection.Close()\")\n\n\tv.sendMessage(&msgs.FETerminateMsg{})\n\n\tvar result error = nil\n\n\tif v.conn != nil {\n\t\tresult = v.conn.Close()\n\t\tv.conn = nil\n\t}\n\n\treturn result\n}", "func Close() error {\n\treturn server.Close()\n}", "func Close() {\n\tconn.Close()\n}", "func (r *client) Close() error {\n\treturn r.conn.Close()\n}", "func (s *EchoerServerStream) Close() error {\n\tvar err error\n\tif s.conn == nil {\n\t\treturn nil\n\t}\n\tif err = s.conn.WriteControl(\n\t\twebsocket.CloseMessage,\n\t\twebsocket.FormatCloseMessage(websocket.CloseNormalClosure, \"server closing connection\"),\n\t\ttime.Now().Add(time.Second),\n\t); err != nil {\n\t\treturn err\n\t}\n\treturn s.conn.Close()\n}", "func (s *SocketClient) Close() {\n\ts.conn.Close()\n}", "func (pc *Client) Close() {\n\tpc.connected = false\n\tpc.connection.Close()\n}", "func (c *Client) Close() {\n\tc.conn.Close()\n}", "func (c *Client) Close() {\n\tc.conn.Close()\n}", "func (c *Client) Close() {\n\tc.conn.Close()\n}", "func (c *Client) Close() {\n\tc.conn.Close()\n}", "func (c *Client) Close() {\n\tc.conn.Close()\n}", "func (c *Client) Close() {\n\tc.conn.Close()\n}", "func (c *ManetConnection) Close() {\n\tc.conn.Close()\n}", "func (client *Client) Close() {\n\tclient.conn.Close()\n}", "func (s *Socket) Close() {\n\ts.Online = false\n\t(*s.conn).Close()\n}", "func (c *Conn) Close() error {\n\t// Resets client\n\tc.client = nil\n\treturn nil\n}", "func (t *Client) Close() error { return nil }", "func (c *RuntimeSecurityClient) Close() {\n\tc.conn.Close()\n}", "func (b *BIRDClient) Close() error { return b.conn.Close() }", "func (c *Client) Close() error {\n\treturn c.connection.Close()\n}", "func (c *Connector) Close() {\n\tc.conn.Close()\n\tclose(c.die)\n}", "func (c *conn) Close() error {\n\tklog.V(4).Infoln(\"closing connection\")\n\tif c.closeTunnel != nil {\n\t\tdefer c.closeTunnel()\n\t}\n\n\tvar req *client.Packet\n\tif c.connID != 0 {\n\t\treq = &client.Packet{\n\t\t\tType: client.PacketType_CLOSE_REQ,\n\t\t\tPayload: &client.Packet_CloseRequest{\n\t\t\t\tCloseRequest: &client.CloseRequest{\n\t\t\t\t\tConnectID: c.connID,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t} else {\n\t\t// Never received a DIAL response so no connection ID.\n\t\treq = &client.Packet{\n\t\t\tType: client.PacketType_DIAL_CLS,\n\t\t\tPayload: &client.Packet_CloseDial{\n\t\t\t\tCloseDial: &client.CloseDial{\n\t\t\t\t\tRandom: c.random,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\n\tklog.V(5).InfoS(\"[tracing] send req\", \"type\", req.Type)\n\n\tif err := c.tunnel.Send(req); err != nil {\n\t\treturn err\n\t}\n\n\tselect {\n\tcase errMsg := <-c.closeCh:\n\t\tif errMsg != \"\" {\n\t\t\treturn errors.New(errMsg)\n\t\t}\n\t\treturn nil\n\tcase <-time.After(CloseTimeout):\n\t}\n\n\treturn errConnCloseTimeout\n}", "func (c *connection) Close() {\n\tbaseurl := \"http://fritz.box/webservices/homeautoswitch.lua\"\n\tparameters := make(map[string]string)\n\tparameters[\"sid\"] = c.sid\n\tparameters[\"logout\"] = \"logout\"\n\tUrl := prepareRequest(baseurl, parameters)\n\tsendRequest(Url)\n}", "func (s *Server) Close() (err error) {\n\treturn\n}", "func (self *Client) close() {\n\t// TODO: Cleanly close connection to remote\n}", "func (cl *Client) Close() (err error) {\n\tcl.url = nil\n\treturn cl.conn.Close()\n}", "func (client *Client) Close() {\n\tclient.conn.Close()\n\tclient.conn = nil\n}", "func (c *whoisClient) Close() error {\n\tc.Conn.SetWriteDeadline(time.Now().Add(time.Second))\n\n\tc.w.Write([]byte(\"end\"))\n\tc.w.Write(ncEOL)\n\t// This error is not important, because the previous are a courtesy.\n\tc.w.Flush()\n\treturn c.Conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (c *Client) Close() error {\n\treturn c.conn.Close()\n}", "func (s *Socket) Close() error {\n\treturn s.conn.Close()\n}", "func (a *ServerQueryAPI) Close() {\n\ta.Conn.Close()\n}", "func (c *Connection) Close() {\n\tc.conn.Close()\n}", "func (gc *GokuyamaClient) Close() error {\n\tvar err error\n\terr = gc.conn.Close()\n\treturn err\n}", "func (c *Connection) Close() error {\n\tc.identity = nil\n\tif c.clientConn != nil {\n\t\terr := c.clientConn.Close()\n\t\tc.clientConn = nil\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Server) Close() error {\n if s.ln != nil {\n s.ln.Close()\n }\n return nil\n}", "func (s *Server) Close() {\n\terr := s.zkConn.Delete(path.Join(s.zkPath, s.hostname), 0)\n\tif err != nil {\n\t\ts.logger.Error(err)\n\t}\n\ts.zkConn.Close()\n\ts.routerSocket.Close()\n\ts.dealerSocket.Close()\n\t//s.context.Term()\n\ts.wg.Wait()\n}", "func (c *Client) Close() {\n\tc.conn.Close()\n\tclose(c.In)\n\tclose(c.Out)\n}", "func (c *Conn) Close() error { return c.pc.Close() }", "func (r *ResourceConn) Close() {\n\tr.ClientConn.Close()\n}", "func (conn *Connection) Close() error {\n\tconn.connected = false\n\treturn nil\n}", "func (c *Client) Close() error {\n\treturn c.conn.close()\n}", "func (h *handler) Close() error {\n\th.logMessage(fmt.Sprintf(\"Closing connection to %v\", h.conn.RemoteAddr()))\n\treturn h.conn.Close()\n}", "func (s *Server) Close() error {\n\ts.instruments.Log(octo.LOGINFO, s.info.UUID, \"udp.Server.Close\", \"Started : %#v\", s.info)\n\n\tif !s.IsRunning() {\n\t\treturn nil\n\t}\n\n\ts.rl.Lock()\n\t{\n\t\ts.running = false\n\t\ts.doClose = true\n\t}\n\ts.rl.Unlock()\n\n\t// Await for last request.\n\ts.rg.Wait()\n\n\tif err := s.conn.Close(); err != nil {\n\t\ts.instruments.Log(octo.LOGERROR, s.info.UUID, \"udp.Server.Close\", \"Completed : %s\", err.Error())\n\t}\n\n\ts.wg.Wait()\n\n\ts.instruments.Log(octo.LOGINFO, s.info.UUID, \"udp.Server.Close\", \"Completed\")\n\treturn nil\n}", "func (c *Client) Close() { c.streamLayer.Close() }", "func (w *Client) Close() error {\n\treturn w.connection.Close()\n}", "func (rw *NopConn) Close() error { return nil }", "func (t *ssh2Server) Close() (err error) {\n\n\tlogrus.Debugln(\"Close\")\n\treturn nil\n\n\t// =================================== original code ======================================\n\t// t.mu.Lock()\n\t// if t.state == closing {\n\t// \tt.mu.Unlock()\n\t// \treturn errors.New(\"transport: Close() was already called\")\n\t// }\n\t// t.state = closing\n\t// streams := t.activeStreams\n\t// t.activeStreams = nil\n\t// t.mu.Unlock()\n\t// close(t.shutdownChan)\n\t// err = t.conn.Close()\n\t// // Notify all active streams.\n\t// for _, s := range streams {\n\t// \ts.write(recvMsg{err: ErrConnClosing})\n\t// }\n\t// return\n}", "func (server *rpcServer) Close() {\n\tif server == nil {\n\t\treturn\n\t}\n\n\tserver.done <- true\n\n\tif server.connection != nil {\n\t\te := server.connection.Close()\n\t\tif e != nil {\n\t\t\tfmt.Printf(\"Failed to close connection: %v\", e)\n\t\t}\n\t}\n\n\treturn\n}", "func (ts *Stream) Close() error {\n\tif ts.err != nil {\n\t\treturn ts.err\n\t}\n\treturn ts.conn.Close()\n}", "func (s *server) Close() {\n\ts.logger.Info(\"server Close()\")\n\n\tif s.dbConn != nil {\n\t\ts.dbConn.Close()\n\t}\n}", "func (s *session) Close() error {\n\treturn s.conn.Close()\n}", "func (r *Response) Close() error {\n\treturn r.conn.Close()\n}", "func (s *SubscribeServerStream) Close() error {\n\tvar err error\n\tif s.conn == nil {\n\t\treturn nil\n\t}\n\tif err = s.conn.WriteControl(\n\t\twebsocket.CloseMessage,\n\t\twebsocket.FormatCloseMessage(websocket.CloseNormalClosure, \"server closing connection\"),\n\t\ttime.Now().Add(time.Second),\n\t); err != nil {\n\t\treturn err\n\t}\n\treturn s.conn.Close()\n}", "func (s *SocksAdapter) Close() {\n\ts.conn.Close()\n}", "func (con *IRCConn) Close() {\n close(con.read);\n close(con.Write);\n con.sock.Close();\n}", "func (r *Connection) Close() {\n\t// no-op\n}", "func (i ios) Close(ctx context.Context) error {\n\ti.Connection.Close(ctx)\n\n\treturn nil\n}", "func (c *Client) Close() {\n\n\tc.status = Closing\n\n\tif c.conn != nil {\n\t\tc.conn.Close()\n\t}\n}", "func (c *Connection) Close() {\n\tif c.IsConnected == false {\n\t\treturn\n\t}\n\tc.IsConnected = false\n\tif r := recover(); r != nil {\n\t\tlog.Print(\"Closing due to problematic connection.\")\n\t} else {\n\t\tc.Send(CommandBasic{\n\t\t\tType: Cya,\n\t\t})\n\t}\n\tc.Conn.Close()\n\tvar blank struct{}\n\tc.ClosedChan <- blank\n}", "func (c *conn) Close() error {\n\tif atomic.CompareAndSwapInt32(&c.closed, 0, 1) {\n\t\tc.log(\"close connection\", c.url.Scheme, c.url.Host, c.url.Path)\n\t\tcancel := c.cancel\n\t\ttransport := c.transport\n\t\tc.transport = nil\n\t\tc.cancel = nil\n\n\t\tif cancel != nil {\n\t\t\tcancel()\n\t\t}\n\t\tif transport != nil {\n\t\t\ttransport.CloseIdleConnections()\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Client) Close() {\n\tif c.conn == nil {\n\t\treturn\n\t}\n\n\tc.conn.Close()\n}", "func (client *StatsdClient) Close() {\n\tclient.conn.Close()\n}", "func (conn *WSConnection) Close() error {\n\treturn conn.conn.Close()\n}", "func (c *Client) Close() {\n}", "func (c *Client) Close() {\n}", "func (client *Client) Close() error {\n\treturn client.conn.Close()\n}", "func (s *Server) Close() error {\n\t// TODO(sajjadm): Determine if some pending connections were forcefully closed by s.cancel()\n\t// and report that as an error.\n\ts.cancel()\n\treturn s.ln.Close()\n}", "func (c *Client) Close() {\n\tif c.conn != nil {\n\t\tc.conn.Close()\n\t}\n}", "func (c *conn) Close() error {\n\treturn c.s.Close()\n}", "func (w *reply) Close() (err error) {\n\treturn w.conn.Close()\n}", "func (n *Connection) Close() (err error) {\n\tdefer func() {\n\t\t_ = logger.ZSLogger.Sync()\n\t}()\n\n\terr = n.stan.Close()\n\tif err != nil {\n\t\tlogger.ZSLogger.Errorf(\"can not close NATS Streaming connection: %v\", err)\n\t}\n\tn.nats.Close()\n\n\treturn err\n}", "func (rrs *remoteReadServer) Close() {\n\trrs.server.Close()\n}", "func (c *Connection) Close() error {\n\terr := c.Connection.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}" ]
[ "0.7401296", "0.7280614", "0.7266565", "0.72523844", "0.72429657", "0.7223785", "0.7193747", "0.7156631", "0.71448433", "0.71035224", "0.7053198", "0.70466304", "0.70466304", "0.7041368", "0.7033896", "0.70191634", "0.70035464", "0.6993156", "0.6981221", "0.69740236", "0.69628495", "0.6944459", "0.6931229", "0.6931229", "0.6931229", "0.6931229", "0.6931229", "0.6931229", "0.6915301", "0.6914357", "0.6904951", "0.6880663", "0.68752337", "0.6870079", "0.68612146", "0.68560565", "0.6849695", "0.6826947", "0.681916", "0.68157667", "0.68150604", "0.6805981", "0.6800778", "0.6798683", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67867297", "0.67805463", "0.67777675", "0.67749375", "0.67749166", "0.67690545", "0.6764399", "0.6763666", "0.67602056", "0.6754161", "0.6734646", "0.67304546", "0.67291164", "0.6724402", "0.6722858", "0.6719712", "0.6718975", "0.67159426", "0.6714333", "0.6702504", "0.6695665", "0.6692394", "0.6684152", "0.6682412", "0.667603", "0.66712695", "0.66710925", "0.6668192", "0.6666806", "0.6665568", "0.6663778", "0.66578925", "0.66566867", "0.66542155", "0.6649209", "0.66491634", "0.66491634", "0.66444975", "0.66432697", "0.6640069", "0.6635626", "0.6629566", "0.6626262", "0.66251874", "0.6624157" ]
0.0
-1
NewServer creates and starts a new server that listens for spans and annotations on l and adds them to the collector c. Call the CollectorServer's Start method to start listening and serving.
func NewServer(l net.Listener, c Collector) *CollectorServer { cs := &CollectorServer{c: c, l: l} return cs }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewServer(cfg config.Config, ll *log.Logger) *Server {\n\tif ll == nil {\n\t\tll = log.New(ioutil.Discard, \"\", 0)\n\t}\n\n\t// Set up Prometheus instrumentation using the typical Go collectors.\n\treg := prometheus.NewPedanticRegistry()\n\treg.MustRegister(\n\t\tprometheus.NewGoCollector(),\n\t\tprometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}),\n\t\tnewInterfaceCollector(cfg.Interfaces),\n\t)\n\n\treturn &Server{\n\t\tcfg: cfg,\n\n\t\tll: ll,\n\t\treg: reg,\n\n\t\tready: make(chan struct{}),\n\t}\n}", "func NewServer(l Listener) *server {\n\treturn &server{\n\t\tlistener: l,\n\t}\n}", "func newServer(sc *ServerConfig, b backends.Backend, l log.Logger) (*server, error) {\n\tserver := &server{\n\t\tclientPool: NewPool(sc.MaxClients),\n\t\tclosedListener: make(chan bool, 1),\n\t\tlistenInterface: sc.ListenInterface,\n\t\tstate: ServerStateNew,\n\t\tenvelopePool: mail.NewPool(sc.MaxClients),\n\t}\n\tserver.logStore.Store(l)\n\tserver.backendStore.Store(b)\n\tlogFile := sc.LogFile\n\tif logFile == \"\" {\n\t\t// none set, use the same log file as mainlog\n\t\tlogFile = server.mainlog().GetLogDest()\n\t}\n\t// set level to same level as mainlog level\n\tmainlog, logOpenError := log.GetLogger(logFile, server.mainlog().GetLevel())\n\tserver.mainlogStore.Store(mainlog)\n\tif logOpenError != nil {\n\t\tserver.log().WithError(logOpenError).Errorf(\"Failed creating a logger for server [%s]\", sc.ListenInterface)\n\t}\n\n\tserver.setConfig(sc)\n\tserver.setTimeout(sc.Timeout)\n\tif err := server.configureSSL(); err != nil {\n\t\treturn server, err\n\t}\n\treturn server, nil\n}", "func NewServer() *Server {}", "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 NewCollectServer(cfg *ServerConfig) *CollectServer {\n\tserver := &CollectServer{Config: cfg}\n\tlogger := logrus.New()\n\tlogger.Out = cfg.LogCfg.Output\n\tlogger.Level = cfg.LogCfg.Level\n\tlogger.Formatter = cfg.LogCfg.Format\n\tserver.Logger = logger\n\treturn server\n}", "func newServer() *traceServer {\n\treturn &traceServer{\n\t\tevents: make(map[string]*trace.Trace),\n\t}\n}", "func NewServer(h *Handlers, limits *Limits, l net.Listener) *Server {\n\treturn &Server{Handlers: h, Limits: limits, Listener: l}\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(authFunc, cmdFunc func(io.ReadWriter, []byte) error) (*Server, error) {\n\tvar err error\n\ts := new(Server)\n\ts.ln, err = nettest.NewLocalListener(\"tcp\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo s.serve(authFunc, cmdFunc)\n\treturn s, nil\n}", "func NewServer(entries ...EntryPoint) *Server {\n\treturn &Server{\n\t\tentrypoints: entries,\n\t\tstopChan: make(chan bool, 1),\n\t}\n}", "func NewServer(config domain.ServerConfig) *Server {\n\tdebugger := logger.New(log.New(ioutil.Discard, \"\", 0))\n\tif config.Debug {\n\t\tdebugger = logger.New(log.New(os.Stderr, \"[debug] \", log.Flags()|log.Lshortfile))\n\t}\n\n\tdb, err := bolt.Open(config.BoltPath, 0644, nil)\n\tif err != nil {\n\t\tlog.Fatal(\"failed to start bolt db\")\n\t}\n\tdefer db.Close()\n\n\ts := &Server{\n\t\tConfig: config,\n\t\ti: uc.NewInteractor(\n\t\t\tconfig,\n\t\t\tcookies.New(config.CookieAge),\n\t\t\tdebugger,\n\t\t\tresources.New(encoder.New()),\n\t\t\thttpCaller.New(),\n\t\t\tmail.New(domain.EmailConfig{}),\n\t\t\tpathInfo.New(config),\n\t\t\tencoder.New(),\n\t\t\tsparql.New(),\n\t\t\tpages.New(config.DataRoot),\n\t\t\ttokenStorer.New(db),\n\t\t\tdomain.URIHandler{},\n\t\t\tuuid.New(),\n\t\t\tauthentication.New(httpCaller.New()),\n\t\t\tspkac.New(),\n\t\t),\n\t\tlogger: debugger,\n\t\tcookieManager: cookies.New(config.CookieAge),\n\t\tpathInformer: pathInfo.New(config),\n\t\turiManipulator: domain.URIHandler{},\n\t}\n\n\tmime.AddRDFExtension(s.Config.ACLSuffix)\n\tmime.AddRDFExtension(s.Config.MetaSuffix)\n\n\ts.logger.Debug(\"---- starting server ----\")\n\ts.logger.Debug(\"config: %#v\\n\", s.Config)\n\treturn s\n}", "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 New(addr string, host app.HostService, collector *metrics.Collector) app.Server {\n\treturn &server{\n\t\tsrv: telnet.Server{Addr: addr, Handler: nil},\n\t\thost: host,\n\t\tcollector: collector,\n\t}\n}", "func NewServer(listen string, port int, metrics bool) (*Server, error) {\n\n\tr := gin.Default()\n\tif metrics {\n\t\tp := ginprom.New(\n\t\t\tginprom.Engine(r),\n\t\t\tginprom.Subsystem(\"gin\"),\n\t\t\tginprom.Path(\"/metrics\"),\n\t\t)\n\t\tr.Use(p.Instrument())\n\t}\n\n\ts := &Server{\n\t\trouter: r,\n\t\tport: port,\n\t\tlisten: listen,\n\t}\n\ts.routes()\n\treturn s, nil\n}", "func NewServer(c Configuration, b *builder.Builder, stg astichat.Storage) *Server {\n\tastilog.Debug(\"Starting server\")\n\treturn &Server{\n\t\tchannelQuit: make(chan bool),\n\t\tserverHTTP: NewServerHTTP(c.Addr.HTTP, c.PathStatic, b, stg),\n\t\tserverUDP: NewServerUDP(stg),\n\t\tstartedAt: time.Now(),\n\t}\n}", "func NewServer(\n\tconf *config.ChaosDashboardConfig,\n\texperimentArchive core.ExperimentStore,\n\tscheduleArchive core.ScheduleStore,\n\tevent core.EventStore,\n\tworkflowStore core.WorkflowStore,\n\tlogger logr.Logger,\n) (*Server, client.Client, client.Reader, *runtime.Scheme) {\n\ts := &Server{logger: logger}\n\n\t// namespace scoped\n\toptions := ctrl.Options{\n\t\tScheme: scheme,\n\t\tMetricsBindAddress: net.JoinHostPort(conf.MetricHost, strconv.Itoa(conf.MetricPort)),\n\t\tLeaderElection: conf.EnableLeaderElection,\n\t\tPort: 9443,\n\t}\n\tif conf.ClusterScoped {\n\t\tlogger.Info(\"Chaos controller manager is running in cluster scoped mode.\")\n\t} else {\n\t\tlogger.Info(\"Chaos controller manager is running in namespace scoped mode.\", \"targetNamespace\", conf.TargetNamespace)\n\t\toptions.Namespace = conf.TargetNamespace\n\t}\n\n\tvar err error\n\n\tcfg := ctrl.GetConfigOrDie()\n\n\tif conf.QPS > 0 {\n\t\tcfg.QPS = conf.QPS\n\t\tcfg.Burst = conf.Burst\n\t}\n\n\ts.Manager, err = ctrl.NewManager(cfg, options)\n\tif err != nil {\n\t\tlogger.Error(err, \"unable to start collector\")\n\t\tos.Exit(1)\n\t}\n\n\tif conf.SecurityMode {\n\t\tclientpool.K8sClients, err = clientpool.NewClientPool(cfg, scheme, 100)\n\t\tif err != nil {\n\t\t\t// this should never happen\n\t\t\tlogger.Error(err, \"fail to create client pool\")\n\t\t\tos.Exit(1)\n\t\t}\n\t} else {\n\t\tclientpool.K8sClients, err = clientpool.NewLocalClient(cfg, scheme)\n\t\tif err != nil {\n\t\t\tlogger.Error(err, \"fail to create client pool\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n\tfor kind, chaosKind := range v1alpha1.AllKinds() {\n\t\tif err = (&ChaosCollector{\n\t\t\tClient: s.Manager.GetClient(),\n\t\t\tLog: logger.WithName(kind),\n\t\t\tarchive: experimentArchive,\n\t\t\tevent: event,\n\t\t}).Setup(s.Manager, chaosKind.SpawnObject()); err != nil {\n\t\t\tlogger.Error(err, \"unable to create collector\", \"collector\", kind)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n\tif err = (&ScheduleCollector{\n\t\tClient: s.Manager.GetClient(),\n\t\tLog: logger.WithName(\"schedule-collector\").WithName(v1alpha1.KindSchedule),\n\t\tarchive: scheduleArchive,\n\t}).Setup(s.Manager, &v1alpha1.Schedule{}); err != nil {\n\t\tlogger.Error(err, \"unable to create collector\", \"collector\", v1alpha1.KindSchedule)\n\t\tos.Exit(1)\n\t}\n\n\tif err = (&EventCollector{\n\t\tClient: s.Manager.GetClient(),\n\t\tLog: logger.WithName(\"event-collector\").WithName(\"Event\"),\n\t\tevent: event,\n\t}).Setup(s.Manager, &v1.Event{}); err != nil {\n\t\tlogger.Error(err, \"unable to create collector\", \"collector\", v1alpha1.KindSchedule)\n\t\tos.Exit(1)\n\t}\n\n\tif err = (&WorkflowCollector{\n\t\tkubeClient: s.Manager.GetClient(),\n\t\tLog: logger.WithName(\"workflow-collector\").WithName(v1alpha1.KindWorkflow),\n\t\tstore: workflowStore,\n\t}).Setup(s.Manager, &v1alpha1.Workflow{}); err != nil {\n\t\tlogger.Error(err, \"unable to create collector\", \"collector\", v1alpha1.KindWorkflow)\n\t\tos.Exit(1)\n\t}\n\n\treturn s, s.Manager.GetClient(), s.Manager.GetAPIReader(), s.Manager.GetScheme()\n}", "func NewServer(ctx context.Context, config cache.Cache, callbacks xdsv3.Callbacks) Server {\n\t// Delta server is not used. Hence the envoy default implementation is used.\n\treturn NewServerAdvanced(rest.NewServer(config, callbacks), sotw.NewServer(ctx, config, callbacks), envoy_delta.NewServer(ctx, config, callbacks))\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 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() *server {\n\ts := &server{\n\t\tstore: make(map[string]*string),\n\t\tops: make(chan func()),\n\t}\n\tgo s.loop()\n\treturn s\n}", "func newServer(handler connHandler, logger *zap.Logger) *server {\n\ts := &server{\n\t\thandler: handler,\n\t\tlogger: logger.With(zap.String(\"sector\", \"server\")),\n\t}\n\treturn s\n}", "func newServer(deps dependencies) Component {\n\treturn newServerCompat(deps.Config, deps.Log, deps.Replay, deps.Debug, deps.Params.Serverless)\n}", "func NewServer(stop chan bool) *Server {\n\tmux := http.NewServeMux()\n\ttotalTimeChan := make(chan time.Duration, 100)\n\tstatsRequestChan := make(chan int, 100)\n\tincomingStatsChan := make(chan Stats, 100)\n\tmgr := managerChannels{\n\t\ttotalTimeChan: totalTimeChan,\n\t\tstatsRequestChan: statsRequestChan,\n\t\tincomingStatsChan: incomingStatsChan,\n\t\tstop: stop,\n\t}\n\ts := &Server{\n\t\ttotaltime: totalTimeChan,\n\t\tstatsrequest: statsRequestChan,\n\t\tincomingstats: incomingStatsChan,\n\t\tstop: stop,\n\t\tmux: mux,\n\t}\n\n\tgo computeStats(mgr)\n\ts.mux.HandleFunc(\"/hash\", s.computePasswordHash)\n\ts.mux.HandleFunc(\"/shutdown\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method == \"GET\" {\n\t\t\tw.WriteHeader(http.StatusOK)\n\t\t\tstop <- true\n\t\t} else {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t}\n\t})\n\ts.mux.HandleFunc(\"/stats\", s.getStats)\n\treturn s\n}", "func newServer(ctx common.Context, self *replica, listener net.Listener, workers int) (net.Server, error) {\n\tserver := &rpcServer{ctx: ctx, logger: ctx.Logger(), self: self}\n\treturn net.NewServer(ctx, listener, serverInitHandler(server), workers)\n}", "func NewServer(config *ClusterConfig, store mcmodel.MCConfigStore) (*Server, error) {\n\trouter := mux.NewRouter()\n\ts := &Server{\n\t\thttpServer: http.Server{\n\t\t\tReadTimeout: 10 * time.Second,\n\t\t\tWriteTimeout: 10 * time.Second,\n\t\t\tAddr: fmt.Sprintf(\":%d\", config.AgentPort),\n\t\t\tHandler: router,\n\t\t},\n\t\tstore: store,\n\t\tconfig: config,\n\t}\n\t_ = router.NewRoute().PathPrefix(\"/exposed/{clusterID}\").Methods(\"GET\").HandlerFunc(s.handlePoliciesReq)\n\n\treturn s, nil\n}", "func NewServer(id uuid.UUID, csrv *conf.Service, c *conf.Server, logger log.Logger, r *etcd.Registry) (*Server, error) {\n\tlogicClient, err := logic.NewClient(context.Background(), grpc.WithDiscovery(r))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts := &Server{\n\t\tc: c,\n\t\tuuid: id.String(),\n\t\tround: NewRound(c),\n\t\trpcClient: logicClient,\n\t}\n\t// init bucket\n\ts.buckets = make([]*Bucket, c.Bucket.Size)\n\ts.bucketIdx = uint32(c.Bucket.Size)\n\tfor i := int32(0); i < c.Bucket.Size; i++ {\n\t\ts.buckets[i] = NewBucket(c.Bucket)\n\t}\n\ts.serverID = ip.InternalIP()\n\tgo s.onlineproc()\n\n\tif err := InitWhitelist(c.Whitelist, logger); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := InitTCP(logger, s, c.Tcp.Bind, runtime.NumCPU()); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := InitWebsocket(logger, s, c.Websocket.Bind, runtime.NumCPU()); err != nil {\n\t\tpanic(err)\n\t}\n\t// if conf.Conf.Websocket.TLSOpen {\n\t// \tif err := comet.InitWebsocketWithTLS(srv, conf.Conf.Websocket.TLSBind, conf.Conf.Websocket.CertFile, conf.Conf.Websocket.PrivateFile, runtime.NumCPU()); err != nil {\n\t// \t\tpanic(err)\n\t// \t}\n\t// }\n\n\treturn s, nil\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(endpoint string) (*Server, error) {\n\n\tret := &Server{}\n\tvar err error\n\tret.Listener, err = net.Listen(\"tcp\", endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tret.mux = http.NewServeMux()\n\tret.mux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"This is the monitoring endpoint\"))\n\t})\n\tret.mux.Handle(\"/mon/varz\", expvar.Handler())\n\n\tret.mux.HandleFunc(\"/mon/pprof/\", pprof.Index)\n\tret.mux.HandleFunc(\"/mon/pprof/cmdline\", pprof.Cmdline)\n\tret.mux.HandleFunc(\"/mon/pprof/profile\", pprof.Profile)\n\tret.mux.HandleFunc(\"/mon/pprof/symbol\", pprof.Symbol)\n\tEnableTracing()\n\tret.mux.HandleFunc(\"/mon/trace\", TraceHandler())\n\tret.srv = &http.Server{}\n\treturn ret, 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 NewServer(run func(string, string, *pb.Session) *pipe.Reader,\n\tmodelDir string) *Server {\n\treturn &Server{run: run, modelDir: modelDir}\n}", "func NewServer(conf *config.Config, projectClient project.Client, entriesClient timetracking.Client) *Server {\n\te := echo.New()\n\n\t//recover from panics\n\te.Use(middleware.Recover())\n\t//add a unique id to each request\n\te.Use(middleware.RequestID())\n\t//add request id to the context\n\te.Use(AddRequestIDToContext())\n\t//add a logger to the context\n\te.Use(AddLoggerToContext())\n\t//use custom logger for all requests\n\te.Use(Logger())\n\t//trace rest calls\n\te.Use(Tracing())\n\n\te.Use(Instrumenting())\n\n\te.HideBanner = true\n\te.HidePort = true\n\n\ts := &Server{\n\t\tconf: conf,\n\t\te: e,\n\t\thttpServer: &http.Server{\n\t\t\tAddr: fmt.Sprintf(\":%d\", conf.HTTPPort),\n\t\t\tReadTimeout: 60 * time.Second, // time to read request\n\t\t\tReadHeaderTimeout: 10 * time.Second, // time to read header, low value to cope with malicious behavior\n\t\t\tWriteTimeout: 20 * time.Second, // time write response\n\t\t\tIdleTimeout: 120 * time.Second, // time between keep-alives requests before connection is closed\n\t\t},\n\t}\n\n\th := &handler{\n\t\tentries: entriesClient,\n\t\tprojects: projectClient,\n\t}\n\n\ts.AddRoutes(h)\n\n\t//serve SPA\n\te.Static(\"/\", \"web\")\n\n\treturn s\n}", "func New(fetcherSvc *services.Fetcher, log *logrus.Entry) *Server {\n\treturn &Server{\n\t\tFetcherSvc: fetcherSvc,\n\t\tLog: log,\n\t}\n}", "func NewServer(name string, logger termlog.Logger) *Server {\n\tbroadcast := make(chan string, 50)\n\ts := &Server{\n\t\tname: name,\n\t\tbroadcast: broadcast,\n\t\tconnections: make(map[*websocket.Conn]bool),\n\t\tlogger: logger,\n\t}\n\tgo s.run(broadcast)\n\treturn s\n}", "func New(srv *cmutation.Server) *Server {\n\treturn &Server{srv}\n}", "func NewServer(versionPrefix string, drainCh chan struct{}) *Server {\n\treturn &Server{\n\t\tClusters: xds.NewManager(\"clusters\", versionPrefix, &envoy_config_cluster_v3.Cluster{}, drainCh),\n\t\tEndpoints: xds.NewManager(\"endpoints\", versionPrefix, &envoy_config_endpoint_v3.ClusterLoadAssignment{}, drainCh),\n\t}\n}", "func NewServer(run func(string, *sf.DB) *sf.PipeReader, db *sf.DB) *server {\n\treturn &server{run: run, db: db}\n}", "func NewServer(config Config) (*Server, error) {\n\tserver := &Server{\n\t\tstartTime: time.Now(),\n\t\tConfig: config,\n\t\ttcpServers: []*healthApi.Server{},\n\t\tconnectivity: &healthReport{},\n\t}\n\n\tswaggerSpec, err := loads.Analyzed(healthApi.SwaggerJSON, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !config.Passive {\n\t\tcl, err := ciliumPkg.NewClient(config.CiliumURI)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tserver.Client = cl\n\t\tserver.Server = *server.newServer(swaggerSpec, 0)\n\t}\n\tfor port := range PortToPaths {\n\t\tsrv := server.newServer(swaggerSpec, port)\n\t\tserver.tcpServers = append(server.tcpServers, srv)\n\t}\n\n\treturn server, nil\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(l net.Listener, reg registry.Cache, ctl *config.Controller, opts ...ServerOption) *Server {\n\to := defaultServerOptions()\n\tfor _, opt := range opts {\n\t\topt(o)\n\t}\n\n\teds := newEndpointDiscoveryServer(reg)\n\tcds := newConfigDiscoveryServer(ctl)\n\tdds := newDependencyDiscoveryServer(ctl)\n\ts := &Server{\n\t\tl: l,\n\t\toptions: o,\n\t\teds: eds,\n\t\tcds: cds,\n\t\tdds: dds,\n\t}\n\n\tg := grpc.NewServer(s.grpcOptions()...)\n\tapi.RegisterDiscoveryServiceServer(g, s)\n\ts.g = g\n\treturn s\n}", "func NewServer(logger logr.Logger, config *Config) (*Server, error) {\n\tmux := http.NewServeMux()\n\t// Create the tls config\n\ttlsConfig, err := CreateTLSConfig(config.TLSConfig)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not create tls configuration\")\n\t}\n\n\t// Create the http server\n\tdecorated := &http.Server{\n\t\tAddr: config.Addr,\n\t\tHandler: mux,\n\t\tTLSConfig: tlsConfig,\n\t\tReadTimeout: config.ReadTimeout,\n\t\tReadHeaderTimeout: config.ReadHeaderTimeout,\n\t\tWriteTimeout: config.WriteTimeout,\n\t\tIdleTimeout: config.IdleTimeout,\n\t\tMaxHeaderBytes: config.MaxHeaderBytes,\n\t}\n\n\t// Add prometheus Metrics and healthz\n\tpromRegistry := prometheus.NewRegistry()\n\tmux.Handle(\"/metrics\", promhttp.HandlerFor(promRegistry, promhttp.HandlerOpts{Registry: promRegistry}))\n\tmux.Handle(\"/healthz\", &healthzHandler{logger})\n\n\tvar listenFn func() error\n\tif config.TLSConfig.PrivateKeyFile != \"\" || config.TLSConfig.PublicKeyFile != \"\" {\n\t\tlistenFn = func() error {\n\t\t\treturn decorated.ListenAndServeTLS(config.TLSConfig.PublicKeyFile, config.TLSConfig.PrivateKeyFile)\n\t\t}\n\t} else {\n\t\tlistenFn = func() error {\n\t\t\treturn decorated.ListenAndServe()\n\t\t}\n\t}\n\n\treturn &Server{\n\t\tServer: decorated,\n\t\tServeMux: mux,\n\t\tlogger: logger,\n\t\tMetrics: &metricsRegistryImpl{\n\t\t\tMetricsRegistry: metering.NewRegistry(promRegistry), namespace: config.ServerNamespace,\n\t\t},\n\t\tlistenFn: listenFn,\n\t}, nil\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 NewServer(port int, params *Params) (Server, error) {\n\tstr := lspnet.JoinHostPort(\"localhost\", strconv.Itoa(port))\n\tln, err := lspnet.ResolveUDPAddr(\"udp\", str)\n\tif err != nil {\n\t\tfmt.Println(\"resolving error\")\n\t\treturn nil, err\n\t}\n\tconn, err := lspnet.ListenUDP(\"udp\", ln)\n\tif err != nil {\n\t\tfmt.Println(\"listening error\")\n\t\treturn nil, err\n\t}\n\tepoch_interval = params.EpochMillis\n\tepoch_limit = params.EpochLimit\n\twindow_size = params.WindowSize\n\tmaxBackOffInterval = params.MaxBackOffInterval\n\tserver := &server{\n\t\t// server listening port\n\t\tln: conn,\n\t\t// all clients\n\t\tclients: make(map[int]*client_data),\n\t\taddr: make(chan *lspnet.UDPAddr),\n\t\tmes: make(chan Message, 1),\n\t\t// current connection id\n\t\tcur_conn_id: 1,\n\t\tclose_client: make(chan int),\n\t\t// send to Write\n\t\tsend: make(chan Message),\n\t\t// send to Read\n\t\tread: make(chan Message, 2500),\n\t\tsend_error: make(chan bool),\n\t\tclosing: false,\n\t\tclosed: make(chan int),\n\t\tone_client_closed: make(chan int, 100),\n\t\tclose_accept: make(chan int, 100),\n\t\tclose_conn_success: make(chan bool),\n\t\tis_client_alive: make(chan int),\n\t\tclient_dead: make(chan int, 100),\n\t\tclose_all: make(chan int,),\n\t}\n\tgo accept(server)\n\tgo serve(server)\n\treturn server, nil\n}", "func NewServer(config *config.Config, metrics *metrics.Metrics) (server Server) {\n\tif config == nil {\n\t\tlog.Fatalf(\"error: config cannot be nil value.\")\n\t}\n\n\tserver.Log = config.Log\n\tserver.ListenPort = config.Server.ListenPort\n\tserver.CacheFolder = config.Server.CacheFolder\n\tserver.MetricsListenPort = config.Server.MetricsListenPort\n\n\tif config.Server.CacheResponse {\n\t\tserver.EnableCache(config.Server.CacheFolder, config.Server.CacheKey)\n\t}\n\n\tserver.Context = config.Context\n\tserver.Router = chi.NewRouter()\n\tserver.HTTP = &http.Server{Addr: \":\" + server.ListenPort, Handler: server.Router}\n\n\t// server.HTTP = &http.Server{\n\t// \tAddr: \":\" + server.ListenPort,\n\t// \tRouter: server.Router,\n\t// \t// Ian Kent recommends these timeouts be set:\n\t// \t// https://www.youtube.com/watch?v=YF1qSfkDGAQ&t=333s\n\t// \tIdleTimeout: time.Duration(time.Second), // This one second timeout may be too aggressive..*shrugs* :)\n\t// \tReadTimeout: time.Duration(time.Second),\n\t// \tWriteTimeout: time.Duration(time.Second),\n\t// }\n\n\tserver.DB = db.NewSimpleDB()\n\tserver.Metrics = metrics\n\treturn\n}", "func NewServer(dir string) *Server {\n\tserver := &Server{\n\t\tRouter: devutil.NewMux(),\n\t\tstatements: t.NewStatementList(),\n\t}\n\tserver.initRoutes()\n\tif dir != \"\" {\n\t\tserver.initWasm(dir)\n\t}\n\tserver.statements.AddExampleData()\n\n\treturn server\n}", "func newServer() *geoServer {\n\ts := new(geoServer)\n\ts.loadLocations(data.MustAsset(\"data/locations.json\"))\n\treturn s\n}", "func NewServer(ln net.Listener, id metainfo.Hash, h Handler, c ...Config) *Server {\n\tif id.IsZero() {\n\t\tpanic(\"the peer node id must not be empty\")\n\t}\n\n\tvar conf Config\n\tconf.set(c...)\n\treturn &Server{Listener: ln, ID: id, Handler: h, Config: conf}\n}", "func New(cfg *config.Config) (*Server, error) {\n\tstorageMgr, err := storage.NewManager(cfg)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to create storage manager\")\n\t}\n\n\tsourceClient, err := source.NewSourceClient()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to create source client\")\n\t}\n\t// progress manager\n\tprogressMgr, err := progress.NewManager(cfg)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to create progress manager\")\n\t}\n\n\t// cdn manager\n\tcdnMgr, err := cdn.NewManager(cfg, storageMgr, progressMgr, sourceClient)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to create cdn manager\")\n\t}\n\n\t// task manager\n\ttaskMgr, err := task.NewManager(cfg, cdnMgr, progressMgr, sourceClient)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to create task manager\")\n\t}\n\tstorageMgr.SetTaskMgr(taskMgr)\n\tstorageMgr.InitializeCleaners()\n\tprogressMgr.SetTaskMgr(taskMgr)\n\t// gc manager\n\tgcMgr, err := gc.NewManager(cfg, taskMgr, cdnMgr)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to create gc manager\")\n\t}\n\n\treturn &Server{\n\t\tConfig: cfg,\n\t\tTaskMgr: taskMgr,\n\t\tGCMgr: gcMgr,\n\t}, nil\n}", "func New(initCtx context.Context, c *configpb.ServerConf, l *logger.Logger) (*Server, error) {\n\tconn, err := Listen(&net.UDPAddr{Port: int(c.GetPort())}, l)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo func() {\n\t\t<-initCtx.Done()\n\t\tconn.Close()\n\t}()\n\n\ts := &Server{\n\t\tc: c,\n\t\tconn: conn,\n\t\tl: l,\n\t}\n\n\treturn s, s.initConnection()\n}", "func NewServer(opts ...Option) AtlasServer {\n\tatlas := &server{\n\t\tcurr: newRunningTraces(),\n\t}\n\tfor _, opt := range opts {\n\t\topt(&atlas.opts)\n\t}\n\tatlas.tc = newTokenCache(atlas.opts.ca)\n\tatlas.limit = rate.NewLimiter(rate.Every(time.Millisecond*12), 5000)\n\treturn atlas\n}", "func New(logger log.Logger, ints, chars metrics.Counter) AddServer {\n\tvar svc Service\n\t{\n\t\tsvc = NewBasicService()\n\t\tsvc = LoggingMiddleware(logger)(svc)\n\t\tsvc = InstrumentingMiddleware(ints, chars)(svc)\n\t}\n\treturn svc\n}", "func StartServer(lis net.Listener) (*Server, func(), error) {\n\tif lis == nil {\n\t\tvar err error\n\t\tlis, err = net.Listen(\"tcp\", \"localhost:0\")\n\t\tif err != nil {\n\t\t\treturn nil, func() {}, fmt.Errorf(\"net.Listen() failed: %v\", err)\n\t\t}\n\t}\n\n\ts := NewServer(lis.Addr().String())\n\twp := &wrappedListener{\n\t\tListener: lis,\n\t\tserver: s,\n\t}\n\n\tserver := grpc.NewServer()\n\tv3lrsgrpc.RegisterLoadReportingServiceServer(server, s)\n\tv3discoverygrpc.RegisterAggregatedDiscoveryServiceServer(server, s)\n\tgo server.Serve(wp)\n\n\treturn s, func() { server.Stop() }, nil\n}", "func NewServer(host string, port int) *Server {\n\n\tlpSrv := longpoll.NewLongPoll()\n\tsrv := &Server{\n\t\tlpSrv: lpSrv,\n\t}\n\tmux := gin.New()\n\tmux.GET(\"/sub\", srv.longpollHandler)\n\tmux.POST(\"/pub\", srv.publish)\n\tsrv.httpSrv = &http.Server{\n\t\tAddr: fmt.Sprintf(\"%s:%d\", host, port),\n\t\tHandler: mux,\n\t}\n\treturn srv\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 NewServer(configFile string) (*Server, error) {\n\tmanager := schema.GetManager()\n\tconfig := util.GetConfig()\n\terr := config.ReadConfig(configFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Config load error: %s\", err)\n\t}\n\terr = os.Chdir(path.Dir(configFile))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Chdir error: %s\", err)\n\t}\n\terr = l.SetUpLogging(config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Logging setup error: %s\", err)\n\t}\n\tlog.Info(\"logging initialized\")\n\n\tserver := &Server{}\n\n\tm := martini.Classic()\n\tm.Handlers()\n\tm.Use(middleware.WithContext())\n\tm.Use(middleware.Tracing())\n\tm.Use(middleware.Logging())\n\tm.Use(middleware.Metrics())\n\tm.Use(martini.Recovery())\n\tm.Use(middleware.JSONURLs())\n\n\tserver.martini = m\n\n\tport := os.Getenv(\"PORT\")\n\n\tif port == \"\" {\n\t\tport = \"9091\"\n\t}\n\n\tserver.extensions = config.GetStringList(\"extension/use\", []string{\n\t\t\"goext\",\n\t\t\"javascript\",\n\t})\n\tschema.DefaultExtension = config.GetString(\"extension/default\", \"javascript\")\n\n\tmanager.TimeLimit = time.Duration(config.GetInt(\"extension/timelimit\", 30)) * time.Second\n\n\tif config.GetList(\"extension/timelimits\", nil) != nil {\n\t\ttimeLimitList := config.GetList(\"extension/timelimits\", nil)\n\t\tfor _, timeLimit := range timeLimitList {\n\t\t\tcfgRaw := timeLimit.(map[string]interface{})\n\t\t\tcfgPath := cfgRaw[\"path\"].(string)\n\t\t\tcfgEvent := cfgRaw[\"event\"].(string)\n\t\t\tcfgTimeDuration := cfgRaw[\"timelimit\"].(int)\n\n\t\t\tmanager.TimeLimits = append(manager.TimeLimits, &schema.PathEventTimeLimit{\n\t\t\t\tPathRegex: regexp.MustCompile(cfgPath),\n\t\t\t\tEventRegex: regexp.MustCompile(cfgEvent),\n\t\t\t\tTimeDuration: time.Second * time.Duration(cfgTimeDuration),\n\t\t\t})\n\t\t}\n\t}\n\n\tserver.address = config.GetString(\"address\", \":\"+port)\n\tif config.GetBool(\"tls/enabled\", false) {\n\t\tlog.Info(\"TLS enabled\")\n\t\tserver.tls = &tlsConfig{\n\t\t\tKeyFile: config.GetString(\"tls/key_file\", \"./etc/key.pem\"),\n\t\t\tCertFile: config.GetString(\"tls/cert_file\", \"./etc/cert.pem\"),\n\t\t}\n\t}\n\n\tserver.sync, err = sync_util.CreateFromConfig(config)\n\tif err != nil {\n\t\tlog.Error(\"Failed to create sync, err: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tif dbErr := server.connectDB(); dbErr != nil {\n\t\tlog.Fatalf(\"Error while connecting to DB: %s\", dbErr)\n\t}\n\n\tschemaFiles := config.GetStringList(\"schemas\", nil)\n\tif schemaFiles == nil {\n\t\tlog.Fatal(\"No schema specified in configuration\")\n\t} else {\n\t\terr = manager.LoadSchemasFromFiles(schemaFiles...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid schema: %s\", err)\n\t\t}\n\t}\n\n\tif !config.GetBool(\"database/no_init\", false) {\n\t\tserver.initDB()\n\t}\n\n\tif err = metrics.SetupMetrics(config, server.address); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif config.GetList(\"database/initial_data\", nil) != nil {\n\t\tinitialDataList := config.GetList(\"database/initial_data\", nil)\n\t\tfor _, initialData := range initialDataList {\n\t\t\tinitialDataConfig := initialData.(map[string]interface{})\n\t\t\tfilePath := initialDataConfig[\"connection\"].(string)\n\t\t\tlog.Info(\"Importing data from %s ...\", filePath)\n\t\t\tsource, err := initializer.NewInitializer(filePath)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\tdbutil.CopyDBResources(source, server.db, false)\n\t\t}\n\t}\n\n\tm.Map(middleware.NewNobodyResourceService(manager.NobodyResourcePaths()))\n\n\tif config.GetBool(\"keystone/use_keystone\", false) {\n\t\tserver.keystoneIdentity, err = middleware.CreateIdentityServiceFromConfig(config)\n\t\tm.MapTo(server.keystoneIdentity, (*middleware.IdentityService)(nil))\n\t\tm.Use(middleware.Authentication())\n\t} else {\n\t\tm.MapTo(&middleware.NoIdentityService{}, (*middleware.IdentityService)(nil))\n\t\tauth := schema.NewAuthorizationBuilder().\n\t\t\tWithTenant(schema.Tenant{ID: \"admin\", Name: \"admin\"}).\n\t\t\tWithRoleIDs(\"admin\").\n\t\t\tBuildAdmin()\n\t\tm.Map(auth)\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid base dir: %s\", err)\n\t}\n\n\tif config.GetBool(\"profiling/enabled\", false) {\n\t\tserver.addPprofRoutes()\n\t}\n\tserver.addOptionsRoute()\n\tcors := config.GetString(\"cors\", \"\")\n\tif cors != \"\" {\n\t\tlog.Info(\"Enabling CORS for %s\", cors)\n\t\tif cors == \"*\" {\n\t\t\tlog.Warning(\"cors for * have security issue\")\n\t\t}\n\t\tserver.martini.Use(func(rw http.ResponseWriter, r *http.Request) {\n\t\t\trw.Header().Add(\"Access-Control-Allow-Origin\", cors)\n\t\t\trw.Header().Add(\"Access-Control-Allow-Headers\", \"X-Auth-Token, Content-Type\")\n\t\t\trw.Header().Add(\"Access-Control-Expose-Headers\", \"X-Total-Count\")\n\t\t\trw.Header().Add(\"Access-Control-Allow-Methods\", \"GET,PUT,POST,DELETE\")\n\t\t})\n\t}\n\n\tdocumentRoot := config.GetString(\"document_root\", \"embed\")\n\tif config.GetBool(\"webui_config/enabled\", false) {\n\t\tm.Use(func(res http.ResponseWriter, req *http.Request, c martini.Context) {\n\t\t\tif req.URL.Path != \"/webui/config.json\" {\n\t\t\t\tc.Next()\n\t\t\t\treturn\n\t\t\t}\n\t\t\taddress := config.GetString(\"webui_config/address\", server.address)\n\t\t\tif address[0] == ':' {\n\t\t\t\taddress = \"__HOST__\" + address\n\t\t\t}\n\t\t\tbaseURL := \"http://\" + address\n\t\t\tauthURL := \"http://\" + address + \"/v2.0\"\n\t\t\tif config.GetBool(\"webui_config/tls\", config.GetBool(\"tls/enabled\", false)) {\n\t\t\t\tbaseURL = \"https://\" + address\n\t\t\t\tauthURL = \"https://\" + address + \"/v2.0\"\n\t\t\t}\n\t\t\tauthURL = config.GetString(\"webui_config/auth_url\", authURL)\n\t\t\twebUIConfig := map[string]interface{}{\n\t\t\t\t\"authUrl\": authURL,\n\t\t\t\t\"gohan\": map[string]interface{}{\n\t\t\t\t\t\"schema\": \"/gohan/v0.1/schemas\",\n\t\t\t\t\t\"url\": baseURL,\n\t\t\t\t},\n\t\t\t\t\"routes\": []interface{}{\n\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\"path\": \"\",\n\t\t\t\t\t\t\"viewClass\": \"topView\",\n\t\t\t\t\t\t\"name\": \"top_view\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"errorMessages\": map[string]interface{}{\n\t\t\t\t\t\"tokenExpire\": \"The token is expired. Please re-login.\",\n\t\t\t\t},\n\t\t\t\t\"addingRelationDialog\": []interface{}{\n\t\t\t\t\t\"Pet\",\n\t\t\t\t},\n\t\t\t\t\"pageLimit\": 25,\n\t\t\t\t\"loginRequestTimeout\": 30000,\n\t\t\t\t\"extendTokenTime\": 300000,\n\t\t\t}\n\t\t\troutes.ServeJson(res, webUIConfig)\n\t\t})\n\t}\n\tif documentRoot == \"embed\" {\n\t\tm.Use(staticbin.Static(\"public\", util.Asset, staticbin.Options{\n\t\t\tSkipLogging: true,\n\t\t}))\n\t} else {\n\t\tlog.Info(\"Static file serving from %s\", documentRoot)\n\t\tdocumentRootABS, err := filepath.Abs(documentRoot)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tserver.martini.Use(martini.Static(documentRootABS, martini.StaticOptions{\n\t\t\tSkipLogging: true,\n\t\t}))\n\t}\n\tserver.HealthCheck = healthcheck.NewHealthCheck(server.db, server.sync, server.address, config)\n\tserver.mapRoutes()\n\n\treturn server, nil\n}", "func New(c *controller.Controller) *Server {\n\ts := &Server{\n\t\te: echo.New(),\n\t\tc: c,\n\t}\n\n\t// Middleware\n\ts.e.Use(middleware.Logger())\n\ts.e.Use(middleware.Recover())\n\n\ts.populateRoutes()\n\n\treturn s\n}", "func NewServer(port int, params *Params) (Server, error) {\n\taddr, err := lspnet.ResolveUDPAddr(\"udp\", \":\"+strconv.Itoa(port))\n\tif err != nil {\n\t\tfmt.Println(\"Error on ResolveUDPAddr\")\n\t\treturn nil, err\n\t}\n\tudpConn, err2 := lspnet.ListenUDP(\"udp\", addr)\n\tif err2 != nil {\n\t\tfmt.Println(\"Error in ListenUDP\")\n\t\treturn nil, err2\n\t}\n\n\ts := &server{\n\t\tudpConn: udpConn,\n\t\trequestQueue: make(chan *info),\n\t\tnextClientId: 1,\n\t\tparams: params,\n\t\treadResult: make(chan *Message),\n\t\treadRequest: make(chan int),\n\t\treadBlock: make(chan int),\n\t\treadClientLost: make(chan int),\n\t\tcloseRequest: make(chan int),\n\t\tcloseBlock: make(chan int),\n\t\tcloseClientConnectRequest: make(chan int),\n\t\tcloseAcptReadRoutine: make(chan int),\n\t\tcloseReadRoutine: make(chan int),\n\t\tcloseEpochFile: make(chan int),\n\t\twriteTaskQueue: make(chan *shortMessageType),\n\t\twriteResult: make(chan bool),\n\t\tclientMap: make(map[int]*clientTrackingMap),\n\t\treadyToWriteTask: make(chan *writeBackMessage),\n\t\treadStorage: list.New(),\n\t\twriteStorage: list.New(),\n\t\twriteTask: make(chan int),\n\t\tseq: 1,\n\t\tclientAddrSet: make(map[lspnet.UDPAddr]int),\n\t\tticker: time.NewTicker(time.Duration(params.EpochMillis) * time.Millisecond),\n\t\tepochRenew: make(chan int),\n\t\tclientCloseError: make(chan bool),\n\t\tisCalledClose: false,\n\t\tserverClosed: make(chan int),\n\t\tserverAlreadyClosed: false,\n\t\tlostClient: list.New(),\n\t}\n\t// accepting clients && read\n\tgo acceptAndRead(s)\n\n\t// Main server handling routine\n\tgo mainRoutine(s)\n\n\t// A routine for epoch ticker\n\tgo epochFire(s)\n\n\treturn s, nil\n}", "func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,\n\tbio lnwallet.BlockChainIO, fundingSigner lnwallet.MessageSigner,\n\twallet *lnwallet.LightningWallet, chanDB *channeldb.DB) (*server, error) {\n\n\tprivKey, err := wallet.GetIdentitykey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprivKey.Curve = btcec.S256()\n\n\tlisteners := make([]net.Listener, len(listenAddrs))\n\tfor i, addr := range listenAddrs {\n\t\tlisteners[i], err = brontide.NewListener(privKey, addr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tserializedPubKey := privKey.PubKey().SerializeCompressed()\n\ts := &server{\n\t\tlnwallet: wallet,\n\t\tbio: bio,\n\t\tchainNotifier: notifier,\n\t\tchanDB: chanDB,\n\n\t\tinvoices: newInvoiceRegistry(chanDB),\n\t\tutxoNursery: newUtxoNursery(chanDB, notifier, wallet),\n\t\thtlcSwitch: newHtlcSwitch(),\n\n\t\tidentityPriv: privKey,\n\t\tnodeSigner: newNodeSigner(privKey),\n\n\t\t// TODO(roasbeef): derive proper onion key based on rotation\n\t\t// schedule\n\t\tsphinx: sphinx.NewRouter(privKey, activeNetParams.Params),\n\t\tlightningID: sha256.Sum256(serializedPubKey),\n\n\t\tpersistentPeers: make(map[string]struct{}),\n\t\tpersistentConnReqs: make(map[string][]*connmgr.ConnReq),\n\n\t\tpeersByID: make(map[int32]*peer),\n\t\tpeersByPub: make(map[string]*peer),\n\t\tinboundPeers: make(map[string]*peer),\n\t\toutboundPeers: make(map[string]*peer),\n\n\t\tnewPeers: make(chan *peer, 10),\n\t\tdonePeers: make(chan *peer, 10),\n\n\t\tbroadcastRequests: make(chan *broadcastReq),\n\t\tsendRequests: make(chan *sendReq),\n\n\t\tglobalFeatures: globalFeatures,\n\t\tlocalFeatures: localFeatures,\n\n\t\tqueries: make(chan interface{}),\n\t\tquit: make(chan struct{}),\n\t}\n\n\t// If the debug HTLC flag is on, then we invoice a \"master debug\"\n\t// invoice which all outgoing payments will be sent and all incoming\n\t// HTLCs with the debug R-Hash immediately settled.\n\tif cfg.DebugHTLC {\n\t\tkiloCoin := btcutil.Amount(btcutil.SatoshiPerBitcoin * 1000)\n\t\ts.invoices.AddDebugInvoice(kiloCoin, *debugPre)\n\t\tsrvrLog.Debugf(\"Debug HTLC invoice inserted, preimage=%x, hash=%x\",\n\t\t\tdebugPre[:], debugHash[:])\n\t}\n\n\t// If external IP addresses have been specified, add those to the list\n\t// of this server's addresses.\n\tselfAddrs := make([]net.Addr, 0, len(cfg.ExternalIPs))\n\tfor _, ip := range cfg.ExternalIPs {\n\t\tvar addr string\n\t\t_, _, err = net.SplitHostPort(ip)\n\t\tif err != nil {\n\t\t\taddr = net.JoinHostPort(ip, strconv.Itoa(defaultPeerPort))\n\t\t} else {\n\t\t\taddr = ip\n\t\t}\n\n\t\tlnAddr, err := net.ResolveTCPAddr(\"tcp\", addr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tselfAddrs = append(selfAddrs, lnAddr)\n\t}\n\n\tchanGraph := chanDB.ChannelGraph()\n\n\t// TODO(roasbeef): make alias configurable\n\talias := lnwire.NewAlias(hex.EncodeToString(serializedPubKey[:10]))\n\tself := &channeldb.LightningNode{\n\t\tLastUpdate: time.Now(),\n\t\tAddresses: selfAddrs,\n\t\tPubKey: privKey.PubKey(),\n\t\tAlias: alias.String(),\n\t\tFeatures: globalFeatures,\n\t}\n\n\t// If our information has changed since our last boot, then we'll\n\t// re-sign our node announcement so a fresh authenticated version of it\n\t// can be propagated throughout the network upon startup.\n\t// TODO(roasbeef): don't always set timestamp above to _now.\n\tself.AuthSig, err = discovery.SignAnnouncement(s.nodeSigner,\n\t\ts.identityPriv.PubKey(),\n\t\t&lnwire.NodeAnnouncement{\n\t\t\tTimestamp: uint32(self.LastUpdate.Unix()),\n\t\t\tAddresses: self.Addresses,\n\t\t\tNodeID: self.PubKey,\n\t\t\tAlias: alias,\n\t\t\tFeatures: self.Features,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to generate signature for \"+\n\t\t\t\"self node announcement: %v\", err)\n\t}\n\tif err := chanGraph.SetSourceNode(self); err != nil {\n\t\treturn nil, fmt.Errorf(\"can't set self node: %v\", err)\n\t}\n\n\ts.chanRouter, err = routing.New(routing.Config{\n\t\tGraph: chanGraph,\n\t\tChain: bio,\n\t\tNotifier: notifier,\n\t\tSendToSwitch: func(firstHop *btcec.PublicKey,\n\t\t\thtlcAdd *lnwire.UpdateAddHTLC) ([32]byte, error) {\n\n\t\t\tfirstHopPub := firstHop.SerializeCompressed()\n\t\t\tdestInterface := chainhash.Hash(sha256.Sum256(firstHopPub))\n\n\t\t\treturn s.htlcSwitch.SendHTLC(&htlcPacket{\n\t\t\t\tdest: destInterface,\n\t\t\t\tmsg: htlcAdd,\n\t\t\t})\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can't create router: %v\", err)\n\t}\n\n\ts.discoverSrv, err = discovery.New(discovery.Config{\n\t\tBroadcast: s.broadcastMessage,\n\t\tNotifier: s.chainNotifier,\n\t\tRouter: s.chanRouter,\n\t\tSendToPeer: s.sendToPeer,\n\t\tTrickleDelay: time.Millisecond * 300,\n\t\tProofMatureDelta: 0,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.rpcServer = newRPCServer(s)\n\ts.breachArbiter = newBreachArbiter(wallet, chanDB, notifier, s.htlcSwitch)\n\n\tvar chanIDSeed [32]byte\n\tif _, err := rand.Read(chanIDSeed[:]); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.fundingMgr, err = newFundingManager(fundingConfig{\n\t\tIDKey: s.identityPriv.PubKey(),\n\t\tWallet: wallet,\n\t\tNotifier: s.chainNotifier,\n\t\tSignMessage: func(pubKey *btcec.PublicKey, msg []byte) (*btcec.Signature, error) {\n\t\t\tif pubKey.IsEqual(s.identityPriv.PubKey()) {\n\t\t\t\treturn s.nodeSigner.SignMessage(pubKey, msg)\n\t\t\t}\n\n\t\t\treturn fundingSigner.SignMessage(pubKey, msg)\n\t\t},\n\t\tSendAnnouncement: func(msg lnwire.Message) error {\n\t\t\ts.discoverSrv.ProcessLocalAnnouncement(msg,\n\t\t\t\ts.identityPriv.PubKey())\n\t\t\treturn nil\n\t\t},\n\t\tArbiterChan: s.breachArbiter.newContracts,\n\t\tSendToPeer: s.sendToPeer,\n\t\tFindPeer: s.findPeer,\n\t\tTempChanIDSeed: chanIDSeed,\n\t\tFindChannel: func(chanID lnwire.ChannelID) (*lnwallet.LightningChannel, error) {\n\t\t\tdbChannels, err := chanDB.FetchAllChannels()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tfor _, channel := range dbChannels {\n\t\t\t\tif chanID.IsChanPoint(channel.ChanID) {\n\t\t\t\t\treturn lnwallet.NewLightningChannel(wallet.Signer,\n\t\t\t\t\t\tnotifier, channel)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil, fmt.Errorf(\"unable to find channel\")\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO(roasbeef): introduce closure and config system to decouple the\n\t// initialization above ^\n\n\t// Create the connection manager which will be responsible for\n\t// maintaining persistent outbound connections and also accepting new\n\t// incoming connections\n\tcmgr, err := connmgr.New(&connmgr.Config{\n\t\tListeners: listeners,\n\t\tOnAccept: s.inboundPeerConnected,\n\t\tRetryDuration: time.Second * 5,\n\t\tTargetOutbound: 100,\n\t\tGetNewAddress: nil,\n\t\tDial: noiseDial(s.identityPriv),\n\t\tOnConnection: s.outboundPeerConnected,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.connMgr = cmgr\n\n\treturn s, nil\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 NewServer(config config.Config) (*Server, error) {\n\tghClient := gh.NewClient(config.Owner, config.Repo, config.AccessToken)\n\ttranslator := translators.NewBaiduTranslator(translators.BaiduTranslatorOptions{\n\t\tAppid: config.TranslatorConfig.BaiduConfig.AppID,\n\t\tKey: config.TranslatorConfig.BaiduConfig.Key,\n\t})\n\n\tdocGenerator, err := docgenerator.New(ghClient,\n\t\tconfig.Owner, config.Repo,\n\t\tconfig.DocGenerateConfig.RootDir, config.DocGenerateConfig.SwaggerPath, config.DocGenerateConfig.APIDocPath,\n\t\tconfig.DocGenerateConfig.GenerationHour,\n\t\tconfig.DocGenerateConfig.CliDocGeneratorCmd,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Server{\n\t\tlistenAddress: config.HTTPListen,\n\t\tprocessor: processor.New(ghClient, translator, config.Owner, config.Repo),\n\t\tfetcher: fetcher.New(ghClient, config.FetcherConfig.CommitsGap),\n\t\tciNotifier: ci.New(ghClient, config.Owner, config.Repo),\n\t\treporter: reporter.New(ghClient, config.WeeklyReportConfig.ReportDay, config.WeeklyReportConfig.ReportHour),\n\t\tdocGenerator: docGenerator,\n\t}, nil\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 NewServer(GM *GameManager) *Server {\n serv := &Server{\n GM: GM,\n Clients: new(sync.Map),\n Channels: new(sync.Map),\n Register: make(chan *Client),\n Unregister: make(chan *Client),\n }\n\n // Register events\n GM.Event(EventDefinition{\"connected\", \"fired when a new client connects\", []string{INTERNAL_CHAN, DIRECT_CHAN}})\n GM.Event(EventDefinition{\"disconnect\", \"fired when a client disconnects\", []string{INTERNAL_CHAN, DIRECT_CHAN}})\n\n // Add the default channels\n serv.NewChannels(map[string]ChannelInterface{\n INTERNAL_CHAN: &InternalChannel{},\n DIRECT_CHAN: &Channel{},\n SERVER_CHAN: &ServerChannel{},\n })\n\n return serv\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 NewServer(ev *event.Dispatcher, irc *irc.Manager, jsvm *vm.VM) (*Server, error) {\n\tsrv := &Server{\n\t\tLogger: logrus.StandardLogger(),\n\t\toutputLogHook: newLogFileWriterHook(),\n\n\t\tevents: ev,\n\t\tirc: irc,\n\t\tvm: jsvm,\n\n\t\twindows: NewWindowManager(ev),\n\t\thistory: NewHistoryManager(),\n\t\ttabber: NewTabCompleter(),\n\n\t\tdone: make(chan struct{}),\n\t}\n\tsrv.initUI()\n\tsrv.Logger.SetOutput(srv.windows.Index(0))\n\tsrv.Logger.SetFormatter(&statusFormatter{})\n\tsrv.Logger.AddHook(srv.outputLogHook)\n\treturn srv, nil\n}", "func NewServer(logger zerolog.Logger, l listing.Service, s storemanagement.Service,\n\tauth authetication.Service, addr string) Server {\n\tif l == nil || s == nil || auth == nil || addr == \"\" {\n\t\tlog.Println(\"Unable to start server because services were not configured\")\n\t\tos.Exit(1)\n\t}\n\n\trouter := chi.NewRouter()\n\tserver := Server{\n\t\tlisting: l,\n\t\tsManager: s,\n\t\trouter: router,\n\t\tauth: auth,\n\t\tServer: &http.Server{\n\t\t\tAddr: addr,\n\t\t\tHandler: router,\n\t\t},\n\t}\n\trouter.Use(httplog.RequestLogger(logger))\n\tserver.Routes()\n\treturn server\n}", "func NewServer() *Server {\n\treturn &Server{\n\t\tstatusMap: make(map[string]healthpb.HealthCheckResponse_ServingStatus),\n\t}\n}", "func NewServer(svc Service, config *Config) *Server {\n\tif !config.Debug {\n\t\tgin.SetMode(gin.ReleaseMode)\n\t}\n\n\tserver := &Server{\n\t\tRoutes: initializeRoutes(\n\t\t\t!config.AuthDisabled,\n\t\t\tconfig.TokenURL,\n\t\t\tconfig.Tracer,\n\t\t),\n\t\tservice: svc,\n\t\tconfig: config,\n\t\tTitle: \"Cluster Registry\",\n\t\tVersion: \"0.0.1\",\n\t\tauthDisabled: config.AuthDisabled,\n\t}\n\n\t// enable pprof http endpoints in debug mode\n\tif config.Debug {\n\t\tpprof.Register(server.Routes.Engine)\n\t}\n\n\t// set logrus logger to TextFormatter with no colors\n\tlog.SetFormatter(&log.TextFormatter{DisableColors: true})\n\n\tserver.server = &http.Server{\n\t\tAddr: config.Address,\n\t\tHandler: server.Routes.Engine,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t}\n\n\tserver.serviceHealthyFn = svc.Healthy\n\n\tif !config.WellKnownDisabled {\n\t\tserver.Routes.configureWellKnown(server.isHealthy)\n\t}\n\n\t// configure healthz endpoint\n\tserver.Routes.GET(\"/healthz\", healthHandler(server.isHealthy))\n\n\treturn server\n}", "func NewServer(c *support.ConfigT) *ServerT {\n\trenderer := multitemplate.NewRenderer()\n\t// Initialize the error templates.\n\trenderer.AddFromString(\"error/404\", html.ErrorTpl404())\n\trenderer.AddFromString(\"error/500\", html.ErrorTpl500())\n\trenderer.AddFromString(\"default/welcome\", html.WelcomeTpl())\n\n\tr := newRouter(c)\n\tr.HTMLRender = renderer\n\n\ts := &http.Server{\n\t\tAddr: c.HTTPHost + \":\" + c.HTTPPort,\n\t\tHandler: r,\n\t\tMaxHeaderBytes: c.HTTPMaxHeaderBytes,\n\t\tReadTimeout: c.HTTPReadTimeout,\n\t\tReadHeaderTimeout: c.HTTPReadHeaderTimeout,\n\t\tWriteTimeout: c.HTTPWriteTimeout,\n\t\tIdleTimeout: c.HTTPIdleTimeout,\n\t}\n\ts.ErrorLog = zap.NewStdLog(support.Logger.Desugar())\n\n\tif c.HTTPSSLEnabled == true {\n\t\ts.Addr = c.HTTPHost + \":\" + c.HTTPSSLPort\n\t}\n\n\treturn &ServerT{\n\t\tConfig: c,\n\t\tGRPC: nil, // to be implemented\n\t\tHTTP: s,\n\t\tHTMLRenderer: renderer,\n\t\tRouter: r,\n\t}\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 ...ServerOption) *Server {\n s := &Server{\n codecs: make(map[string]Codec),\n services: new(serviceMap),\n }\n for _, option := range options {\n option(s)\n }\n return s\n}", "func (metricsServer PrometheusMetricServer) NewServer(address string, pattern string) {\n\thttp.HandleFunc(\"/healthz\", func(w http.ResponseWriter, _ *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(\"OK\"))\n\t})\n\tlog.Printf(\"Starting metrics server at %v\", address)\n\thttp.Handle(pattern, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))\n\n\t// initialize the total error metric\n\tscalerErrorsTotal.GetMetricWith(prometheus.Labels{})\n\n\tlog.Fatal(http.ListenAndServe(address, nil))\n}", "func NewServer(\n\tctx context.Context,\n\taddr string,\n\tk8sAPI *k8s.API,\n\tgrpcTapServer pb.TapServer,\n\tdisableCommonNames bool,\n) (*Server, error) {\n\tupdateEvent := make(chan struct{})\n\terrEvent := make(chan error)\n\twatcher := pkgTls.NewFsCredsWatcher(pkgk8s.MountPathTLSBase, updateEvent, errEvent).\n\t\tWithFilePaths(pkgk8s.MountPathTLSCrtPEM, pkgk8s.MountPathTLSKeyPEM)\n\tgo func() {\n\t\tif err := watcher.StartWatching(ctx); err != nil {\n\t\t\tlog.Fatalf(\"Failed to start creds watcher: %s\", err)\n\t\t}\n\t}()\n\n\tclientCAPem, allowedNames, usernameHeader, groupHeader, err := serverAuth(ctx, k8sAPI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// for development\n\tif disableCommonNames {\n\t\tallowedNames = []string{}\n\t}\n\n\tlog := log.WithFields(log.Fields{\n\t\t\"component\": \"tap\",\n\t\t\"addr\": addr,\n\t})\n\n\tclientCertPool := x509.NewCertPool()\n\tclientCertPool.AppendCertsFromPEM([]byte(clientCAPem))\n\n\thttpServer := &http.Server{\n\t\tAddr: addr,\n\t\tReadHeaderTimeout: 15 * time.Second,\n\t\tTLSConfig: &tls.Config{\n\t\t\tClientAuth: tls.VerifyClientCertIfGiven,\n\t\t\tClientCAs: clientCertPool,\n\t\t\tMinVersion: tls.VersionTLS12,\n\t\t},\n\t}\n\n\tvar emptyCert atomic.Value\n\th := &handler{\n\t\tk8sAPI: k8sAPI,\n\t\tusernameHeader: usernameHeader,\n\t\tgroupHeader: groupHeader,\n\t\tgrpcTapServer: grpcTapServer,\n\t\tlog: log,\n\t}\n\n\tlis, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"net.Listen failed with: %w\", err)\n\t}\n\n\ts := &Server{\n\t\tServer: httpServer,\n\t\tlistener: lis,\n\t\trouter: initRouter(h),\n\t\tallowedNames: allowedNames,\n\t\tcertValue: &emptyCert,\n\t\tlog: log,\n\t}\n\ts.Handler = prometheus.WithTelemetry(s)\n\thttpServer.TLSConfig.GetCertificate = s.getCertificate\n\n\tif err := watcher.UpdateCert(s.certValue); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialized certificate: %w\", err)\n\t}\n\n\tgo watcher.ProcessEvents(log, s.certValue, updateEvent, errEvent)\n\n\treturn s, nil\n}", "func newServer(config Config) *http.Server {\n\treturn &http.Server{\n\t\tAddr: fmt.Sprintf(\":%s\", config.Port),\n\t\tHandler: newRouter(config),\n\t}\n}", "func NewServer() *Server {\n\ttr := make(chan TimingReport)\n\ts := &Server{\n\t\ttr,\n\t}\n\tgo s.MonitorTimingReports()\n\treturn s\n}", "func NewServer(c Config) (*Server, error) {\n\tswitch {\n\tcase c.ZKTagsPrefix == \"\":\n\t\tfallthrough\n\tcase c.ReadReqRate < 1:\n\t\tfallthrough\n\tcase c.WriteReqRate < 1:\n\t\treturn nil, errors.New(\"invalid configuration parameter(s)\")\n\t}\n\n\trrt, _ := NewRequestThrottle(RequestThrottleConfig{\n\t\tCapacity: 10,\n\t\tRate: c.ReadReqRate,\n\t})\n\n\twrt, _ := NewRequestThrottle(RequestThrottleConfig{\n\t\tCapacity: 10,\n\t\tRate: c.WriteReqRate,\n\t})\n\n\ttcfg := TagHandlerConfig{\n\t\tPrefix: c.ZKTagsPrefix,\n\t}\n\n\tth, _ := NewTagHandler(tcfg)\n\tif c.test {\n\t\tth.Store = newzkTagStorageMock()\n\t}\n\n\treturn &Server{\n\t\tHTTPListen: c.HTTPListen,\n\t\tGRPCListen: c.GRPCListen,\n\t\tTags: th,\n\t\treadReqThrottle: rrt,\n\t\twriteReqThrottle: wrt,\n\t\ttest: c.test,\n\t}, nil\n}", "func NewServer(routinesPool *safe.Pool, entryPoints TCPEntryPoints, entryPointsUDP UDPEntryPoints, watcher *ConfigurationWatcher,\n\tchainBuilder *middleware.ChainBuilder, accessLoggerMiddleware *accesslog.Handler,\n) *Server {\n\tsrv := &Server{\n\t\twatcher: watcher,\n\t\ttcpEntryPoints: entryPoints,\n\t\tchainBuilder: chainBuilder,\n\t\taccessLoggerMiddleware: accessLoggerMiddleware,\n\t\tsignals: make(chan os.Signal, 1),\n\t\tstopChan: make(chan bool, 1),\n\t\troutinesPool: routinesPool,\n\t\tudpEntryPoints: entryPointsUDP,\n\t}\n\n\tsrv.configureSignals()\n\n\treturn srv\n}", "func NewServer() *Server {\n\tserver := &Server{\n\t\tmessages: make(chan []byte, 1),\n\t\tclients: make(map[chan []byte]bool),\n\t\tregister: make(chan chan []byte),\n\t\tunregister: make(chan chan []byte),\n\t}\n\tgo server.listen()\n\treturn server\n}", "func newServer(cert *shared.CertInfo, handler http.Handler) *httptest.Server {\n\tserver := httptest.NewUnstartedServer(handler)\n\tserver.TLS = util.ServerTLSConfig(cert)\n\tserver.StartTLS()\n\treturn server\n}", "func New(\n\taddr string,\n\thandler Handler,\n\tlog *log.Logger,\n\tworkersCount uint8,\n) (srv *Server) {\n\tsrv = &Server{\n\t\taddr: addr,\n\t\thandler: handler,\n\t\tlog: log,\n\t\tClients: newClients(),\n\t\tchStop: make(chan bool, 1),\n\t\tchRequest: make(chan *tRequest, workersCount),\n\t}\n\n\treturn\n}", "func NewServer(options ...ServerOption) *Server {\n\ts := &Server{}\n\n\tfor _, opt := range options {\n\t\topt(s)\n\t}\n\n\tif s.provider == nil {\n\t\ts.provider = NewJoe()\n\t}\n\n\tif s.logger == nil {\n\t\ts.logger = log.New(os.Stderr, \"go-sse: \", log.LstdFlags)\n\t}\n\n\treturn s\n}", "func New(c Config) *http.Server {\n\n\thandler := &RateLimitHandler{\n\t\trecords: map[string]*Record{},\n\t\tlimit: c.Limit,\n\t\twindow: c.Window,\n\t}\n\n\ts := &http.Server{\n\t\tAddr: fmt.Sprintf(\"0.0.0.0:%d\", c.Port),\n\t\tHandler: handler,\n\t}\n\treturn s\n}", "func NewServer(port int, params *Params) (Server, error) {\n\ts := &server{\n\t\tnextConnectId: 1,\n\t\tclients: make(map[int]*abstractClient),\n\t\treadFromClientChan: make(chan *msgPackage),\n\t\twriteToClientChan: make(chan *Message),\n\t\treadRequest: &requestRead{\n\t\t\task: make(chan int),\n\t\t\tresponse: make(chan *Message),\n\t\t},\n\t\twriteRequest: &requestWrite{\n\t\t\task: make(chan []byte),\n\t\t\tconnId: make(chan int),\n\t\t\tresponse: make(chan error),\n\t\t},\n\t\treadList: list.New(),\n\t\twriteList: list.New(),\n\n\t\tflag: false,\n\n\t\t// variables for window size\n\t\twindowSize: params.WindowSize,\n\t\tmapNeedSend: list.New(),\n\n\t\t// variables for epoch\n\t\tepochChan: make(chan int),\n\t\tepochMillis: params.EpochMillis,\n\t\tepochLimit: params.EpochLimit,\n\n\t\t// close\n\t\tdeleteClient: make(chan int),\n\t\tcloseConnRequest: &requestCloseConn{\n\t\t\task: make(chan int),\n\t\t\tgetError: make(chan error),\n\t\t},\n\t\twaitToWriteFinish: false,\n\t\twriteFinished: make(chan int),\n\t\twaitToAckFinish: false,\n\t\tackFinished: make(chan int),\n\t\tcloseRead: make(chan int, 1),\n\t\tcloseEpoch: make(chan int, 1),\n\t\tcloseEvent: make(chan int, 1),\n\n\t\t// close conn\n\t\tcloseConn: make(chan int, 1),\n\t}\n\n\t// start server\n\taddr, err := lspnet.ResolveUDPAddr(\"udp\", \"localhost:\"+strconv.Itoa(port))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn, err := lspnet.ListenUDP(\"udp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.conn = conn\n\tgo s.readMessage()\n\tgo s.handleMessage()\n\tgo s.epochFire()\n\n\tfmt.Println(\"new server\")\n\treturn s, nil\n}", "func newEventSourcedServer() *EventSourcedServer {\n\treturn &EventSourcedServer{\n\t\tentities: make(map[string]*EventSourcedEntity),\n\t\tcontexts: make(map[string]*EntityInstanceContext),\n\t}\n}", "func StartServer(addr *string) {\n\thttp.Handle(\"/metrics\", prometheus.Handler())\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(`<html>\n <head><title>LXC Exporter</title></head>\n <body>\n <h1>LXC Exporter</h1>\n <p><a href=\"/metrics\">Metrics</a></p>\n </body>\n </html>`))\n\t})\n\n\tif err := http.ListenAndServe(*addr, nil); err != nil {\n\t\tlog.Fatalf(\"Error starting HTTP server: %s\", err)\n\t}\n}", "func NewServer(newStorageClient NewStorageClientFunc, blockSizeLimit uint64) *Server {\n\treturn &Server{newStorageClient, blockSizeLimit, make(map[string]bool)}\n}", "func main() {\n\t\n\tlog.Println(\"start of twitter-streamer server -- twitter-streamer .....\")\n\n\tlistener, err := net.Listen(\"tcp\",\"localhost\"+port) // setup listener\n\tif err != nil {\n\t\tlog.Fatalf(\"Server, failed on listen: %v\",err)\n\t}\n\tgrpcServer := grpc.NewServer()\n\tpb.RegisterTweetServiceServer(grpcServer, new(server)) // register the service\n\n\tlog.Printf(\"server listening on port -> %s\\n\",port)\n\t\n\tif err := grpcServer.Serve(listener); err != nil { // listen serve client connections\n\t\tlog.Fatalf(\"Server, failed to server: %v\",err)\n\t}\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 NewServer(conn *grpc.ClientConn) *Server {\n\treturn &Server{\n\t\ttopoConn: conn,\n\t\tclients: make(map[uint32]*webClient),\n\t}\n}", "func New(cfg *Config) *Server {\n\tdefaultConfig(cfg)\n\tlog.Printf(\"%+v\\n\", cfg)\n\treturn &Server{\n\t\tcfg: cfg,\n\t\thandlers: make([]connectionHandler, cfg.Count),\n\t\tevents: make(chan eventWithData, cfg.Count),\n\t}\n}", "func (l *PageLoop) NewServer(config *ServerConfig) (*http.Server, error) {\n var handler http.Handler\n\n // Configuration for the server\n l.Config = config\n\n // Initialize server multiplexer\n l.Mux = http.NewServeMux()\n\n // Set up a host for our containers\n\tl.Host = NewHost()\n\n // Manager for application mountpoints.\n //\n // Application mountpoints are dynamic (they can be added and removed at runtime)\n // so they need special care.\n l.MountpointManager = NewMountpointManager(l.Config, l.Host)\n\n l.initServices()\n\n\t// Configure application containers.\n\tsys := NewContainer(\"system\", \"System applications.\", true)\n\ttpl := NewContainer(\"template\", \"Application & document templates.\", true)\n\tusr := NewContainer(\"user\", \"User applications.\", false)\n\tl.Host.Add(usr)\n\tl.Host.Add(sys)\n\tl.Host.Add(tpl)\n\n\t// REST API global endpoint (/api/)\n\thandler = RestService(l.Mux, l.Services, l.Host, l.MountpointManager)\n\tl.MountpointManager.MountpointMap[API_URL] = handler\n\tlog.Printf(\"Serving rest service from %s\", API_URL)\n\n\t// Websocket global endpoint (/ws/)\n\thandler = WebsocketService(l.Mux, l.Services, l.Host, l.MountpointManager)\n\tl.MountpointManager.MountpointMap[WEBSOCKET_URL] = handler\n\tlog.Printf(\"Serving websocket service from %s\", WEBSOCKET_URL)\n\n\t// RPC global endpoint (/rpc/)\n /*\n\thandler = RpcService(l.Mux, l.Host)\n\tl.MountpointManager.MountpointMap[RPC_URL] = handler\n\tlog.Printf(\"Serving rpc service from %s\", RPC_URL)\n */\n\n // Collect mountpoints by container name\n if collection, err := l.MountpointManager.Collect(config.Mountpoints, config.UserConfig().Mountpoints); err != nil {\n return nil, err\n // Load the mountpoints using the container map\n } else {\n // Discarding the returned list of applications\n if _, err := l.MountpointManager.LoadCollection(collection); err != nil {\n return nil, err\n }\n }\n\n // Mount containers and the applications within them\n\tl.MountContainer(sys)\n\tl.MountContainer(tpl)\n\tl.MountContainer(usr)\n\n s := &http.Server{\n Addr: config.Addr,\n Handler: ServerHandler{MountpointManager: l.MountpointManager, Mux: l.Mux},\n ReadTimeout: 10 * time.Second,\n WriteTimeout: 10 * time.Second,\n MaxHeaderBytes: 1 << 20,\n }\n\n return s, nil\n}", "func (s *Server) Start() {\n\ts.logger.WithField(\"version\", build.VERSION).Info(\"Starting server\")\n\n\t// Set up the processors for spans:\n\n\t// Use the pre-allocated Workers slice to know how many to start.\n\ts.SpanWorker = NewSpanWorker(\n\t\ts.spanSinks, s.TraceClient, s.Statsd, s.SpanChan, s.logger)\n\n\tgo func() {\n\t\ts.logger.Info(\"Starting Event worker\")\n\t\tdefer func() {\n\t\t\tConsumePanic(s.TraceClient, s.Hostname, recover())\n\t\t}()\n\t\ts.EventWorker.Work()\n\t}()\n\n\ts.logger.WithField(\"n\", s.SpanWorkerGoroutines).Info(\"Starting span workers\")\n\tfor i := 0; i < s.SpanWorkerGoroutines; i++ {\n\t\tgo func() {\n\t\t\tdefer func() {\n\t\t\t\tConsumePanic(s.TraceClient, s.Hostname, recover())\n\t\t\t}()\n\t\t\ts.SpanWorker.Work()\n\t\t}()\n\t}\n\n\tstatsdPool := &sync.Pool{\n\t\t// We +1 this so we an \"detect\" when someone sends us too long of a metric!\n\t\tNew: func() interface{} {\n\t\t\treturn make([]byte, s.metricMaxLength+1)\n\t\t},\n\t}\n\n\ttracePool := &sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\treturn make([]byte, s.traceMaxLengthBytes)\n\t\t},\n\t}\n\n\tfor _, sink := range s.spanSinks {\n\t\tlogrus.WithField(\"sink\", sink.Name()).Info(\"Starting span sink\")\n\t\tif err := sink.Start(s.TraceClient); err != nil {\n\t\t\tlogrus.WithError(err).WithField(\"sink\", sink).Panic(\"Error starting span sink\")\n\t\t}\n\t}\n\n\tfor _, sink := range s.metricSinks {\n\t\tlogrus.WithField(\"sink\", sink.sink.Name()).Info(\"Starting metric sink\")\n\t\tif err := sink.sink.Start(s.TraceClient); err != nil {\n\t\t\tlogrus.WithError(err).WithField(\"sink\", sink).Fatal(\"Error starting metric sink\")\n\t\t}\n\t}\n\n\t// Read Metrics Forever!\n\tconcreteAddrs := make([]net.Addr, 0, len(s.StatsdListenAddrs))\n\tstatsdSource := UdpMetricsSource{\n\t\tlogger: s.logger,\n\t}\n\tfor _, addr := range s.StatsdListenAddrs {\n\t\tconcreteAddrs = append(\n\t\t\tconcreteAddrs, statsdSource.StartStatsd(s, addr, statsdPool))\n\t}\n\ts.StatsdListenAddrs = concreteAddrs\n\n\t// Read Traces Forever!\n\tssfSource := SsfMetricsSource{\n\t\tlogger: s.logger,\n\t}\n\tif len(s.SSFListenAddrs) > 0 {\n\t\tconcreteAddrs := make([]net.Addr, 0, len(s.StatsdListenAddrs))\n\t\tfor _, addr := range s.SSFListenAddrs {\n\t\t\tconcreteAddrs = append(\n\t\t\t\tconcreteAddrs, ssfSource.StartSSF(s, addr, tracePool))\n\t\t}\n\t\ts.SSFListenAddrs = concreteAddrs\n\t} else {\n\t\tlogrus.Info(\"Tracing sockets are not configured - not reading trace socket\")\n\t}\n\n\t// Read grpc traces forever!\n\tif len(s.GRPCListenAddrs) > 0 {\n\t\tconcreteAddrs := make([]net.Addr, 0, len(s.GRPCListenAddrs))\n\t\tgrpcSource := GrpcMetricsSource{\n\t\t\tlogger: s.logger,\n\t\t}\n\t\tfor _, addr := range s.GRPCListenAddrs {\n\t\t\tconcreteAddrs = append(concreteAddrs, grpcSource.StartGRPC(s, addr))\n\t\t}\n\t\t//If there are already ssf listen addresses then append the grpc ones otherwise just use the grpc ones\n\t\tif len(s.SSFListenAddrs) > 0 {\n\t\t\ts.SSFListenAddrs = append(s.SSFListenAddrs, concreteAddrs...)\n\t\t} else {\n\t\t\ts.SSFListenAddrs = concreteAddrs\n\t\t}\n\n\t\t//If there are already statsd listen addresses then append the grpc ones otherwise just use the grpc ones\n\t\tif len(s.StatsdListenAddrs) > 0 {\n\t\t\ts.StatsdListenAddrs = append(s.StatsdListenAddrs, concreteAddrs...)\n\t\t} else {\n\t\t\ts.StatsdListenAddrs = concreteAddrs\n\t\t}\n\t} else {\n\t\tlogrus.Info(\"GRPC tracing sockets are not configured - not reading trace socket\")\n\t}\n\n\t// Initialize a gRPC connection for forwarding\n\tvar err error\n\tif s.Config.Tls != nil && s.Config.Tls.CaFile != \"\" && s.Config.Tls.CertFile != \"\" && s.Config.Tls.KeyFile != \"\" {\n\t\tvar tlsConfig *tls.Config\n\t\ttlsConfig, err = s.Config.Tls.GetTlsConfig()\n\t\tif err != nil {\n\t\t\ts.logger.WithError(err).Fatal(\"failed to parse tls config\")\n\t\t}\n\t\ts.grpcForwardConn, err = grpc.Dial(\n\t\t\ts.ForwardAddr,\n\t\t\tgrpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))\n\t} else {\n\t\ts.grpcForwardConn, err = grpc.Dial(s.ForwardAddr, grpc.WithInsecure())\n\t}\n\tif err != nil {\n\t\ts.logger.WithError(err).WithFields(logrus.Fields{\n\t\t\t\"forwardAddr\": s.ForwardAddr,\n\t\t}).Fatal(\"Failed to initialize a gRPC connection for forwarding\")\n\t}\n\n\t// Flush every Interval forever!\n\tgo func() {\n\t\tdefer func() {\n\t\t\tConsumePanic(s.TraceClient, s.Hostname, recover())\n\t\t}()\n\n\t\tctx, cancel := context.WithCancel(context.Background())\n\t\tgo func() {\n\t\t\t// If the server is shutting down, cancel any in-flight flush:\n\t\t\t<-s.shutdown\n\t\t\tcancel()\n\t\t}()\n\n\t\tif s.synchronizeInterval {\n\t\t\t// We want to align our ticker to a multiple of its duration for\n\t\t\t// convenience of bucketing.\n\t\t\t<-time.After(CalculateTickDelay(s.Interval, time.Now()))\n\t\t}\n\n\t\t// We aligned the ticker to our interval above. It's worth noting that just\n\t\t// because we aligned once we're not guaranteed to be perfect on each\n\t\t// subsequent tick. This code is small, however, and should service the\n\t\t// incoming tick signal fast enough that the amount we are \"off\" is\n\t\t// negligible.\n\t\tticker := time.NewTicker(s.Interval)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-s.shutdown:\n\t\t\t\t// stop flushing on graceful shutdown\n\t\t\t\tticker.Stop()\n\t\t\t\treturn\n\t\t\tcase triggered := <-ticker.C:\n\t\t\t\tctx, cancel := context.WithDeadline(ctx, triggered.Add(s.Interval))\n\t\t\t\ts.Flush(ctx)\n\t\t\t\tcancel()\n\t\t\t}\n\t\t}\n\t}()\n}", "func NewServer(addr string, d *Dispatcher, coll *docstore.Collection) *http.Server {\n\tmux := http.NewServeMux()\n\n\tmux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"hello, vlv.\"))\n\t})\n\n\tmux.HandleFunc(\"/add\", func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\n\t\tif r.Method != http.MethodPost {\n\t\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\t\treturn\n\t\t}\n\n\t\tt, err := TaskFromRequest(r)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, \"failed to decode: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif err := coll.Create(ctx, t); err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, \"failed to create: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\tb, err := json.MarshalIndent(&t, \"\", \" \")\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tfmt.Fprintf(w, \"failed to marshal: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(b)\n\t})\n\n\tmux.HandleFunc(\"/tasks\", func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\n\t\titer := coll.Query().Get(ctx)\n\t\tdefer iter.Stop()\n\n\t\ttasks := make([]*Task, 0)\n\t\tfor {\n\t\t\tvar t Task\n\t\t\tif err := iter.Next(ctx, &t); err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else if err != nil {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tfmt.Fprintf(w, \"failed to store the next: %s\", err)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\ttasks = append(tasks, &t)\n\t\t\t}\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\terr := json.NewEncoder(w).Encode(&struct {\n\t\t\tTasks []*Task `json:\"tasks\"`\n\t\t}{\n\t\t\tTasks: tasks,\n\t\t})\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Header().Set(\"Content-Type\", \"plain/text\")\n\t\t\tfmt.Fprintf(w, \"failed to encode tasks: %s\", err)\n\t\t}\n\t})\n\n\tmux.HandleFunc(\"/status\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tif err := json.NewEncoder(w).Encode(d.Status()); err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Header().Set(\"Content-Type\", \"plain/text\")\n\t\t\tfmt.Fprintf(w, \"failed to encode status: %s\", err)\n\t\t}\n\t})\n\n\tmux.HandleFunc(\"/open\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != http.MethodPost {\n\t\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\t\treturn\n\t\t}\n\n\t\td.shut = false\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tif err := json.NewEncoder(w).Encode(d.Status()); err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Header().Set(\"Content-Type\", \"plain/text\")\n\t\t\tfmt.Fprintf(w, \"failed to encode status: %s\", err)\n\t\t}\n\t})\n\n\tmux.HandleFunc(\"/shut\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != http.MethodPost {\n\t\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\t\treturn\n\t\t}\n\n\t\td.shut = true\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tif err := json.NewEncoder(w).Encode(d.Status()); err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Header().Set(\"Content-Type\", \"plain/text\")\n\t\t\tfmt.Fprintf(w, \"failed to encode status: %s\", err)\n\t\t}\n\t})\n\n\treturn &http.Server{\n\t\tAddr: addr,\n\t\tHandler: mux,\n\t}\n}", "func New() *Server {\n\ts := &Server{\n\t\thandlers: map[string][]HandlerFunc{},\n\t\tclosing: make(chan struct{}),\n\t\tclosed: make(chan struct{}),\n\t}\n\ts.pool.New = func() interface{} {\n\t\treturn s.allocateContext()\n\t}\n\treturn s\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}", "func NewServer(port int, source TrackSource, sink TrackSink, control PlaybackControl) Server {\n\ts := Server{\n\t\tport: port,\n\t\tsource: source,\n\t\tsink: sink,\n\t\tcontrol: control,\n\t\ttracks: make(chan Track, 0),\n\t}\n\tsource.RegisterTrackOutChan(s.tracks)\n\tsink.RegisterTrackInChan(s.tracks)\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 NewServer(ctx context.Context, cfg execinfra.ServerConfig) *ServerImpl {\n\tds := &ServerImpl{\n\t\tServerConfig: cfg,\n\t\tregexpCache: tree.NewRegexpCache(512),\n\t\tflowRegistry: flowinfra.NewFlowRegistry(cfg.NodeID.SQLInstanceID()),\n\t\tflowScheduler: flowinfra.NewFlowScheduler(cfg.AmbientContext, cfg.Stopper, cfg.Settings, cfg.Metrics),\n\t\tmemMonitor: mon.NewMonitor(\n\t\t\t\"distsql\",\n\t\t\tmon.MemoryResource,\n\t\t\tcfg.Metrics.CurBytesCount,\n\t\t\tcfg.Metrics.MaxBytesHist,\n\t\t\t-1, /* increment: use default block size */\n\t\t\tnoteworthyMemoryUsageBytes,\n\t\t\tcfg.Settings,\n\t\t),\n\t}\n\tds.memMonitor.Start(ctx, cfg.ParentMemoryMonitor, mon.BoundAccount{})\n\n\tcolexec.HashAggregationDiskSpillingEnabled.SetOnChange(&cfg.Settings.SV, func() {\n\t\tif !colexec.HashAggregationDiskSpillingEnabled.Get(&cfg.Settings.SV) {\n\t\t\ttelemetry.Inc(sqltelemetry.HashAggregationDiskSpillingDisabled)\n\t\t}\n\t})\n\n\treturn ds\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 New(addr string) *Server {\n\tsrv := new(Server)\n\tsrv.Context = new(Context)\n\tsrv.Context.Channels = make(map[string]*channel.Channel)\n\tsrv.Address = addr\n\treturn srv\n}" ]
[ "0.6450294", "0.6137566", "0.6124656", "0.60456717", "0.5995859", "0.598988", "0.5989809", "0.598493", "0.5978896", "0.59556425", "0.59531736", "0.5947071", "0.5943734", "0.5936937", "0.5906985", "0.5880917", "0.58790934", "0.5876771", "0.5866584", "0.5829714", "0.5829714", "0.5826772", "0.5818666", "0.5783269", "0.5774967", "0.5773494", "0.5766784", "0.5764091", "0.5755774", "0.5753904", "0.5752077", "0.5738661", "0.57386297", "0.573859", "0.5738088", "0.57234305", "0.5716638", "0.5715846", "0.57091004", "0.5696886", "0.56951785", "0.56837744", "0.5676832", "0.56738114", "0.5671082", "0.56684005", "0.5668001", "0.5667165", "0.5666054", "0.56531376", "0.56480724", "0.5637947", "0.5635429", "0.5624273", "0.560996", "0.5605313", "0.56050706", "0.56022805", "0.5600333", "0.5594661", "0.5585319", "0.55841106", "0.55836236", "0.55819434", "0.5578559", "0.5571297", "0.5565996", "0.556209", "0.5560985", "0.55567384", "0.5552672", "0.55431753", "0.5542422", "0.55357635", "0.55319184", "0.5524567", "0.5522278", "0.5520054", "0.5519474", "0.55157626", "0.551576", "0.5513626", "0.5511277", "0.55065256", "0.5502539", "0.54979587", "0.549396", "0.549376", "0.5491297", "0.54865986", "0.5485627", "0.5470868", "0.5467398", "0.5464148", "0.5463066", "0.5462886", "0.5459466", "0.5456566", "0.54547375", "0.54501975" ]
0.78174824
0
Start starts the server.
func (cs *CollectorServer) Start() { for { conn, err := cs.l.Accept() if err != nil { cs.log().Printf("Accept: %s", err) continue } if cs.Debug { cs.log().Printf("Client %s connected", conn.RemoteAddr()) } go cs.handleConn(conn) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Server) Start() error {\n\ts.logger = s.configureLogger(s.config.LogDebug)\n\n\ts.configureRouter()\n\n\tif err := s.configureStore(); err != nil {\n\t\treturn err\n\t}\n\n\ts.logger.Logf(\"[INFO] Server is starting at %v...\\n\", s.config.BindAddr)\n\n\treturn http.ListenAndServe(s.config.BindAddr, s.router)\n}", "func (s *Server) Start() error {\n\treturn s.e.StartServer(s.httpServer)\n}", "func (s *Server) Start() error {\n\tlog.Printf(\"Hey there! I'm up and running, and can be accessed at: http://localhost:%d\\n\", s.config.AppPort)\n\treturn s.httpServer.ListenAndServe()\n}", "func (s *Server) Start() {\n\tserver := http.Server{\n\t\tAddr: s.Port,\n\t\tHandler: handlers.LoggingHandler(s.Logger, s.Router),\n\t}\n\n\tfmt.Println(\"Running\")\n\tserver.ListenAndServe()\n}", "func (o *HttpServer) Start() error {\n\turi := fmt.Sprintf(\"%s:%d\", o.Host, o.Port)\n\tlog.Printf(\"[HTTP] Server listen on %s\\n\", uri)\n\treturn o.Server.ListenAndServe()\n}", "func (s *Server) Start() {\n\tlog.Infof(\"Starting http server on port %d...\", s.port)\n\n\tgo s.server.ListenAndServe()\n}", "func (s *Server) Start() error {\n\taddress := s.Address\n\tif address == \"\" {\n\t\taddress = \"0.0.0.0\"\n\t}\n\taddr := fmt.Sprintf(\"%s:%d\", address, s.Port)\n\ts.httpServer = &http.Server{\n\t\tAddr: addr,\n\t\tHandler: s.Routes(),\n\t}\n\treturn s.httpServer.ListenAndServe()\n}", "func (s *Server) Start() error {\n\taddress := fmt.Sprintf(\"%s:%d\", s.Config.Host, s.Config.Port)\n\tlog.Infof(\"Listening on %s\", address)\n\treturn s.Router.Start(address)\n}", "func (s *server) Start() error {\n\treturn s.server.ListenAndServe()\n}", "func (s *Server) Start() error {\n\treturn http.ListenAndServe(\":8000\", s.router())\n}", "func (s *Server) Start() error {\n\taddress := fmt.Sprintf(\"%s:%v\", s.config.IP, s.config.Port)\n\tlog.Println(\"Server starting at: \", address)\n\n\treturn http.ListenAndServe(address, s.env.Middleware.Then(s.env.Router.InternalRouter()))\n}", "func (s *Server) Start() error {\n\t// Check if the server is running\n\tif s.IsRunning() {\n\t\treturn errors.New(\"Attempted to start a server that is already running at address: \" + s.instance.Addr)\n\t}\n\n\t// Set routes and middleware\n\ts.SetRoutes()\n\ts.GetInstance().Handler = middleware.NewMiddleware().Then(s.GetInstance().Handler)\n\n\tm := \"Listening for requests...\"\n\tlog.Info(m)\n\n\tgo s.GetInstance().ListenAndServe()\n\n\ts.running = true\n\n\treturn nil\n}", "func (sw *Switcher) Start() {\n\tsw.Server.Start()\n}", "func (s *Server) Start() error {\n\ts.configureRouter()\n\n\t// Another stuff\n\n\ts.logger.Logf(\"INFO Server is starting at port %v...\\n\", s.config.BindAddr)\n\n\treturn http.ListenAndServe(s.config.BindAddr, s.router)\n}", "func (ser *Server) Start() error {\n\tlog.Printf(\"System webapp start at %s\", ser.addr)\n\treturn manners.ListenAndServe(ser.addr, ser.m)\n}", "func (hs *HttpServer) Start() (err error) {\n\tpanic(\"todo - StartServer\")\n\n\t// Start listening to the server port\n\n\t// Accept connection from client\n\n\t// Spawn a go routine to handle request\n\n}", "func (srv *server) Start() {\n\tgo srv.Serve()\n}", "func (s *Server) Start() (err error) {\n\tlog.Infof(\"Starting server in home directory: %s\", s.HomeDir)\n\n\ts.serveError = nil\n\n\tif s.listener != nil {\n\t\treturn errors.New(\"server is already started\")\n\t}\n\n\t// Initialize the server\n\terr = s.init(false)\n\tif err != nil {\n\t\terr2 := s.closeDB()\n\t\tif err2 != nil {\n\t\t\tlog.Errorf(\"Close DB failed: %s\", err2)\n\t\t}\n\t\treturn err\n\t}\n\n\t// Register http handlers\n\ts.registerHandlers()\n\n\tlog.Debugf(\"%d CA instance(s) running on server\", len(s.caMap))\n\n\t// Start operations server\n\terr = s.startOperationsServer()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.Operations.RegisterChecker(\"server\", s)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tfor _, ca := range s.caMap {\n\t\tstartNonceSweeper(ca)\n\t}\n\n\t// Start listening and serving\n\terr = s.listenAndServe()\n\tif err != nil {\n\t\terr2 := s.closeDB()\n\t\tif err2 != nil {\n\t\t\tlog.Errorf(\"Close DB failed: %s\", err2)\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *server) Start() {\n\ts.httpServer = &http.Server{Addr: s.listenAddr}\n\n\tgo func() {\n\t\ts.logger.Printf(\"listening on \\\"%s\\\"\\n\", s.httpServer.Addr)\n\n\t\terr := s.httpServer.ListenAndServe()\n\t\tif err != nil && err != http.ErrServerClosed {\n\t\t\ts.logger.Fatalf(\"could not listen on \\\"%s\\\": %v\\n\", s.httpServer.Addr, err)\n\t\t}\n\n\t\ts.done <- true\n\t}()\n}", "func (ms *MarvinServer) Start() {\n\tgo startWebsockets()\n\n\tlog.Printf(\"Started Marvin HTTP Server on %v:%v\\n\", ms.host, ms.port)\n\trouter := createRouter(ms)\n\thttpError := netHTTP.ListenAndServe(ms.host+\":\"+strconv.Itoa(ms.port), router)\n\n\tif httpError != nil {\n\t\tlog.Fatal(httpError)\n\t\treturn\n\t}\n}", "func (s *Server) Start() {\n\tlog.Println(\"Starting webhook receiver on port 8080...\")\n\terr := http.ListenAndServe(\":8080\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"Couldn't start server: %s\", err)\n\t}\n}", "func (srv *Server) Start() error {\n\treturn srv.app.Listen(srv.config.BindIP + \":\" + strconv.Itoa(srv.config.Port))\n}", "func Start() error {\n\tconfig := DefaultServer.Options()\n\tconfig.Logger.Logf(log.InfoLevel, \"Starting server %s id %s\", config.Name, config.Id)\n\treturn DefaultServer.Start()\n}", "func (app *Application) Start() error {\n\treturn app.Server.Start()\n}", "func (s APIServer) Start() error {\n\treturn nil\n}", "func (s *Server) Start(ctx context.Context, listenPort uint) error {\n\tif err := s.prepare(ctx, listenPort); err != nil {\n\t\treturn err\n\t}\n\n\tif s.enableAPI {\n\t\treturn s.srv.ListenAndServe()\n\t}\n\n\treturn nil\n}", "func (s *HttpServer) Start() error {\n\n\tif err := http.ListenAndServe(s.Config.Host+\":\"+s.Config.HTTPPort, s.ServeMux); err != nil {\n\t\tlog.Error().Err(err).Msg(\"Unable to start http server\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Server) Start() error {\n\treturn http.ListenAndServe(s.listenAddr, s.router)\n}", "func (s *Server) Start() {\n\tlog.Println(\"Starting server...\")\n\n\ts.initContainer()\n\ts.initServer()\n}", "func (s *Server) Start() {\n\tdefer (Track(\"Start\", s.log))()\n\tgo s.listen()\n}", "func (s *WebServer) Start() error {\n\treturn s.ListenAndServe()\n}", "func (m *Manager) Start() error {\n\terr := m.startNorthboundServer()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Start() error {\r\n\tconfig := DefaultServer.Options()\r\n\tlog.Logf(\"Starting server %s id %s\", config.Name, config.Id)\r\n\treturn DefaultServer.Start()\r\n}", "func (s *Server) Start() {\n\tgo func() {\n\t\tlevel.Info(s.logger).Log(\"msg\", \"starting server\", \"addr\", s.server.Addr)\n\t\t// returns ErrServerClosed on graceful close\n\t\tif err := s.server.ListenAndServe(); err != http.ErrServerClosed {\n\t\t\t// NOTE: there is a chance that next line won't have time to run,\n\t\t\t// as main() doesn't wait for this goroutine to stop. don't use\n\t\t\t// code with race conditions like these for production. see post\n\t\t\t// comments below on more discussion on how to handle this.\n\t\t\t// TODO remove this log and return error instead.\n\t\t\tlevel.Error(s.logger).Log(\"msg\", \"ListenAndServe()\", \"err\", err)\n\t\t}\n\t}()\n}", "func (w *Webserver) Start() error {\n\n\t// listenAndServe the server\n\tgo func() {\n\t\tw.logger.Infof(\"Http server listening at %d!\", w.config.Port)\n\t\terr := w.listenAndServe()\n\t\tif err != nil && err != http.ErrServerClosed {\n\t\t\tw.logger.Errorw(fmt.Sprintf(\"webserver listening at port [%v] stopped\", w.config.Port), \"error\", err.Error())\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (s *server) Start() {\n\t// Already started?\n\tif atomic.AddInt32(&s.started, 1) != 1 {\n\t\tlogging.CPrint(logging.INFO, \"started exit\", logging.LogFormat{\"started\": s.started})\n\t\treturn\n\t}\n\n\tlogging.CPrint(logging.TRACE, \"starting server\", logging.LogFormat{})\n\n\t// srvrLog.Trace(\"Starting server\")\n\tlogging.CPrint(logging.INFO, \"begin to start any com\", logging.LogFormat{})\n\n\t// Start SyncManager\n\ts.syncManager.Start()\n\n\ts.wg.Add(1)\n\n}", "func (s *Server) Start() error {\n\tif len(s.srv.Addr) == 0 {\n\t\treturn errors.New(\"server missing address\")\n\t}\n\n\tif s.srv.Handler == nil {\n\t\treturn errors.New(\"server missing handler\")\n\t}\n\n\treturn s.srv.ListenAndServe()\n}", "func (api *API) Start() error {\n\treturn api.Server.Start(fmt.Sprintf(\":%d\", api.config.Port))\n}", "func (s *UAA) Start() {\n\ts.server.Start()\n}", "func (s *Server) Start() {\n\tgo func() {\n\t\tserverLog.Info(\"Starting server on %+v\\n\", s.server.Addr)\n\t\t// returns ErrServerClosed on graceful close\n\t\tif err := s.server.ListenAndServe(); err != http.ErrServerClosed {\n\t\t\t// NOTE: there is a chance that next line won't have time to run,\n\t\t\t// as main() doesn't wait for this goroutine to stop. don't use\n\t\t\t// code with race conditions like these for production. see post\n\t\t\t// comments below on more discussion on how to handle this.\n\t\t\tlog.Fatalf(\"ListenAndServe(): %s\", err)\n\t\t}\n\t}()\n}", "func (s *Server) Start() error {\n\ts.router = configureRouter(s.Config.StaticDir)\n\ts.Logger.Printf(\"serving %v at /static/\", s.Config.StaticDir)\n\ts.httpListener = s.configureHTTPListener()\n\n\tgo func() {\n\t\terr := s.httpListener.ListenAndServe()\n\t\tif err != nil {\n\t\t\t//Normal graceful shutdown error\n\t\t\tif err.Error() == \"http: Server closed\" {\n\t\t\t\ts.Logger.Info(err)\n\t\t\t} else {\n\t\t\t\ts.Logger.Fatal(err)\n\t\t\t}\n\t\t}\n\t}()\n\ts.Logger.Printf(\"listening on %v\", s.Config.Address)\n\treturn nil\n}", "func (s *SimpleServer) Start() {\n\ts.WaitGroup.Add(1)\n\tgo func() {\n\t\tgo s.waitShutdown()\n\t\tlogging.Info(fmt.Sprintf(\"Server is starting on: %s\", fmt.Sprintf(\"http://%s:%d\", config.Host, config.Port)))\n\t\terr := s.ListenAndServe()\n\t\tif err != nil {\n\t\t\tlogging.Errors(fmt.Sprintf(\"Listen and serve: %v\", err))\n\t\t}\n\t}()\n}", "func (ws *Server) Start() {\n\tws.setupServer()\n\tws.addRoutesForControls()\n\tws.addRoutesForStaticFiles()\n\tfmt.Printf(\"Listening on %v...\\n\", ws.server.Addr)\n\tws.server.ListenAndServe()\n}", "func (ts *Server) Start() error {\n\tvar err error\n\tif ts.Handler == nil {\n\t\treturn fmt.Errorf(\"server cannot start; no handler provided\")\n\t}\n\tif ts.Listener == nil && ts.Addr != \"\" {\n\t\tts.Listener, err = net.Listen(\"tcp\", ts.Addr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif ts.Listener == nil {\n\t\treturn fmt.Errorf(\"server cannot start; no listener or addr provided\")\n\t}\n\n\tts.logf(\"trace server listening: %s\", ts.Listener.Addr().String())\n\tts.Server = &http.Server{\n\t\tHandler: ts,\n\t}\n\treturn ts.Server.Serve(ts.Listener)\n}", "func (s *Server) Start() error {\n\tif len(s.srv.Addr) == 0 {\n\t\treturn errors.New(\"Server missing address\")\n\t}\n\n\tif s.srv.Handler == nil {\n\t\treturn errors.New(\"Server missing handler\")\n\t}\n\n\treturn s.srv.ListenAndServe()\n}", "func (s *Server) Start() {\n\tif s.URL != \"\" {\n\t\tpanic(\"Server already started\")\n\t}\n\ts.URL = s.Listener.Addr().String()\n\ts.goServe()\n\tif *serve != \"\" {\n\t\tfmt.Fprintln(os.Stderr, \"grpctest: serving on\", s.URL) // nolint: gas\n\t\tselect {}\n\t}\n}", "func (s *Server) Start() error {\n\thostinfo.SetPackage(\"tsnet\")\n\ts.initOnce.Do(s.doInit)\n\treturn s.initErr\n}", "func (e *Server) Start() {\n\thandleError(e.opts.start(e.ngin))\n}", "func (web *WebServer) Start() {\n\tlog.Println(http.ListenAndServe(web.listen, web.router))\n}", "func (s *Server) Start() {\n\tlog.Printf(\"Listening and serving HTTP on %d\\n\", s.c.Port)\n\tgo func() {\n\t\tif err := s.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\t\tlog.Fatalf(\"ListenAndServe, err: %s\", err.Error())\n\t\t}\n\t}()\n\ts.register()\n}", "func (s *Server) Start() error {\n\treturn s.listenAndServeGRPC()\n}", "func (s *APIServer) Start() error {\n\tif err := s.configurateStore(); err != nil {\n\t\treturn err\n\t}\n\n\thandler := s.configurateRouter()\n\n\treturn http.ListenAndServe(s.config.BindAddr, handler)\n}", "func (ms *ManagerServer) Start() {\n\tms.log.Trace(\"Starting manager server...\")\n\terr := ms.server.ListenAndServeTLS(ms.certPath, ms.keyPath)\n\tif err != nil {\n\t\tms.log.Error(\"Cannot start the server:\", err)\n\t\tos.Exit(1)\n\t}\n}", "func Start() {\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\n\t\tlog.Printf(\"http server started on %s\\n\", server.Server.Addr)\n\t\tif err := server.StartServer(server.Server); err != nil && err != http.ErrServerClosed {\n\t\t\tlog.Fatalf(\"error starting http server: %v\", err)\n\t\t}\n\t\tlog.Println(\"http server stopped\")\n\t}()\n}", "func (s *Envoy) Start() error {\n\terr := s.cmd.Start()\n\tif err == nil {\n\t\turl := fmt.Sprintf(\"http://localhost:%v/server_info\", s.ports.AdminPort)\n\t\tWaitForHTTPServer(url)\n\t\tWaitForPort(s.ports.ClientProxyPort)\n\t\tWaitForPort(s.ports.ServerProxyPort)\n\t\tWaitForPort(s.ports.TCPProxyPort)\n\t}\n\treturn err\n}", "func (hSvr *HTTPServer) Start(_ context.Context) error {\n\tgo func() {\n\t\tif err := hSvr.svr.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\t\tlog.L().Fatal(\"Node failed to serve.\", zap.Error(err))\n\t\t}\n\t}()\n\treturn nil\n}", "func (server *TempestServer) Start() {\n\tif server.running {\n\t\treturn\n\t}\n\n\tserver.running = true\n\n\tserver.serverWaitGroup.Add(1)\n\tgo server.startServer()\n\tserver.serverWaitGroup.Wait()\n}", "func (a *API) Start() error {\n\ta.Server = &http.Server{\n\t\tAddr: a.Config.BindAddress,\n\t\tHandler: a.Gin,\n\t}\n\treturn a.Server.ListenAndServe()\n}", "func Start(\n\tctx context.Context,\n\tconfig *Config,\n) (*Server, error) {\n\ts, err := Prepare(config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"prepare server\")\n\t}\n\n\tif err := Enable(ctx, config, s.Router); err != nil {\n\t\treturn nil, errors.Wrap(err, \"enable server\")\n\t}\n\n\tif err := s.Start(ctx); err != nil {\n\t\treturn nil, errors.Wrap(err, \"start server\")\n\t}\n\n\treturn s, nil\n}", "func (s *server) Start(stop <-chan struct{}) error {\n\tlistener, err := newListener(s.bindAddress)\n\tif err != nil {\n\t\treturn err\n\t}\n\tserver := http.Server{\n\t\tHandler: s.mux,\n\t}\n\t// Run the server\n\tgo func() {\n\t\tlog.Info(\"starting http server\")\n\t\tif err := server.Serve(listener); err != nil && err != http.ErrServerClosed {\n\t\t\tlog.Error(err, \"http server error\")\n\t\t}\n\t}()\n\n\t// Shutdown the server when stop is close\n\t<-stop\n\treturn server.Shutdown(context.Background())\n}", "func (s *Server) Start() error {\n\ts.RegisterHTTPHandlers()\n\tlog.Print(fmt.Sprintf(\"Listening HTTP on: %s\", s.url))\n\n\thandler := CORSWrap(s.router)\n\treturn http.ListenAndServe(s.url, handler)\n}", "func (server *Server) Start() {\n\tr := mux.NewRouter()\n\tserver.registerRoutes(r)\n\n\thttp.Handle(\"/\", r)\n\tlogger.Info(\"HTTP server is starting using port: %v\", server.Config.Port)\n\thttp.ListenAndServe(server.port(), nil)\n}", "func (s *Server) Start() {\n\tlog.Println(\"Web server started at \" + s.configurationService.Address())\n\tlog.Fatal(http.ListenAndServe(s.configurationService.Address(), s.router()))\n}", "func (s *Server) Start() (err error) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\terr = errors.New(fmt.Sprintf(\"%v\", err))\n\t\t}\n\t}()\n\tseedServer, err := service.NewCdnSeedServer(s.Config, s.TaskMgr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create seedServer fail\")\n\t}\n\t// start gc\n\ts.GCMgr.StartGC(context.Background())\n\terr = rpc.StartTcpServer(s.Config.ListenPort, s.Config.ListenPort, seedServer)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to start tcp server\")\n\t}\n\treturn nil\n}", "func (s *APIServer) Start() error {\n\ts.logger.Infof(\"Starting api server. Port %s \", s.address)\n\ts.registerRouters()\n\treturn http.ListenAndServe(s.address, s.router)\n}", "func (s *service) Start() error {\n\tservice := &http.Server{Addr: s.host, Handler: s.mux}\n\n\treturn service.ListenAndServe()\n}", "func (srv *MonitorServer) Start() {\n\terr := srv.ListenAndServe()\n\tif err != nil {\n\t\tlog.Logger.Error(\"MonitorServer.Start():err in http.ListenAndServe():%s\", err.Error())\n\t\tabnormalExit()\n\t}\n}", "func (s *Server) Start(ctx context.Context) error {\n\tif s.ln != nil {\n\t\treturn errors.Reason(\"cannot call Start twice\").Err()\n\t}\n\tln, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", s.cfg.Port))\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.ln = ln\n\n\t_, port, err := net.SplitHostPort(s.ln.Addr().String())\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.cfg.Port, err = strconv.Atoi(port)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, s.cancel = context.WithCancel(ctx)\n\tgo s.serveLoop(ctx)\n\treturn nil\n}", "func (s *GardenServer) Start() error {\n\tif err := s.backend.Start(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.SetupBomberman(); err != nil {\n\t\treturn err\n\t}\n\n\tlistener, err := s.Listen()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo s.server.Serve(listener)\n\n\treturn nil\n}", "func (server *Server) Start() {\n\tmux := http.NewServeMux()\n\n\tfileServer := server.attachStaticFileServer(mux)\n\tserver.attachSystemJSRewriteHandler(mux)\n\tserver.attachCustomHandlers(mux)\n\n\tif server.hub != nil {\n\t\t// add HMR support\n\t\tserver.attachIndexInjectionListener(mux, fileServer)\n\t\tserver.attachWebSocketListeners(mux, server.hub)\n\t\tgo server.hub.run()\n\t}\n\n\tserver.srv = &http.Server{\n\t\tAddr: makeServerAddress(server.port),\n\t\tHandler: mux,\n\t}\n\n\tif err := server.srv.ListenAndServe(); err != nil {\n\t\tpanic(err)\n\t}\n}", "func Start(address string) error {\n\terr := applicationServer.Start(address)\n\treturn err\n}", "func (s ServerHTTP) Start(c *cli.Context) error {\n\tcfgFile := c.Args().First()\n\n\tvar config = &server.Config{}\n\t_, err := toml.DecodeFile(cfgFile, config)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tsrv, err := server.Start(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.server = srv\n\treturn nil\n}", "func (server Server) Start(addr string) error {\n\treturn server.router.Run(addr)\n}", "func (s *Server) Start() error {\n\t// return if already started\n\tif s.listener != nil {\n\t\treturn nil\n\t}\n\n\thttp.HandleFunc(\"/health\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, \"OK\")\n\t})\n\n\thttp.Handle(\"/\", registry.New(&registry.Config{\n\t\tIPFSHost: s.ipfsHost,\n\t\tIPFSGateway: s.ipfsGateway,\n\t\tCIDResolvers: s.cidResolvers,\n\t\tCIDStorePath: s.cidStorePath,\n\t}))\n\n\tvar err error\n\ts.listener, err = net.Listen(\"tcp\", s.host)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.Debugf(\"[registry/server] listening on %s\", s.listener.Addr())\n\tif s.tlsKeyPath != \"\" && s.tlsCertPath != \"\" {\n\t\treturn http.ServeTLS(s.listener, nil, s.tlsCertPath, s.tlsKeyPath)\n\t}\n\n\treturn http.Serve(s.listener, nil)\n}", "func (srv *Server) Start() error {\n\terrg := errgroup.Group{}\n\tif srv.Config.Stats != nil {\n\t\terrg.Go(func() error {\n\t\t\treturn srv.Config.Stats.Start()\n\t\t})\n\t}\n\terrg.Go(func() error {\n\t\treturn srv.http.Start()\n\t})\n\terrg.Go(func() error {\n\t\treturn srv.ssh.Start()\n\t})\n\treturn errg.Wait()\n}", "func (c *CartServer) Start() error {\n\trouter := c.InitializeHandler()\n\thttp.Handle(\"/\", router)\n\tc.printStartMsg()\n\n\treturn http.ListenAndServe(fmt.Sprintf(\":%d\", c.config.Port), nil)\n}", "func (ds *dserver) Start() error {\n\tvar cfg *config.Config\n\tif err := ds.cont.Invoke(func(c *config.Config) { cfg = c }); err != nil {\n\t\treturn err\n\t}\n\treturn ds.router.Run(fmt.Sprintf(\":%s\", cfg.Port))\n}", "func (as *apiServer) Start() error {\n\treturn as.server.ListenAndServe()\n}", "func (s *Server) Start() error {\n\tif s.Handler == nil {\n\t\treturn errors.New(\"No server handler set\")\n\t}\n\n\tif s.listener != nil {\n\t\treturn errors.New(\"Server already started\")\n\t}\n\n\taddr := s.Addr\n\tif addr == \"\" {\n\t\taddr = \":http\"\n\t}\n\n\tlistener, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thostname, _ := os.Hostname()\n\ts.serverInstanceID = fmt.Sprintf(\"%x\", md5.Sum([]byte(hostname+addr)))\n\n\ts.listener = listener\n\ts.serverGroup = &sync.WaitGroup{}\n\ts.clientsGroup = make(chan bool, 50000)\n\ts.Handler = &serverHandler{s.Handler, s.clientsGroup, s.serverInstanceID}\n\n\ts.serverGroup.Add(1)\n\tgo func() {\n\t\tdefer s.serverGroup.Done()\n\n\t\terr := s.Serve(listener)\n\t\tif err != nil {\n\t\t\tif strings.Contains(err.Error(), \"use of closed network connection\") {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ts.lastError = err\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (hs *HttpServer) Start() (err error) {\n\t//panic(\"todo - StartServer\")\n\n\t// Start listening to the server port\n\n\t// Accept connection from client\n\n\t// Spawn a go routine to handle request\n\tport := hs.ServerPort\n\thost := \"0.0.0.0\"\n\t//delim := \"/r/n\"\n\tln, err := net.Listen(\"tcp\", host+port)\n\tdefer ln.Close()\n\tif err != nil {\n\t\tlog.Panicln(err)\n\t}\n\tlog.Println(\"Listening to connections at '\"+host+\"' on port\", port)\n\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil{\n\t\t\tlog.Panicln(err)\n\t\t}\n\t\t\n\t\tgo hs.handleConnection(conn)\n\t}\n\n\treturn err\n\n\n}", "func (s *Server) Start() {\n\ts.wrap()\n\n\tgo func() {\n\t\ts.Config.Serve(s.Listener)\n\t}()\n}", "func (s *Server) Start() {\n\tlog.Infof(\"listening at %s\", s.Server.Addr)\n\tif err := s.ListenAndServeTLS(\"\", \"\"); err != nil {\n\t\tif errors.Is(err, http.ErrServerClosed) {\n\t\t\treturn\n\t\t}\n\t\tlog.Fatal(err)\n\t}\n}", "func (rs *RpcServer) Start() {\n\tif err := rs.server.Start(rs.register); err != nil {\n\t\tlogx.Error(err)\n\t\tpanic(err)\n\t}\n}", "func (s *Server) Start(ctx context.Context) error {\n\tif err := s.listenAndEndpoint(); err != nil {\n\t\treturn err\n\t}\n\ts.BaseContext = func(net.Listener) context.Context {\n\t\treturn ctx\n\t}\n\tlog.Infof(\"[HTTP] server listening on: %s\", s.lis.Addr().String())\n\tvar err error\n\tif s.tlsConf != nil {\n\t\terr = s.ServeTLS(s.lis, \"\", \"\")\n\t} else {\n\t\terr = s.Serve(s.lis)\n\t}\n\tif !errors.Is(err, http.ErrServerClosed) {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Start() {\n\twebServer.Engine.Run(\":\" + strconv.Itoa(cfg.Read().App.WebServerPort))\n}", "func (w *WebServer) Start() {\n\tw.start()\n}", "func Start() error {\n\treturn e.Start(fmt.Sprintf(\"%s:%d\", defaultListenAddr, cfg.Port()))\n}", "func (a *Server) Start(ctx context.Context) {\n\ta.log.Infof(\"starting tap API server on %s\", a.Server.Addr)\n\tif err := a.ServeTLS(a.listener, \"\", \"\"); err != nil {\n\t\tif errors.Is(err, http.ErrServerClosed) {\n\t\t\treturn\n\t\t}\n\t\ta.log.Fatal(err)\n\t}\n}", "func (r *RPCServer) Start() (err error) {\n\t// register the shared methods\n\trpc.Register(&shared.Handler{\n\t\tStore: r.store,\n\t})\n\n\tlog.Print(\"Starting RPC server on port: \", r.port)\n\tr.listener, err = net.Listen(\"tcp\", r.port)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trpc.Accept(r.listener)\n\n\treturn\n}", "func Start(c *cli.Context) error {\n\tport := c.String(\"port\")\n\thttp.Handle(\"/\", &socketHandler{apiKey: c.String(\"api-key\")})\n\terr := http.ListenAndServe(port, nil)\n\tlog.Errorf(\"HTTP SERVER: %v\", err.Error())\n\treturn err\n\n}", "func (srv Web) Start() error {\n\tfmt.Printf(\"Starting service on port %s\\n\", srv.Settings.Port)\n\treturn http.ListenAndServe(srv.Settings.Port, srv.Router())\n}", "func (s *Server) Start() {\n\tif s.State() != Init {\n\t\ts.log.Errorf(\"server is not in a valid state, want: %q have: %q\", \"NEW\", s.State().String())\n\t\treturn\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"grpc-address\": s.Address(),\n\t\t\"http-address\": s.HTTPAddress(),\n\t}).Infof(\"server starting\")\n\n\tgo s.handleSignals()\n\n\ts.changeState(Starting)\n\n\tgo func() {\n\t\tif err := s.transport.Serve(s.listener); err != nil {\n\t\t\ts.appendErr(err)\n\t\t\ts.changeState(Error)\n\t\t}\n\t}()\n\tif s.httpTransport != nil {\n\t\tgo func() {\n\t\t\tif err := s.httpTransport.Serve(s.httpListener); err != nil {\n\t\t\t\ts.appendErr(err)\n\t\t\t\ts.changeState(Error)\n\t\t\t}\n\t\t}()\n\t}\n}", "func (serv *Server) Start() {\n\tfmt.Printf(\"Starting to listen for events...\\n\")\n\t//Listen in the background\n\tgo serv.listen()\n}", "func (svr *Server) Start(ctx context.Context) error {\n\tsrv := &http.Server{Addr: svr.addr, Handler: svr.mux}\n\tgo func() {\n\t\t<-ctx.Done()\n\t\t// We received an interrupt signal, shut down.\n\t\tif err := srv.Shutdown(context.Background()); err != nil {\n\t\t\tsvr.log.Error(\"shutting down HTTP server\", zap.Error(err))\n\t\t}\n\t}()\n\n\tsvr.log.Info(\"Starting HTTP server\", zap.String(\"addr\", svr.addr))\n\tif err := srv.ListenAndServe(); err != http.ErrServerClosed {\n\t\treturn errors.Wrap(err, \"while starting HTTP server\")\n\t}\n\n\treturn nil\n}", "func (s *Server) Start(host string, port string) error {\n\treturn s.router.Start(fmt.Sprintf(\"%s:%s\", host, port))\n}", "func Start(ls *lockservice.SimpleLockService, scfg lockservice.SimpleConfig) error {\n\n\tIP := scfg.IP()\n\tIP = strings.TrimPrefix(IP, \"http://\")\n\tport := scfg.Port()\n\n\tif err := checkValidPort(port); err != nil {\n\t\treturn err\n\t}\n\n\trouter := mux.NewRouter()\n\n\trouter = routing.SetupRouting(ls, router)\n\n\tserver := &http.Server{\n\t\tHandler: router,\n\t\tAddr: IP + \":\" + port,\n\t}\n\n\tgo gracefulShutdown(server)\n\n\tlog.Println(\"Starting Server on \" + IP + \":\" + port)\n\treturn server.ListenAndServe()\n}", "func (s *Server) Start() error {\n\terr := predis.WaitForConnection(s.p)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not connect to redis\")\n\t}\n\treturn errors.Wrap(s.srv.ListenAndServe(), \"error starting the server\")\n}", "func (s *Service) Start() error {\n\tl, err := net.Listen(\"tcp\", s.addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn s.s.Serve(l)\n}", "func (m *Server) Start() error {\n\tgo func() {\n\t\tif err := http.Serve(m.Listener, m); err != http.ErrServerClosed {\n\t\t\tlog.Printf(\"Unable to listen and serve: %v\", err)\n\t\t}\n\t}()\n\treturn nil\n}", "func (s *Server) Start() error {\n\terr := predis.WaitForConnection(s.pool)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not connect to redis\")\n\t}\n\n\ts.cs, err = kube.ClientSet()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not connect to kubernetes api\")\n\t}\n\n\treturn errors.Wrap(s.srv.ListenAndServe(), \"Error starting server\")\n}", "func (s *Server) Start() error {\n\ts.ctx, s.cancel = context.WithCancel(context.Background())\n\ts.restStarted = &sync.WaitGroup{}\n\ts.restStopped = &sync.WaitGroup{}\n\ts.grpcStopped = &sync.WaitGroup{}\n\ts.grpcStarted = &sync.WaitGroup{}\n\n\t// Start the service\n\ts.service = service.NewService(s.ctx, s.cancel)\n\n\t// Start gRPC interface\n\ts.grpcStarted.Add(1)\n\ts.grpcStopped.Add(1)\n\ts.startGRPC()\n\ts.grpcStarted.Wait()\n\n\t// REST interface\n\tif s.restAddr != \"\" {\n\t\ts.restStarted.Add(1)\n\t\ts.restStopped.Add(1)\n\t\ts.startREST()\n\t\ts.restStarted.Wait()\n\t} else {\n\t\tlog.Printf(\"Skipping REST interface (no listen address given)\")\n\t}\n\n\treturn nil\n}" ]
[ "0.80488575", "0.8009313", "0.79481596", "0.794424", "0.7928491", "0.7914126", "0.7882072", "0.7867788", "0.7858528", "0.7816456", "0.7776155", "0.7773969", "0.7755403", "0.775531", "0.77436584", "0.7737684", "0.76871955", "0.767836", "0.7669713", "0.7668373", "0.7663645", "0.7650778", "0.7649189", "0.76415724", "0.7632041", "0.76319873", "0.7624881", "0.76219237", "0.7595022", "0.75947976", "0.75898075", "0.7569206", "0.75621575", "0.75615656", "0.75395346", "0.7521662", "0.7516027", "0.75129336", "0.75098157", "0.7507649", "0.75074625", "0.75055635", "0.7502008", "0.7492939", "0.7488664", "0.7471182", "0.74680316", "0.74673164", "0.7465287", "0.7464999", "0.74517196", "0.7451161", "0.7436425", "0.7435223", "0.74274975", "0.74223894", "0.741208", "0.7411624", "0.7410485", "0.74050057", "0.7399447", "0.7382446", "0.73781174", "0.73713666", "0.7370437", "0.7369406", "0.7359929", "0.7352711", "0.73518187", "0.7349805", "0.7340579", "0.7331577", "0.7328939", "0.7320422", "0.73110217", "0.730862", "0.7303988", "0.7300229", "0.72943765", "0.72873133", "0.7286149", "0.7282854", "0.72825325", "0.72776824", "0.7276888", "0.72687435", "0.72595555", "0.72469974", "0.7245959", "0.7233618", "0.723361", "0.7232424", "0.72300863", "0.7226765", "0.72243655", "0.7224284", "0.7221754", "0.72116977", "0.7210046", "0.71861005", "0.7180648" ]
0.0
-1
JSON prettyprints a JSON response
func JSON(response []byte) { // pretty-print the json utils.PrintJSON(response) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *Response) pretty() string {\n\n\tvar body api.Response\n\t_ = json.Unmarshal(r.recorder.Body.Bytes(), &body)\n\n\tlr := LogResponse{Res{\n\t\tCode: r.recorder.Code,\n\t\tHeaders: r.recorder.Header(),\n\t\tBody: body,\n\t}}\n\tres, err := json.MarshalIndent(lr, \"\", \" \")\n\tgomega.Expect(err).To(gomega.BeNil())\n\treturn string(res)\n}", "func (r Result) PrettyPrintJSON() string {\n\tpretty, err := json.MarshalIndent(r.Body, \"\", \" \")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn string(pretty)\n}", "func jsonPrettyPrint(in string) string {\r\n var out bytes.Buffer\r\n err := json.Indent(&out, []byte(in), \"\", \"\\t\")\r\n if err != nil {\r\n return in\r\n }\r\n return out.String()\r\n}", "func prettyJSON(b []byte) []byte {\n\tvar out bytes.Buffer\n\terr := json.Indent(&out, b, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn b\n\t}\n\treturn out.Bytes()\n}", "func PrettyPrintJSON(b []byte) ([]byte, error) {\n\tvar out bytes.Buffer\n\terr := json.Indent(&out, b, \"\", \" \")\n\treturn out.Bytes(), err\n}", "func prettyprint(b []byte) ([]byte, error) {\n\tvar out bytes.Buffer\n\terr := json.Indent(&out, b, \"\", \" \")\n\treturn out.Bytes(), err\n}", "func ReturnPrettyJSON(w http.ResponseWriter, statusCode int, data interface{}) error {\n\tjson, err := PrettyPrintJSON(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.WriteHeader(statusCode)\n\t_, err = w.Write([]byte(json))\n\treturn err\n}", "func PrettyPrintJSON(data interface{}) (string, error) {\n\tbytes, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(bytes), nil\n}", "func PrettyPrintJSON(jsonStr string) {\n\n\tfmt.Println(PrettyJSON(jsonStr))\n\n}", "func PrettyPrintJSON(data interface{}) (string, error) {\n\toutput := &bytes.Buffer{}\n\tif err := json.NewEncoder(output).Encode(data); err != nil {\n\t\treturn \"\", fmt.Errorf(\"building encoder error: %v\", err)\n\t}\n\tformatted := &bytes.Buffer{}\n\tif err := json.Indent(formatted, output.Bytes(), \"\", \" \"); err != nil {\n\t\treturn \"\", fmt.Errorf(\"indenting error: %v\", err)\n\t}\n\treturn string(formatted.Bytes()), nil\n}", "func prettyprint(b []byte) []byte {\n\tvar out bytes.Buffer\n\tjson.Indent(&out, b, \"\", \" \")\n\treturn out.Bytes()\n}", "func Pretty(j JSON) (string, error) {\n\tasGo, err := j.toGoRepr()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Luckily for us, despite Go's random map ordering, MarshalIndent sorts the\n\t// keys of objects.\n\tres, err := json.MarshalIndent(asGo, \"\", \" \")\n\treturn string(res), err\n}", "func jsonPrint(w http.ResponseWriter, out []string) {\n\tjsondat := &myJSON{Array: out}\n\tencjson, _ := json.Marshal(jsondat)\n\tfmt.Fprintf(w, \"%q\", string(encjson))\n}", "func (g *GoCrypt) PrettyJson(v interface{}) string {\n\toutput, _ := json.MarshalIndent(v, \"\", \" \")\n\treturn string(output)\n}", "func jsonPrint(posts Posts) {\n\tpostJSON, err := json.MarshalIndent(posts, \"\", \" \")\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"JSON data: \\n %s\\n\", string(postJSON))\n}", "func Pretty(data interface{}) {\n\tb, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfmt.Println(string(b))\n}", "func Pretty(data interface{}) {\n\tb, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tfmt.Println(string(b))\n}", "func (a Authorization) PrettyPrint() string {\n\tbs, err := json.MarshalIndent(a, \"\", \" \")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(bs)\n}", "func toPrettyJson(v interface{}) string {\n\toutput, _ := json.MarshalIndent(v, \"\", \" \")\n\treturn string(output)\n}", "func PrintPrettyJSON(input map[string]interface{}) {\n\tout, err := json.MarshalIndent(input, \"\", \"\\t\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Error indenting JSON: %v\", err)\n\t}\n\tfmt.Println(string(out))\n}", "func TestPrettyJSON(t *testing.T) {\n\tresults, err := PrettyJSON(jsonSample)\n\tif err != nil {\n\t\tt.Errorf(\"Properly formatted JSON failed to be made pretty: %s\", jsonSample)\n\t}\n\tcheckResultContains(t, results, \" \\\"error\\\": {\")\n\tcheckResultContains(t, results, \" \\\"message\\\": \")\n}", "func PrettyPrintJSON(metrics interface{}) string {\n\toutput := &bytes.Buffer{}\n\tif err := json.NewEncoder(output).Encode(metrics); err != nil {\n\t\tLogf(\"Error building encoder: %v\", err)\n\t\treturn \"\"\n\t}\n\tformatted := &bytes.Buffer{}\n\tif err := json.Indent(formatted, output.Bytes(), \"\", \" \"); err != nil {\n\t\tLogf(\"Error indenting: %v\", err)\n\t\treturn \"\"\n\t}\n\treturn formatted.String()\n}", "func JSON(w http.ResponseWriter, data interface{}) {\n\tresponse, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Println(\"Failed to generate json \")\n\t}\n\tfmt.Fprint(w, string(response))\n}", "func JSONResponse(w http.ResponseWriter, d interface{}, c int) {\n\tdj, err := json.MarshalIndent(d, \"\", \" \")\n\tif err != nil {\n\t\thttp.Error(w, \"Error creating JSON response\", http.StatusInternalServerError)\n\t\tlog.Error(err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(c)\n\tfmt.Fprintf(w, \"%s\", dj)\n}", "func prettyJSON(input string) string {\n\tvar output bytes.Buffer\n\terr := json.Indent(&output, []byte(input), \"\", \"\\t\")\n\tif err != nil {\n\t\thandleWarning(\"failed to make json pretty, sorry.\")\n\t\treturn input\n\t}\n\treturn output.String()\n}", "func json_prettyprint(in []byte, prefix string, indent string) string {\n\tvar out bytes.Buffer\n\tpretty_err := json.Indent(&out, in, prefix, indent)\n\tif pretty_err != nil {\n\t\treturn \"(pretty-printing error)\"\n\t}\n\treturn string(out.Bytes())\n}", "func (j JSONResponse) String() string {\n\tstr, err := json.MarshalIndent(j, \"\", \" \")\n\tif err != nil {\n\t\treturn fmt.Sprintf(`{\n \"error\": \"%v\"\n}`, err)\n\t}\n\n\treturn string(str)\n}", "func prettyPrint(src []byte) (string, error) {\n\tvar dst bytes.Buffer\n\terr := json.Indent(&dst, src, \"\", \" \")\n\tif nil != err {\n\t\treturn \"\", err\n\t}\n\treturn dst.String(), nil\n}", "func JSON(c *gin.Context, response gin.H) {\n\tc.JSON(http.StatusOK, response)\n}", "func PrettyPrint(x interface{}) {\n\tb, err := json.MarshalIndent(x, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t}\n\tfmt.Println(string(b))\n}", "func toPrettyJSON(v interface{}) string {\n\toutput, _ := json.MarshalIndent(v, \"\", \" \")\n\treturn string(output)\n}", "func Pretty(v interface{}) (string, error) {\n\tout, err := json.MarshalIndent(v, \"\", \" \")\n\treturn string(out), err\n}", "func PrettyPrint(in string) string {\n\tvar out bytes.Buffer\n\terr := json.Indent(&out, []byte(in), \"\", \"\\t\")\n\tif err != nil {\n\t\treturn in\n\t}\n\treturn out.String()\n}", "func PrettyPrint(val interface{}) {\n\to, e := json.MarshalIndent(val, \"\", \" \")\n\tif e != nil {\n\t\tlog.Panic(e.Error())\n\t}\n\tfmt.Printf(string(o))\n\tfmt.Println()\n}", "func (r Result) JSON(w io.Writer) error {\n\tenc := json.NewEncoder(w)\n\tenc.SetIndent(\"\", \" \")\n\tenc.SetEscapeHTML(false)\n\treturn enc.Encode(r)\n}", "func resultHandler(res []byte) {\n\tresult := prettyJSON(string(res))\n\tfmt.Printf(result)\n}", "func (cli *CLI) PrintJSON(v interface{}) int {\n\tvar res slackapi.Response\n\n\tout, err := json.MarshalIndent(v, \"\", \"\\x20\\x20\")\n\n\tif err != nil {\n\t\tfmt.Printf(\"{\\\"ok\\\":false, \\\"error\\\":\\\"json.encode; %s\\\"}\\n\", err.Error())\n\t\treturn 1\n\t}\n\n\tif err := json.NewDecoder(bytes.NewReader(out)).Decode(&res); err != nil {\n\t\tfmt.Printf(\"{\\\"ok\\\":false, \\\"error\\\":\\\"json.decode; %s\\\"}\\n\", err.Error())\n\t\treturn 1\n\t}\n\n\tif !res.Ok && res.Error != \"\" {\n\t\tif err := json.NewEncoder(os.Stdout).Encode(res); err != nil {\n\t\t\tlog.Fatalln(\"json.encode;\", err)\n\t\t}\n\n\t\treturn 1\n\t}\n\n\tfmt.Printf(\"%s\\n\", out)\n\treturn 0\n}", "func jsonPrintUser(w http.ResponseWriter, out []userInfo) {\n\tjsondat := &myJSONUser{Array: out}\n\tencjson, _ := json.Marshal(jsondat)\n\tfmt.Fprintf(w, \"%q\", string(encjson))\n}", "func PrettyPrint(v interface{}) {\n\tb, _ := json.MarshalIndent(v, \"\", \" \")\n\tprintln(string(b))\n}", "func FormatResponse(o interface{}) string {\n\tout, err := json.MarshalIndent(o, \"\", \"\\t\")\n\tMust(err, `Command failed because an error occurred while prettifying output: %s`, err)\n\treturn string(out)\n}", "func PrettyPint(v interface{}) (err error) {\n\tb, err := json.MarshalIndent(v, \"\", \" \")\n\tif err == nil {\n\t\tfmt.Println(string(b))\n\t}\n\treturn\n}", "func prettyPrint(data interface{}) {\n\tvar p []byte\n\t// var err := error\n\tp, err := json.MarshalIndent(data, \"\", \"\\t\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Printf(\"%s \\n\", p)\n}", "func JSON(w http.ResponseWriter, d interface{}) {\n\tJSONWithHTTPCode(w, d, http.StatusOK)\n}", "func JSON(w http.ResponseWriter, d interface{}) {\n\tJSONWithHTTPCode(w, d, http.StatusOK)\n}", "func jsonResponse(w http.ResponseWriter, d interface{}, c int) {\n\tdj, err := json.Marshal(d)\n\tif err != nil {\n\t\thttp.Error(w, \"Error creating JSON response\", http.StatusInternalServerError)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(c)\n\tfmt.Fprintf(w, \"%s\", dj)\n}", "func PrettyPrint(v interface{}, prefix string, indent string) (string, error) {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to marshal\")\n\t}\n\n\tvar out bytes.Buffer\n\tif err := json.Indent(&out, b, prefix, indent); err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to indent\")\n\t}\n\n\tif _, err := out.WriteString(\"\\n\"); err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to write string\")\n\t}\n\n\treturn out.String(), nil\n}", "func JSONString(response string) {\n\t// pretty-print the json\n\tutils.PrintJSON([]byte(response))\n}", "func PPrintJSON(xx interface{}) {\n\tyy, _ := json.MarshalIndent(xx, \"\", \" \")\n\tlog.Println(string(yy))\n}", "func ToPrettyJson(v interface{}) []byte {\n\toutput, _ := json.MarshalIndent(v, \"\", \" \")\n\treturn output\n}", "func PrettyReport(v interface{}) string {\n\tb, err := json.MarshalIndent(v, \"\", \" \")\n\tif err == nil {\n\t\treturn string(b)\n\t}\n\treturn \"\"\n}", "func PrettyPrint(model interface{}) {\n\tbytes, _ := json.MarshalIndent(model, \"\", \" \")\n\tfmt.Println(string(bytes))\n}", "func JSON(w http.ResponseWriter, i interface{}, status int) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\tif i != nil {\n\t\tif err := (render.JSONRender{Data: i}.Render(w)); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func RenderJSON(r Response) {\n\tj, err := json.Marshal(r.Data)\n\n\tif err != nil {\n\t\tr.Logger.ErrorD(\"Error marshalling repsonse data\", log.Fields{\"err\": err.Error()})\n\n\t\tr.Writer.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif r.Status > 0 {\n\t\tr.Writer.WriteHeader(r.Status)\n\t}\n\n\tr.Writer.Header().Set(\"Content-Type\", \"application/json\")\n\n\tr.Writer.Write(j)\n}", "func writeJSON(w http.ResponseWriter, o interface{}) {\n\tw.WriteHeader(http.StatusOK)\n\te := json.NewEncoder(w)\n\te.SetIndent(\"\", \"\\t\")\n\te.Encode(o)\n}", "func RespJSON(w http.ResponseWriter, r models.Response) {\n\tb, err := json.Marshal(r)\n\tif err != nil {\n\t\tlog.Println(err, r)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(b)\n}", "func JSONResponse(w http.ResponseWriter, d interface{}, statusCode int) {\n\tjson, err := json.Marshal(d)\n\tif err != nil {\n\t\tlog.Printf(\"WebAuthNController: Error serializing response to JSON: %s\", err.Error())\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(statusCode)\n\tfmt.Fprintf(w, \"%s\", json)\n}", "func dumpJSON(o interface{}) error {\n\tjs, err := json.MarshalIndent(o, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"```\\n%s\\n```\\n\\n\", js)\n\n\treturn nil\n}", "func jzbToJsonPretty(jzb string) {\n\tjzb = convertToUrlSafe(jzb)\n\tvar orig interface{}\n\tif err := FromJzb(jzb, &orig); err != nil {\n\t\tfmt.Printf(\"jzbToJson (pretty) err = %v\\n\", err)\n\t} else {\n\t\tj, _ := json.Marshal(orig)\n\t\tresult := pretty.Pretty(j)\n\t\t// fmt.Printf(\"\\nJZB : %s\\n\", jzb)\n\t\tfmt.Printf(\"%s\\n\", result)\n\t}\n}", "func (c *Response) ServeJSON(w http.ResponseWriter, r *http.Request) {\n\n\tdefer func() {\n\t\tb, err := json.Marshal(c.Body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"helpers: could not json marshal: %s\", err.Error())\n\t\t}\n\t\t_, err = w.Write(b)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"helpers: could not write: %s\", err.Error())\n\t\t}\n\t}()\n\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tc.Body.Href = r.RequestURI\n\n\tif c.Err != nil {\n\t\tc.Body.StatusMessage = \"Error\"\n\t\tc.Body.Description = c.Err.Error()\n\t\tc.Body.StatusCode = 400\n\t\tw.WriteHeader(400)\n\t} else {\n\t\tc.Body.StatusMessage = \"Success\"\n\t\tc.Body.StatusCode = 200\n\t\tc.Body.Limit = 10\n\n\t\tif v := r.URL.Query().Get(\"offset\"); v != \"\" {\n\t\t\tvInt, err := strconv.Atoi(v)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tc.Body.Offset = int64(vInt)\n\t\t}\n\t\tif v := r.URL.Query().Get(\"limit\"); v != \"\" {\n\t\t\tvInt, err := strconv.Atoi(v)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tc.Body.Limit = int64(vInt)\n\t\t}\n\t}\n}", "func printJSON(v interface{}) {\n\tprintf(\"%v\\n\", util.FormatJSON(v))\n}", "func JSON(w http.ResponseWriter, statusCode int, obj interface{}) error {\n\tw.WriteHeader(statusCode)\n\twriteContentType(w, jsonContentType)\n\treturn json.NewEncoder(w).Encode(obj)\n}", "func jsonPrintDetails() {\n\n\tb, err := json.Marshal(alertDetails[name])\n\n\tif err != nil {\n\t\tlog.Printf(\"Unable to convert Detailed JSON Data, error: %v\\n\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(string(b))\n}", "func print_json(chunks []Chunk) {\n\tfmt.Println(\"{\")\n\tfor i := range chunks {\n\t\tpayload := chunks[i].payload\n\t\ttag := chunks[i].tag\n\t\tif i > 0 {\n\t\t\tfmt.Println(\",\")\n\t\t}\n\t\tfmt.Printf(\" \\\"%s\\\": \\\"%s\\\"\", tag, payload)\n\t}\n\tfmt.Printf(\"\\n}\\n\")\n}", "func ToPrettyJsonString(v interface{}) string {\n\toutput, _ := json.MarshalIndent(v, \"\", \" \")\n\treturn string(output)\n}", "func printResponse(resp interface{}, err error) {\n\tif err == nil {\n\t\tjtext, err := json.MarshalIndent(resp, \"\", \" \")\n\t\tif err == nil {\n\t\t\tfmt.Println(string(jtext))\n\t\t}\n\t}\n\tif err != nil {\n\t\tfmt.Printf(\"err: %s\\n\", err)\n\t}\n}", "func jsonResponse(response interface{}, w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tjson, err := json.Marshal(response)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(response.(model.StandardResponse).Status)\n\tw.Write(json)\n}", "func PrintJSON(w http.ResponseWriter, output interface{}, httpStatus int) []byte {\n\toutBuf, err := json.Marshal(output)\n\tif err != nil {\n\t\tHTTPOut(w, `{\"Errors\":\"JSON marshal failure on output: `+err.Error()+`\"}`, http.StatusInternalServerError)\n\t} else {\n\t\tHTTPOut(w, string(outBuf), httpStatus)\n\t}\n\treturn outBuf\n}", "func (out *JsonOutput) Print() {\n\tout.ResponseWriter.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tout.ResponseWriter.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tjson.NewEncoder(out.ResponseWriter).Encode(out.APIOutput)\n}", "func prettyPrint(v interface{}) {\n\tencoder := json.NewEncoder(os.Stdout)\n\tencoder.SetIndent(\"\", \" \")\n\n\tif err := encoder.Encode(v); err != nil {\n\t\tlog.Warning(\"Unable to pretty-print tunnel information, will dump raw data instead...\")\n\t\tfmt.Printf(\"%+v\\n\", v)\n\t}\n}", "func printJson(ag *alertGroup, m *sync.Mutex) {\n\tm.Lock()\n\tfor _, alert := range ag.Alerts {\n\t\tout := map[string]string{\"status\": alert.Status}\n\n\t\tfor k, v := range alert.Labels {\n\t\t\tout[k] = v\n\t\t}\n\t\tfor k, v := range alert.Annotations {\n\t\t\tout[k] = v\n\t\t}\n\t\tout[\"startsAt\"] = alert.StartsAt.Truncate(time.Millisecond).String()\n\t\tout[\"endsAt\"] = alert.EndsAt.Truncate(time.Millisecond).String()\n\n\t\tjout, err := json.Marshal(out)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\tfmt.Printf(\"%s\\n\", jout)\n\t}\n\tm.Unlock()\n}", "func JSON(c *gin.Context, response Response) {\n\tc.Writer.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tc.JSON(http.StatusOK, response)\n}", "func (lrt *LogRoundTripper) formatJSON(raw []byte) string {\n\tvar data map[string]interface{}\n\n\terr := json.Unmarshal(raw, &data)\n\tif err != nil {\n\t\tklog.V(6).Infof(\"Unable to parse JSON: %s, data: %s\", err, string(raw))\n\t\treturn string(raw)\n\t}\n\n\t// Mask known password fields\n\tif v, ok := data[\"auth\"].(map[string]interface{}); ok {\n\t\tif v, ok := v[\"identity\"].(map[string]interface{}); ok {\n\t\t\tif v, ok := v[\"password\"].(map[string]interface{}); ok {\n\t\t\t\tif v, ok := v[\"user\"].(map[string]interface{}); ok {\n\t\t\t\t\tv[\"password\"] = \"***\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Ignore the catalog\n\tif v, ok := data[\"token\"].(map[string]interface{}); ok {\n\t\tif _, ok := v[\"catalog\"]; ok {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\tpretty, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\tklog.V(6).Infof(\"Unable to re-marshal JSON: %s\", err)\n\t\treturn string(raw)\n\t}\n\n\treturn string(pretty)\n}", "func JSON(w http.ResponseWriter, r *http.Request, v interface{}) {\n\tif err, ok := v.(error); ok {\n\t\tv = errorf(r, err)\n\t}\n\n\trender.JSON(w, r, v)\n}", "func renderJSON(w http.ResponseWriter, status int, res interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(status)\n\n\tif status == http.StatusNoContent {\n\t\treturn\n\t}\n\n\tif err := json.NewEncoder(w).Encode(res); err != nil {\n\t\tlog.Printf(\"ERROR: renderJson - %q\\n\", err)\n\t}\n}", "func jsonPrint() {\n\n\tvar filteredData []alertDataJSON\n\tvar temp alertDataJSON\n\n\tfor _, each := range allAlertData {\n\t\tif filteredAlerts[each.Name] == 1 {\n\t\t\ttemp.Name = each.Name\n\t\t\ttemp.Service = each.Service\n\t\t\ttemp.Severity = each.Service\n\t\t\ttemp.Tag = each.Tag\n\t\t\ttemp.Starts = timeDiff(time.Now(), each.StartsAt, 0)\n\t\t\tif each.EndsAt == time.Unix(maxtstmp, 0).UTC() {\n\t\t\t\ttemp.Ends = \"Undefined\"\n\t\t\t\ttemp.Duration = \"Undefined\"\n\t\t\t} else {\n\t\t\t\ttemp.Ends = timeDiff(time.Now(), each.EndsAt, 0)\n\t\t\t\ttemp.Duration = timeDiff(each.StartsAt, each.EndsAt, 1)\n\t\t\t}\n\n\t\t\tfilteredData = append(filteredData, temp)\n\t\t}\n\t}\n\n\tb, err := json.Marshal(filteredData)\n\n\tif err != nil {\n\t\tlog.Printf(\"Unable to convert Filtered JSON Data, error: %v\\n\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(string(b))\n}", "func JSON(response interface{}, r *http.ResponseWriter) error {\n\tdata, err := json.Marshal(response)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresponseWriter := *r\n\n\theaders := responseWriter.Header()\n\n\tcontentTypeHeader := headers.Get(\"Content-Type\")\n\tif contentTypeHeader == \"\" {\n\t\theaders.Add(\"Content-Type\", \"application/json\")\n\t} else {\n\t\theaders.Set(\"Content-Type\", \"application/json\")\n\t}\n\tresponseWriter.WriteHeader(200)\n\tbytesWritten, err := responseWriter.Write(data)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tif bytesWritten != len(data) {\n\t\treturn errors.New(\"Could not write all of response\")\n\t}\n\treturn nil\n}", "func (FileGenerated_zebra_test_go) ZebraSchemaInJsonPretty() []byte {\n\treturn []byte(`{\n \"SourcePath\": \"bench_zebra_test.go\",\n \"SourcePackage\": \"qstest\",\n \"ZebraSchemaId\": 0,\n \"Structs\": {\n \"ZebraData\": {\n \"StructName\": \"ZebraData\",\n \"Fields\": [\n {\n \"Zid\": 0,\n \"FieldGoName\": \"Userid\",\n \"FieldTagName\": \"Userid\",\n \"FieldTypeStr\": \"ZebraUUID\",\n \"FieldCategory\": 27,\n \"FieldFullType\": {\n \"Kind\": 27,\n \"Str\": \"Array\",\n \"Domain\": {\n \"Kind\": 16,\n \"Str\": \"16\"\n },\n \"Range\": {\n \"Kind\": 12,\n \"Str\": \"byte\"\n }\n }\n },\n {\n \"Zid\": 1,\n \"FieldGoName\": \"Username\",\n \"FieldTagName\": \"Username\",\n \"FieldTypeStr\": \"string\",\n \"FieldCategory\": 23,\n \"FieldPrimitive\": 2,\n \"FieldFullType\": {\n \"Kind\": 2,\n \"Str\": \"string\"\n }\n },\n {\n \"Zid\": 2,\n \"FieldGoName\": \"Note\",\n \"FieldTagName\": \"Note\",\n \"FieldTypeStr\": \"string\",\n \"FieldCategory\": 23,\n \"FieldPrimitive\": 2,\n \"FieldFullType\": {\n \"Kind\": 2,\n \"Str\": \"string\"\n }\n }\n ]\n }\n },\n \"Imports\": []\n}`)\n}", "func (c *Context) RenderJSONIndent(data interface{}) {\n\t// Set content\n\tencoded, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\tc.Response.Write([]byte(err.Error()))\n\t} else {\n\t\tc.Response.Write(encoded)\n\t}\n}", "func JSON(w http.ResponseWriter, status int, data interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\tjson.NewEncoder(w).Encode(data)\n}", "func printJSON(v interface{}) {\n\tw := json.NewEncoder(os.Stdout)\n\tw.SetIndent(\"\", \"\\t\")\n\terr := w.Encode(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func printJSON(v interface{}) {\n\txb, err := json.MarshalIndent(v, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Println(\"outputJSON() could not marshal the value -\", err)\n\t\treturn\n\t}\n\tfmt.Println(string(xb))\n}", "func JSON(w http.ResponseWriter, status int, data interface{}) {\n\tb, err := json.Marshal(data)\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.WriteHeader(status)\n\tw.Write(b)\n}", "func (ctx *Context) JSONIndent(code int, obj interface{}, prefix string, indent string) (err error) {\n\tw := ctx.ResponseWriter\n\tbody, err := json.MarshalIndent(obj, prefix, indent)\n\tif err != nil {\n\t\treturn\n\t}\n\tw.Header().Set(HeaderContentType, MIMEApplicationJSONCharsetUTF8)\n\tw.WriteHeader(code)\n\t_, err = w.Write(body)\n\treturn\n}", "func JSONPrinter(writer io.Writer) Printer {\n\treturn &JSON{writer}\n}", "func (d *InfoOutput) JSON() ([]byte, error) {\n\treturn json.Marshal(d.reply)\n}", "func pretty(m proto.Message) string {\n\tbuf, err := json.MarshalIndent(m, \"\", \" \")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn string(buf)\n}", "func JSON(resp http.ResponseWriter, result interface{}, code int) error {\n\tresp.Header().Add(\"Content-Type\", \"application/json\")\n\tresp.WriteHeader(code)\n\tif result != nil {\n\t\treturn maskAny(json.NewEncoder(resp).Encode(result))\n\t}\n\treturn nil\n}", "func (o *Kanban) StringifyPretty() string {\n\to.Hash()\n\treturn pjson.Stringify(o, true)\n}", "func (h *BaseHTTPHandler) JSON(writer io.Writer, httpCode int, v interface{}) {\n\t_ = h.Render.JSON(writer, httpCode, v)\n}", "func PrintJson(v interface{}) {\n\tjsonText, _ := json.MarshalIndent(v, \"\", \"\\t\")\n\tfmt.Println(string(jsonText))\n}", "func toJSON(data interface{}) (string, error) {\n\tjsonData, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn \"\", errors.WithMessagef(err, \"%s - failed to marshal json\", logging.CallerStr(logging.Me))\n\t}\n\tvar prettyJSON bytes.Buffer\n\terr = json.Indent(&prettyJSON, jsonData, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn \"\", errors.WithMessagef(err, \"%s - failed indent json\", logging.CallerStr(logging.Me))\n\t}\n\treturn prettyJSON.String(), nil\n}", "func (info *SchemaInfo) JSON() string {\n\treturn fmt.Sprintf(\n\t\t`{\"name\": \"%s\",\"latestRev\": %d,\"desc\":`+\n\t\t\t` \"%s\",\"isActive\": %t,\"hasDraft\": %t}`,\n\t\tinfo.Name, info.LatestRevision,\n\t\tinfo.Description, info.IsActive, info.HasDraft)\n}", "func write(resp *Response, w http.ResponseWriter) {\n\tjs, _ := json.Marshal(resp)\n\tfmt.Fprint(w, string(js))\n}", "func renderJSON(w http.ResponseWriter, status int, v interface{}) {\n\tw.Header().Set(ContentType, ContentJSON)\n\tw.WriteHeader(status)\n\tif err := json.NewEncoder(w).Encode(v); err != nil {\n\t\tlog.WithField(\"err\", err).Error(\"Can't render to JSON\")\n\t}\n}", "func (s *Siegfried) JSON() string {\n\tversion := config.Version()\n\tstr := fmt.Sprintf(\n\t\t\"{\\\"siegfried\\\":\\\"%d.%d.%d\\\",\\\"scandate\\\":\\\"%v\\\",\\\"signature\\\":\\\"%s\\\",\\\"created\\\":\\\"%v\\\",\\\"identifiers\\\":[\",\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 i, id := range s.ids {\n\t\tif i > 0 {\n\t\t\tstr += \",\"\n\t\t}\n\t\td := id.Describe()\n\t\tstr += fmt.Sprintf(\"{\\\"name\\\":\\\"%s\\\",\\\"details\\\":\\\"%s\\\"}\", d[0], d[1])\n\t}\n\tstr += \"],\"\n\treturn str\n}", "func unmarshal(resp *http.Response, obj interface{}) (err error) {\n\tvar body []byte\n\tbody, err = ioutil.ReadAll(resp.Body)\n\tresp.Body.Close()\n\tif err == nil {\n\n\t\tif debug() {\n\t\t\t// TODO: Printf-ing the output of json.Indent through the bytes.Buffer.String\n\t\t\t// produces cruft. However writting directly to it, works o.k.\n\t\t\t// prettyJSON := bytes.Buffer{}\n\t\t\tvar prettyJSON bytes.Buffer\n\t\t\tfmt.Fprintf(&prettyJSON, t.Title(\"Pretty print response body:\\n\"))\n\t\t\tindentErr := json.Indent(&prettyJSON, body, \"\", \" \")\n\t\t\tif indentErr == nil {\n\t\t\t\t// fmt.Printf(\"%s %s\\n\", t.Title(\"Response body is:\"), t.Text(\"%s\\n\", prettyJSON))\n\t\t\t\tprettyJSON.WriteTo(os.Stdout)\n\t\t\t\tfmt.Println()\n\t\t\t\tfmt.Println()\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"%s\\n\", t.Fail(\"Error indenting JSON - %s\", indentErr.Error()))\n\t\t\t\tfmt.Printf(\"%s %s\\n\", t.Title(\"Body:\"), t.Text(string(body)))\n\t\t\t}\n\t\t}\n\n\t\tjson.Unmarshal(body, &obj)\n\t\tif debug() {\n\t\t\tfmt.Printf(\"%s %s\\n\", t.Title(\"Unmarshaled object: \"), t.Text(\"%#v\", obj))\n\t\t\tfmt.Println()\n\t\t}\n\t}\n\treturn err\n}", "func (doc *Document) JSON(w io.Writer, prettify bool) error {\n\te := json.NewEncoder(w)\n\tif prettify {\n\t\te.SetIndent(\"\", \" \")\n\t}\n\n\treturn e.Encode(doc)\n}", "func (s *HTTPServer) marshalJSON(req *http.Request, obj interface{}) ([]byte, error) {\n\tif _, ok := req.URL.Query()[\"pretty\"]; ok || s.agent.config.DevMode {\n\t\tbuf, err := json.MarshalIndent(obj, \"\", \" \")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbuf = append(buf, \"\\n\"...)\n\t\treturn buf, nil\n\t}\n\n\tbuf, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf, err\n}", "func (c *Change) PrettyJSONPatches() string {\n\tvar b []byte\n\tb, _ = json.MarshalIndent(c.Patches, \"\", \" \")\n\treturn string(b)\n}", "func (u *UserResultsPage) JSON() (string, error) {\n\tvar r string\n\ts, err := json.MarshalIndent(u.Users, \"\", \" \")\n\tif err == nil {\n\t\tr = string(s)\n\t}\n\treturn r, err\n}" ]
[ "0.7428383", "0.7371021", "0.7005541", "0.6922205", "0.67745775", "0.67342776", "0.6713497", "0.65828955", "0.6571731", "0.655957", "0.6534516", "0.65136945", "0.6480092", "0.6469898", "0.6422201", "0.6416509", "0.6416509", "0.6371389", "0.6342987", "0.6337074", "0.6328864", "0.63104314", "0.6299296", "0.6274626", "0.62727654", "0.6254217", "0.6234862", "0.6224149", "0.62190396", "0.62063104", "0.62050664", "0.6175691", "0.6153273", "0.6148575", "0.61437565", "0.6143738", "0.61356455", "0.6120082", "0.6106685", "0.6101756", "0.6067438", "0.60563475", "0.6041946", "0.6041946", "0.60175335", "0.5985988", "0.597275", "0.596315", "0.5961997", "0.59614635", "0.5961155", "0.59551924", "0.5949455", "0.5934392", "0.5929644", "0.5918796", "0.5918697", "0.5902548", "0.5898336", "0.58717525", "0.5852275", "0.5848947", "0.58426476", "0.5841442", "0.58384335", "0.5833531", "0.5825451", "0.5810042", "0.5809506", "0.58080524", "0.58069605", "0.5806955", "0.57989913", "0.5798384", "0.57938147", "0.578487", "0.5781041", "0.5779517", "0.5763891", "0.5759895", "0.575603", "0.5753994", "0.5749927", "0.5747338", "0.5742589", "0.57315564", "0.57271165", "0.5725468", "0.5724743", "0.57243764", "0.5712495", "0.57066596", "0.57018155", "0.5689524", "0.56827337", "0.56624043", "0.56604487", "0.56552154", "0.5644755", "0.5642098" ]
0.71797454
2
JSONString prettyprints a string that contains JSON
func JSONString(response string) { // pretty-print the json utils.PrintJSON([]byte(response)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func PrettyPrintJSON(jsonStr string) {\n\n\tfmt.Println(PrettyJSON(jsonStr))\n\n}", "func jsonPrettyPrint(in string) string {\r\n var out bytes.Buffer\r\n err := json.Indent(&out, []byte(in), \"\", \"\\t\")\r\n if err != nil {\r\n return in\r\n }\r\n return out.String()\r\n}", "func prettyJSON(input string) string {\n\tvar output bytes.Buffer\n\terr := json.Indent(&output, []byte(input), \"\", \"\\t\")\n\tif err != nil {\n\t\thandleWarning(\"failed to make json pretty, sorry.\")\n\t\treturn input\n\t}\n\treturn output.String()\n}", "func (i *Info) JSONString(indent bool) string {\n\treturn marshal.SafeJSON(i.ctx, netPrinter{i}, indent)\n}", "func JSONString(e interface{}) string {\n\treturn string(JSON(e))\n}", "func formatJson(str string) (string, error) {\n\tb := []byte(str)\n\tif !json.Valid(b) { // return original string if not json\n\t\treturn str, errors.New(\"this is not valid JSON\")\n\t}\n\tvar formattedJson bytes.Buffer\n\tif err := json.Indent(&formattedJson, b, \"\", \" \"); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn formattedJson.String(), nil\n}", "func PrettyPrintJSON(b []byte) ([]byte, error) {\n\tvar out bytes.Buffer\n\terr := json.Indent(&out, b, \"\", \" \")\n\treturn out.Bytes(), err\n}", "func PrettyPrintJSON(data interface{}) (string, error) {\n\tbytes, err := json.MarshalIndent(data, \"\", \" \")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(bytes), nil\n}", "func PrettyPrint(in string) string {\n\tvar out bytes.Buffer\n\terr := json.Indent(&out, []byte(in), \"\", \"\\t\")\n\tif err != nil {\n\t\treturn in\n\t}\n\treturn out.String()\n}", "func TestPrettyJSON(t *testing.T) {\n\tresults, err := PrettyJSON(jsonSample)\n\tif err != nil {\n\t\tt.Errorf(\"Properly formatted JSON failed to be made pretty: %s\", jsonSample)\n\t}\n\tcheckResultContains(t, results, \" \\\"error\\\": {\")\n\tcheckResultContains(t, results, \" \\\"message\\\": \")\n}", "func prettyJSON(b []byte) []byte {\n\tvar out bytes.Buffer\n\terr := json.Indent(&out, b, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn b\n\t}\n\treturn out.Bytes()\n}", "func PrettyPrintJSON(data interface{}) (string, error) {\n\toutput := &bytes.Buffer{}\n\tif err := json.NewEncoder(output).Encode(data); err != nil {\n\t\treturn \"\", fmt.Errorf(\"building encoder error: %v\", err)\n\t}\n\tformatted := &bytes.Buffer{}\n\tif err := json.Indent(formatted, output.Bytes(), \"\", \" \"); err != nil {\n\t\treturn \"\", fmt.Errorf(\"indenting error: %v\", err)\n\t}\n\treturn string(formatted.Bytes()), nil\n}", "func (j JSON) String() string {\n\tbs, err := j.MarshalJSON()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\treturn string(bs)\n}", "func ToPrettyJsonString(v interface{}) string {\n\toutput, _ := json.MarshalIndent(v, \"\", \" \")\n\treturn string(output)\n}", "func (r Result) PrettyPrintJSON() string {\n\tpretty, err := json.MarshalIndent(r.Body, \"\", \" \")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn string(pretty)\n}", "func PrettyPrintJSON(metrics interface{}) string {\n\toutput := &bytes.Buffer{}\n\tif err := json.NewEncoder(output).Encode(metrics); err != nil {\n\t\tLogf(\"Error building encoder: %v\", err)\n\t\treturn \"\"\n\t}\n\tformatted := &bytes.Buffer{}\n\tif err := json.Indent(formatted, output.Bytes(), \"\", \" \"); err != nil {\n\t\tLogf(\"Error indenting: %v\", err)\n\t\treturn \"\"\n\t}\n\treturn formatted.String()\n}", "func ToJsonString(obj map[string]interface{}, pretty bool) (jsons string, e error) {\n var ba []byte\n\n if pretty {\n ba, e = json.MarshalIndent(obj, \"\", \"\\t\")\n } else {\n ba, e = json.Marshal(obj)\n }\n\n if e == nil {\n jsons = string(ba)\n }\n\n return\n}", "func Pretty(j JSON) (string, error) {\n\tasGo, err := j.toGoRepr()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Luckily for us, despite Go's random map ordering, MarshalIndent sorts the\n\t// keys of objects.\n\tres, err := json.MarshalIndent(asGo, \"\", \" \")\n\treturn string(res), err\n}", "func JSONEncodeString(s string) string {\n\tbuf := new(bytes.Buffer)\n\tenc := json.NewEncoder(buf)\n\tenc.SetEscapeHTML(false)\n\tif err := enc.Encode(s); err == nil {\n\t\ts := buf.String()\n\t\tn := len(s) - 1\n\t\tif s[n] == '\\n' {\n\t\t\treturn s[:n]\n\t\t}\n\t\treturn s\n\t}\n\n\treturn \"ERROR encoding\"\n}", "func JSONString(s string) string {\n\tvar e strings.Builder\n\te.WriteByte('\"')\n\tstart := 0\n\tfor i := 0; i < len(s); {\n\t\tif b := s[i]; b < utf8.RuneSelf {\n\t\t\tif safeSet[b] {\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif start < i {\n\t\t\t\te.WriteString(s[start:i])\n\t\t\t}\n\t\t\te.WriteByte('\\\\')\n\t\t\tswitch b {\n\t\t\tcase '\\\\', '\"':\n\t\t\t\te.WriteByte(b)\n\t\t\tcase '\\n':\n\t\t\t\te.WriteByte('n')\n\t\t\tcase '\\r':\n\t\t\t\te.WriteByte('r')\n\t\t\tcase '\\t':\n\t\t\t\te.WriteByte('t')\n\t\t\tdefault:\n\t\t\t\te.WriteString(`u00`)\n\t\t\t\te.WriteByte(hex[b>>4])\n\t\t\t\te.WriteByte(hex[b&0xF])\n\t\t\t}\n\t\t\ti++\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\tc, size := utf8.DecodeRuneInString(s[i:])\n\t\tif c == utf8.RuneError && size == 1 {\n\t\t\tif start < i {\n\t\t\t\te.WriteString(s[start:i])\n\t\t\t}\n\t\t\te.WriteString(`\\ufffd`)\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\tif c == '\\u2028' || c == '\\u2029' {\n\t\t\tif start < i {\n\t\t\t\te.WriteString(s[start:i])\n\t\t\t}\n\t\t\te.WriteString(`\\u202`)\n\t\t\te.WriteByte(hex[c&0xF])\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\ti += size\n\t}\n\tif start < len(s) {\n\t\te.WriteString(s[start:])\n\t}\n\te.WriteByte('\"')\n\treturn e.String()\n}", "func (fp *LimitPool_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *Limit_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (g *GoCrypt) PrettyJson(v interface{}) string {\n\toutput, _ := json.MarshalIndent(v, \"\", \" \")\n\treturn string(output)\n}", "func FormatJSON(str string) (string, error) {\n\tvar mapResult interface{} //map[string]interface{}\n\terr := json.Unmarshal([]byte(str), &mapResult)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tjsonStr, err := json.MarshalIndent(mapResult, \"\", \" \")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(jsonStr), nil\n}", "func prettyPrint(src []byte) (string, error) {\n\tvar dst bytes.Buffer\n\terr := json.Indent(&dst, src, \"\", \" \")\n\tif nil != err {\n\t\treturn \"\", err\n\t}\n\treturn dst.String(), nil\n}", "func (fp *GetLimitPoolRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func StringMarshalJSON(s string, escapeHTML bool) []byte {\n\ta := StringToBytes(s)\n\tvar buf = bytes.NewBuffer(make([]byte, 0, 64))\n\tbuf.WriteByte('\"')\n\tstart := 0\n\tfor i := 0; i < len(a); {\n\t\tif b := a[i]; b < utf8.RuneSelf {\n\t\t\tif htmlSafeSet[b] || (!escapeHTML && safeSet[b]) {\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif start < i {\n\t\t\t\tbuf.Write(a[start:i])\n\t\t\t}\n\t\t\tswitch b {\n\t\t\tcase '\\\\', '\"':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte(b)\n\t\t\tcase '\\n':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('n')\n\t\t\tcase '\\r':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('r')\n\t\t\tcase '\\t':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('t')\n\t\t\tdefault:\n\t\t\t\t// This encodes bytes < 0x20 except for \\t, \\n and \\r.\n\t\t\t\t// If escapeHTML is set, it also escapes <, >, and &\n\t\t\t\t// because they can lead to security holes when\n\t\t\t\t// user-controlled strings are rendered into JSON\n\t\t\t\t// and served to some browsers.\n\t\t\t\tbuf.WriteString(`\\u00`)\n\t\t\t\tbuf.WriteByte(hexSet[b>>4])\n\t\t\t\tbuf.WriteByte(hexSet[b&0xF])\n\t\t\t}\n\t\t\ti++\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\tc, size := utf8.DecodeRune(a[i:])\n\t\tif c == utf8.RuneError && size == 1 {\n\t\t\tif start < i {\n\t\t\t\tbuf.Write(a[start:i])\n\t\t\t}\n\t\t\tbuf.WriteString(`\\ufffd`)\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\t// U+2028 is LINE SEPARATOR.\n\t\t// U+2029 is PARAGRAPH SEPARATOR.\n\t\t// They are both technically valid characters in JSON strings,\n\t\t// but don't work in JSONP, which has to be evaluated as JavaScript,\n\t\t// and can lead to security holes there. It is valid JSON to\n\t\t// escape them, so we do so unconditionally.\n\t\t// See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.\n\t\tif c == '\\u2028' || c == '\\u2029' {\n\t\t\tif start < i {\n\t\t\t\tbuf.Write(a[start:i])\n\t\t\t}\n\t\t\tbuf.WriteString(`\\u202`)\n\t\t\tbuf.WriteByte(hexSet[c&0xF])\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\ti += size\n\t}\n\tif start < len(a) {\n\t\tbuf.Write(a[start:])\n\t}\n\tbuf.WriteByte('\"')\n\treturn buf.Bytes()\n}", "func (fp *UpdateLimitPoolRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func json_prettyprint(in []byte, prefix string, indent string) string {\n\tvar out bytes.Buffer\n\tpretty_err := json.Indent(&out, in, prefix, indent)\n\tif pretty_err != nil {\n\t\treturn \"(pretty-printing error)\"\n\t}\n\treturn string(out.Bytes())\n}", "func (fp *WatchLimitPoolsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchLimitPoolsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchLimitPoolRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchLimitPoolResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ServiceAccount_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func dummyJSONStr() string {\n\treturn `{\n \"number\": 1234.56,\n \"string\": \"foo bar\",\n \"arrayOfString\": [\n \"one\",\n \"two\",\n \"three\",\n \"four\"\n ],\n \"object\": {\n \"foo\": \"bar\",\n \"hello\": \"world\",\n \"answer\": 42\n },\n \"true\": true,\n \"false\": false,\n \"null\": null\n }`\n}", "func (fp *ListAuditedResourceDescriptorsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *Plan_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListLimitPoolsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *BatchGetLimitPoolsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func JSONToString(v interface{}) string {\n\tdata, _ := json.MarshalIndent(v, \"\", \" \")\n\tSTR := string(data)\n\tSTR = strings.ReplaceAll(STR, string(10), ``)\n\treturn STR\n}", "func jsonString(b []byte) string {\n\ts := string(b)\n\tif s == \"\" {\n\t\treturn \"{}\"\n\t}\n\treturn s\n}", "func (fp *BatchGetLimitPoolsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *Resource_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListLimitPoolsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (t Transaction) JSONString() string {\n\ts, _ := toJSONString(t)\n\treturn s\n}", "func (a *App) JSONString() (string, error) {\n\tb, err := json.Marshal(a)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"marshal application description: %w\", err)\n\t}\n\treturn fmt.Sprintf(\"%s\\n\", b), nil\n}", "func prettyprint(b []byte) ([]byte, error) {\n\tvar out bytes.Buffer\n\terr := json.Indent(&out, b, \"\", \" \")\n\treturn out.Bytes(), err\n}", "func (fp *WatchAuditedResourceDescriptorsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *UpdateLimitPoolRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *BatchGetAuditedResourceDescriptorsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListAuditedResourceDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *GetRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *Allowance_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *AlertingCondition_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func JSON(j interface{}) string {\n\tvar buf bytes.Buffer\n\tencoder := json.NewEncoder(&buf)\n\tencoder.SetEscapeHTML(false)\n\tencoder.SetIndent(\"\", \"\")\n\terr := encoder.Encode(j)\n\n\tif err == nil {\n\t\treturn strings.TrimSuffix(buf.String(), \"\\n\")\n\t}\n\n\t// j could not be serialized to json, so let's log the error and return a\n\t// helpful-ish value\n\tError().logGenericArgs(\"error serializing value to json\", err, nil, 1)\n\treturn fmt.Sprintf(\"<error: %v>\", err)\n}", "func PrintPrettyJSON(input map[string]interface{}) {\n\tout, err := json.MarshalIndent(input, \"\", \"\\t\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Error indenting JSON: %v\", err)\n\t}\n\tfmt.Println(string(out))\n}", "func (j Json) String() string {\n\treturn string(j)\n}", "func (fp *UpdateRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *GetAuditedResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchRegionsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *DeleteLimitPoolRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchAuditedResourceDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *AcceptProjectInvitationRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListRegionsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchRegionsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *UpdateRegionRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *RegionalDistribution_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (js jsonString) string() (s string, err error) {\n\terr = json.Unmarshal(js.bytes(), &s)\n\treturn s, err\n}", "func (fp *CreateRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *AcceptProjectInvitationResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *BatchGetRegionsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *BatchGetAuditedResourceDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *UpdateAuditedResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *AlertingConditionState_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (o *Kanban) StringifyPretty() string {\n\to.Hash()\n\treturn pjson.Stringify(o, true)\n}", "func (fp *BatchGetRegionsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListRegionsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func indent(s string) string {\n\tvar buf bytes.Buffer\n\tjson.Indent(&buf, []byte(s), \"\", \" \")\n\treturn buf.String()\n}", "func (fp *CreateAuditedResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListMetricDescriptorsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *DeclineProjectInvitationRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchRegionResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (j JSONResponse) String() string {\n\tstr, err := json.MarshalIndent(j, \"\", \" \")\n\tif err != nil {\n\t\treturn fmt.Sprintf(`{\n \"error\": \"%v\"\n}`, err)\n\t}\n\n\treturn string(str)\n}", "func (fp *DeclineProjectInvitationResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *AlertingConditionSpec_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *GetMetricDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchAuditedResourceDescriptorResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListMetricDescriptorsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *UpdateAuditedResourceDescriptorRequestCAS_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (c *Client) GetJSONString(path string, prettify bool) (string, error) {\n\tbody, err := c.Get(path)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed: %v\\n\", err)\n\t\treturn \"\", err\n\t}\n\tdefer body.Close()\n\n\tbuf := new(bytes.Buffer)\n\tvar s string\n\n\tif prettify {\n\t\tvar m json.RawMessage\n\n\t\tdec := json.NewDecoder(body)\n\t\tif err := dec.Decode(&m); err != nil {\n\t\t\tlog.Fatalf(\"Failed to decode: %v\\n\", err)\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tb, err := json.MarshalIndent(&m, \"\", \"\\t\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error during indent: %v\\n\", err)\n\t\t\treturn \"\", err\n\t\t}\n\n\t\ts = string(b)\n\t} else {\n\t\tbuf.ReadFrom(body)\n\t\ts = buf.String()\n\t}\n\n\treturn s, nil\n}", "func (fp *CreateMetricDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *WatchAuditedResourceDescriptorRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListMyProjectInvitationsResponse_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *DeleteRegionRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ResendProjectInvitationRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func (fp *ListMyProjectInvitationsRequest_FieldTerminalPath) JSONString() string {\n\treturn strcase.ToLowerCamel(fp.String())\n}", "func PrettyString(inObj interface{}, depthLimit int) string {\n\tvar buf bytes.Buffer\n\tformObj(&buf, reflect.ValueOf(inObj), 0, depthLimit)\n\tbuf.WriteString(\"\\n\")\n\treturn buf.String()\n}", "func encodeJSONString(buf *bytes.Buffer, s string) {\n\tbuf.WriteByte('\"')\n\tstart := 0\n\tfor i := 0; i < len(s); {\n\t\tif b := s[i]; b < utf8.RuneSelf {\n\t\t\tif safeSet[b] {\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif start < i {\n\t\t\t\tbuf.WriteString(s[start:i])\n\t\t\t}\n\t\t\tswitch b {\n\t\t\tcase '\\\\', '\"':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte(b)\n\t\t\tcase '\\n':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('n')\n\t\t\tcase '\\r':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('r')\n\t\t\tcase '\\t':\n\t\t\t\tbuf.WriteByte('\\\\')\n\t\t\t\tbuf.WriteByte('t')\n\t\t\tdefault:\n\t\t\t\t// This encodes bytes < 0x20 except for \\t, \\n and \\r.\n\t\t\t\t// If escapeHTML is set, it also escapes <, >, and &\n\t\t\t\t// because they can lead to security holes when\n\t\t\t\t// user-controlled strings are rendered into JSON\n\t\t\t\t// and served to some browsers.\n\t\t\t\tbuf.WriteString(`\\u00`)\n\t\t\t\tbuf.WriteByte(hexAlphabet[b>>4])\n\t\t\t\tbuf.WriteByte(hexAlphabet[b&0xF])\n\t\t\t}\n\t\t\ti++\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\tc, size := utf8.DecodeRuneInString(s[i:])\n\t\tif c == utf8.RuneError && size == 1 {\n\t\t\tif start < i {\n\t\t\t\tbuf.WriteString(s[start:i])\n\t\t\t}\n\t\t\tbuf.WriteString(`\\ufffd`)\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\ti += size\n\t}\n\tif start < len(s) {\n\t\tbuf.WriteString(s[start:])\n\t}\n\tbuf.WriteByte('\"')\n}" ]
[ "0.8059519", "0.77302325", "0.74448645", "0.7308321", "0.70394874", "0.7010589", "0.6955381", "0.69457674", "0.6940481", "0.6935861", "0.6905035", "0.69007504", "0.68278", "0.6813687", "0.68090546", "0.6773632", "0.67731917", "0.672755", "0.66992265", "0.6654713", "0.6650314", "0.66321564", "0.66151875", "0.6595571", "0.65897655", "0.65820867", "0.65724474", "0.65546", "0.65422285", "0.6532119", "0.6527162", "0.64968795", "0.6495981", "0.648667", "0.64801496", "0.64751333", "0.6470104", "0.6464297", "0.64588404", "0.64517", "0.6450778", "0.6440452", "0.64346653", "0.6432383", "0.64288384", "0.64277446", "0.6425943", "0.64257085", "0.6422745", "0.64115906", "0.6407272", "0.63997144", "0.6398449", "0.63934654", "0.6393267", "0.63909733", "0.63861156", "0.63832575", "0.6368803", "0.63670653", "0.63665897", "0.6362253", "0.6353067", "0.63466865", "0.63437456", "0.6343271", "0.6342702", "0.6337171", "0.63343817", "0.63333905", "0.63291913", "0.6327313", "0.63253754", "0.63189566", "0.6318244", "0.6310053", "0.6308628", "0.6305274", "0.6304796", "0.63040394", "0.62952584", "0.6291518", "0.6289288", "0.62863934", "0.62729883", "0.6265878", "0.6264112", "0.6257436", "0.62520814", "0.6248319", "0.6232739", "0.62317973", "0.62296706", "0.6214119", "0.6203864", "0.61972344", "0.61925983", "0.6185241", "0.6167783", "0.6167094" ]
0.74176973
3
NewUInt64 creates a new UInt64 with default values.
func NewUInt64() *UInt64 { self := UInt64{} self.SetDefaults() return &self }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewUint64(x uint64) *Numeric {\n\tvar r Numeric\n\treturn r.SetUint64(x)\n}", "func NewUint64(store *store.Store, cfgPath string) *Uint64 {\n\tf := &Uint64{}\n\tf.init(store, f.mapCfgValue, cfgPath)\n\treturn f\n}", "func NewUint64(value uint64) *Uint64 {\n\treturn &Uint64{\n\t\tvalue: value,\n\t}\n}", "func NewUint64(inp uint64) B64 {\n\tvar resp = []B64{\n\t\tnewUint64(inp),\n\t}\n\treturn resp[0]\n}", "func NewUint64(vals ...uint64) Uint64 {\n\tsize := max(len(vals), minSize)\n\tset := Uint64{\n\t\tm: make(map[uint64]struct{}, size),\n\t}\n\tset.Add(vals...)\n\treturn set\n}", "func NewOptionalUInt64(v interface{}) *OptionalUInt64 {\n\ts, ok := v.(uint64)\n\tif ok {\n\t\treturn &OptionalUInt64{Value: s}\n\t}\n\treturn nil\n}", "func NewUint64(data arrow.ArrayData, shape, strides []int64, names []string) *Uint64 {\n\ttsr := &Uint64{tensorBase: *newTensor(arrow.PrimitiveTypes.Uint64, data, shape, strides, names)}\n\tvals := tsr.data.Buffers()[1]\n\tif vals != nil {\n\t\ttsr.values = arrow.Uint64Traits.CastFromBytes(vals.Bytes())\n\t\tbeg := tsr.data.Offset()\n\t\tend := beg + tsr.data.Len()\n\t\ttsr.values = tsr.values[beg:end]\n\t}\n\treturn tsr\n}", "func (c Uint64Codec) New() unsafe.Pointer {\n\treturn unsafe.Pointer(new(uint64))\n}", "func NewUint64WithSize(size int) Uint64 {\n\tset := Uint64{\n\t\tm: make(map[uint64]struct{}, size),\n\t}\n\treturn set\n}", "func NewTagUint64(ls *lua.LState) int {\n\tvar val = uint64(ls.CheckInt(1))\n\tPushTag(ls, &LuaTag{wpk.TagUint64(val)})\n\treturn 1\n}", "func UInt64(v uint64) *uint64 {\n\treturn &v\n}", "func NewUint64Setting(name string, description string, fallback uint64) *Uint64Setting {\n\treturn &Uint64Setting{\n\t\tBaseSetting: &BaseSetting{\n\t\t\tNameValue: name,\n\t\t\tDescriptionValue: description,\n\t\t},\n\t\tUint64Value: &fallback,\n\t}\n}", "func (c *Client) NewGaugeUint64(name string, opts ...MOption) *GaugeUint64 {\n\tg := &GaugeUint64{name: name}\n\tc.register(g, opts...)\n\treturn g\n}", "func NewRandUint64() (uint64, error) {\n\tvar b [8]byte\n\t_, err := rand.Read(b[:])\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn binary.LittleEndian.Uint64(b[:]), nil\n}", "func Uint64(name string, value uint64, usage string) *uint64 {\n\tp := new(uint64);\n\tUint64Var(p, name, value, usage);\n\treturn p;\n}", "func MakeUInt64(in *uint64) *google_protobuf.UInt64Value {\n\tif in == nil {\n\t\treturn nil\n\t}\n\n\treturn &google_protobuf.UInt64Value{\n\t\tValue: *in,\n\t}\n}", "func MakeUInt64OrDefault(in *uint64, defaultValue uint64) *google_protobuf.UInt64Value {\n\tif in == nil {\n\t\treturn &google_protobuf.UInt64Value{\n\t\t\tValue: defaultValue,\n\t\t}\n\t}\n\n\treturn &google_protobuf.UInt64Value{\n\t\tValue: *in,\n\t}\n}", "func NewUint64VarP(\n\tlabel string,\n\tshortLabel string,\n\tdefaultValue uint64,\n\tdescription string,\n) Flag {\n\treturn &uint64VarP{\n\t\tflagBase: flagBase{\n\t\t\tlabel: label,\n\t\t\tshortLabel: shortLabel,\n\t\t\tdescription: description,\n\t\t},\n\t\tdefaultValue: defaultValue,\n\t}\n}", "func (s *OptionalUInt64) UInt64() uint64 {\n\treturn s.Value\n}", "func New64(seed uint32) Hash128 {\n\tseed64 := uint64(seed)\n\treturn &sum64_128{seed64, seed64, 0, 0, 0, 0}\n}", "func NewUID() uint64 {\n\tvar v uint64\n\terr := binary.Read(rand.Reader, binary.BigEndian, &v)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treturn v\n}", "func NewUInt64Set() UInt64Set {\n\treturn make(map[uint64]struct{})\n}", "func Uint64(uint64 uint64) *uint64 {\n\treturn &uint64\n}", "func (i *UInt64) UInt64() uint64 {\n\treturn uint64(*i)\n}", "func Uint64(name string, value uint64, usage string) *uint64 {\n\treturn Environment.Uint64(name, value, usage)\n}", "func New64() hash.Hash64 { return New64WithSeed(0) }", "func NewUint64Uint64Map(kv ...Uint64Uint64Tuple) Uint64Uint64Map {\n\tmm := newUint64Uint64Map()\n\tfor _, t := range kv {\n\t\tmm[t.Key] = t.Val\n\t}\n\treturn mm\n}", "func Uint64() uint64 { return globalRand.Uint64() }", "func Uint64() uint64 { return globalRand.Uint64() }", "func Uint64() uint64 { return globalRand.Uint64() }", "func NewAutoUInt64Table(prefixData [2]byte, prefixSeq byte, model proto.Message, cdc codec.Codec) (*AutoUInt64Table, error) {\n\ttable, err := newTable(prefixData, model, cdc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AutoUInt64Table{\n\t\ttable: table,\n\t\tseq: NewSequence(prefixSeq),\n\t}, nil\n}", "func GetUInt64OrDefault(in *google_protobuf.UInt64Value, defaultValue uint64) *uint64 {\n\tif in == nil {\n\t\treturn &defaultValue\n\t}\n\n\treturn &in.Value\n}", "func Uint64() uint64 {\n\treturn uint64(rand.Int63n(math.MaxInt64))\n}", "func New64() *Digest64 {\n\treturn New64WithSeed(0)\n}", "func Uint64(flag string, value uint64, description string) *uint64 {\n\tvar v uint64\n\tUint64Var(&v, flag, value, description)\n\treturn &v\n}", "func Uint64(u *uint64) uint64 {\n\tif u == nil {\n\t\treturn 0\n\t}\n\treturn *u\n}", "func NewUint64Set(items ...uint64) Uint64Set {\n\tss := Uint64Set{}\n\tss.Insert(items...)\n\treturn ss\n}", "func NewBigUInt(i uint64) *BigUInt {\n\treturn &BigUInt{data: bytesFromUInt64(i)}\n}", "func Uint64(name string, defaultValue uint64) uint64 {\n\tif strVal, ok := os.LookupEnv(name); ok {\n\t\tif i64, err := strconv.ParseUint(strVal, 10, 64); err == nil {\n\t\t\treturn i64\n\t\t}\n\t}\n\n\treturn defaultValue\n}", "func Uint64(v uint64) *uint64 {\n\treturn &v\n}", "func Uint64(v uint64) *uint64 {\n\treturn &v\n}", "func newUint(value *big.Int, width Width) *TypedUint {\n\ttypedUint64 := TypedUint{\n\t\tBytes: value.Bytes(),\n\t\tType: ValueType_UINT,\n\t\tTypeOpts: []int32{int32(width)},\n\t}\n\treturn &typedUint64\n}", "func u64(wr *wrappers.UInt64Value) *uint64 {\n\tif wr == nil {\n\t\treturn nil\n\t}\n\tresult := new(uint64)\n\t*result = wr.GetValue()\n\n\treturn result\n}", "func Uint64(name string, value uint64, usage string) *uint64 {\n\treturn ex.FlagSet.Uint64(name, value, usage)\n}", "func Uint64(key string, val uint64) Tag {\n\treturn Tag{key: key, tType: uint64Type, integerVal: int64(val)}\n}", "func Uint64(name string, alias rune, value uint64, usage string, fn Callback) *uint64 {\n\treturn CommandLine.Uint64(name, alias, value, usage, fn)\n}", "func Uint64(v *uint64) uint64 {\n\tif v != nil {\n\t\treturn *v\n\t}\n\treturn 0\n}", "func Uint64(name string, val uint64) Field {\n\treturn Field(zap.Uint64(name, val))\n}", "func UInt64(r interface{}, err error) (uint64, error) {\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tswitch r := r.(type) {\n\tcase uint64:\n\t\treturn r, err\n\tcase int:\n\t\tif r < 0 {\n\t\t\treturn 0, simplesessions.ErrAssertType\n\t\t}\n\t\treturn uint64(r), nil\n\tcase int64:\n\t\tif r < 0 {\n\t\t\treturn 0, simplesessions.ErrAssertType\n\t\t}\n\t\treturn uint64(r), nil\n\tcase []byte:\n\t\tn, err := strconv.ParseUint(string(r), 10, 64)\n\t\treturn n, err\n\tcase string:\n\t\tn, err := strconv.ParseUint(r, 10, 64)\n\t\treturn n, err\n\tcase nil:\n\t\treturn 0, simplesessions.ErrNil\n\t}\n\n\treturn 0, simplesessions.ErrAssertType\n}", "func GetU64(name string, defvals ...uint64) uint64 {\n\tif global == nil {\n\t\tif len(defvals) == 0 {\n\t\t\treturn 0\n\t\t}\n\n\t\treturn defvals[0]\n\t}\n\n\treturn global.GetU64(name, defvals...)\n}", "func UInt64NoNonePtr(s uint64) *uint64 {\n\tif s == 0 {\n\t\treturn nil\n\t}\n\treturn &s\n}", "func (no *Node) UInt64() (uint64, error) {\n\tvar out uint64\n\tif err := binary.Read(no.buf, binary.LittleEndian, &out); err != nil {\n\t\treturn 0, err\n\t}\n\treturn out, nil\n}", "func MakeUint64(x uint64) Value {\n\treturn constant.MakeUint64(x)\n}", "func NewUint(u uint) Uint { return &u }", "func Uint64(num uint64) *cells.BinaryCell {\n\treturn cells.New(OpUint64, proto.EncodeVarint(num))\n}", "func Uint64Empty(val interface{}) string {\n\tif val == nil {\n\t\treturn \"\"\n\t}\n\n\treturn strconv.FormatUint(val.(uint64), 10)\n}", "func (r *Rand) Uint64() uint64 {\n\tif x, err := r.cryptoRand.Uint64(); err == nil {\n\t\treturn x\n\t}\n\treturn r.mathRand.Uint64()\n}", "func (s *EnvVarSet) Uint64(name string, value uint64, usage string) *uint64 {\n\tp := new(uint64)\n\n\ts.Uint64Var(p, name, value, usage)\n\n\treturn p\n}", "func Uint64(key string, val uint64) Field {\n\treturn Field{Key: key, Type: core.Uint64Type, Integer: int64(val)}\n}", "func (f *FlagSet) Uint64(name string, alias rune, value uint64, usage string, fn Callback) *uint64 {\n\tp := new(uint64)\n\tf.Uint64Var(p, name, alias, value, usage, fn)\n\treturn p\n}", "func Uint64(k string, v uint64) Field {\n\treturn Field{Key: k, Value: valf.Uint64(v)}\n}", "func (p *PCG64) Uint64() uint64 {\n\tp.multiply()\n\tp.add()\n\t// XOR high and low 64 bits together and rotate right by high 6 bits of state.\n\treturn bits.RotateLeft64(p.high^p.low, -int(p.high>>58))\n}", "func (i *Int64) UInt64() uint64 {\n\treturn uint64(*i)\n}", "func Uint64Arg(register Register, name string, options ...ArgOptionApplyer) *uint64 {\n\tp := new(uint64)\n\t_ = Uint64ArgVar(register, p, name, options...)\n\treturn p\n}", "func NewUint(x uint) *Numeric {\n\tvar r Numeric\n\treturn r.SetUint(x)\n}", "func (u Uint64) Uint64() uint64 {\n\treturn uint64(u)\n}", "func RandomUint64() uint64 {\n\treturn rand.Uint64()\n}", "func (c *Config) GetU64(name string, defvals ...uint64) uint64 {\n\tif len(defvals) != 0 {\n\t\treturn uint64(c.GetI64(name, int64(defvals[0])))\n\t}\n\n\treturn uint64(c.GetI64(name))\n}", "func MeasureUInt64(name string, field string, value uint64) Measurement {\n\treturn NewMeasurement(name).AddUInt64(field, value)\n}", "func (elt *Element) Uint64(defaultValue ...uint64) (uint64, error) {\n\tdefValue := func() *uint64 {\n\t\tif len(defaultValue) == 0 {\n\t\t\treturn nil\n\t\t}\n\t\treturn &defaultValue[0]\n\t}\n\tdef := defValue()\n\tif elt.Value == nil {\n\t\tdef := defValue()\n\t\tif def == nil {\n\t\t\tvar v uint64\n\t\t\treturn v, NewWrongPathError(elt.Path)\n\t\t}\n\t\treturn *def, nil\n\t}\n\tv, ok := elt.Value.(uint64)\n\tif !ok {\n\t\tif def == nil{\n\t\t\tvar v uint64\n\t\t\treturn v, NewWrongTypeError(\"uint64\", elt.Value)\n\t\t}\n\t\treturn *def, nil\n\t}\n\treturn v, nil\n}", "func FormatUint64(format string, v ...any) uint64 {\n\treturn GetUint64(Format(format, v...))\n}", "func NewXXHash64(seed uint64) (*XXHash64, error) {\n\tthis := new(XXHash64)\n\tthis.seed = seed\n\treturn this, nil\n}", "func RandUint64() uint64 {\n\tb := RandBytes(8)\n\treturn binary.BigEndian.Uint64(b)\n}", "func (n BlockNonce) Uint64() uint64 {\n\treturn binary.BigEndian.Uint64(n[:])\n}", "func (n BlockNonce) Uint64() uint64 {\n\treturn binary.BigEndian.Uint64(n[:])\n}", "func NewFromUint64Slice(items []uint64) *SliceOfUint64 {\n\tslicy := &SliceOfUint64{items}\n\treturn slicy\n}", "func Uint64(v interface{}) (uint64, error) {\n\tvar err error\n\tv = indirect(v)\n\n\tswitch n := v.(type) {\n\tcase int8:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase int16:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase int32:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase int64:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase int:\n\t\tif n < 0 {\n\t\t\terr = OverflowError{ToType: \"uint64\", Value: v}\n\t\t}\n\t\treturn uint64(n), err\n\tcase uint8:\n\t\treturn uint64(n), err\n\tcase uint16:\n\t\treturn uint64(n), err\n\tcase uint32:\n\t\treturn uint64(n), err\n\tcase uint64:\n\t\treturn n, err\n\tcase uint:\n\t\treturn uint64(n), err\n\t}\n\n\treturn 0, InvalidTypeError{ToType: \"uint64\", Value: v}\n}", "func New64(seed uint64) *Flea64 {\n\tf := &Flea64{\n\t\ta: fleaSeed64,\n\t\tb: seed,\n\t\tc: seed,\n\t\td: seed,\n\t}\n\n\t// Functions with for-loops aren't inlined.\n\t// See https://github.com/golang/go/issues/14768\n\ti := 0\nloop:\n\te := f.a - bits.RotateLeft64(f.b, flea64Rot1)\n\tf.a = f.b ^ bits.RotateLeft64(f.c, flea64Rot2)\n\tf.b = f.c + f.d\n\tf.c = f.d + e\n\tf.d = e + f.a\n\n\ti++\n\tif i < flea64Rounds {\n\t\tgoto loop\n\t}\n\treturn f\n}", "func randomUint64(t *testing.T) uint64 {\n\tbigInt, err := rand.Int(rand.Reader, new(big.Int).SetUint64(math.MaxUint64))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn bigInt.Uint64()\n}", "func (bh *bh_rng) Uint64() (v uint64) {\n\tbinary.Read(bh, binary.BigEndian, &v)\n\treturn\n}", "func NewKeyUint(key uint64) *KeyUint { return &KeyUint{key} }", "func Uint64Var(pv *uint64, flag string, value uint64, description string) {\n\tshort, long, err := parseSingleFlag(flag)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t*pv = value\n\tflags = append(flags, &optionUint64{\n\t\tdescription: description,\n\t\tlong: long,\n\t\tshort: short,\n\t\tpv: pv,\n\t\tdef: value,\n\t})\n}", "func New64(key []byte) (hash.Hash64, error) {\n\tif k := len(key); k != KeySize {\n\t\treturn nil, KeySizeError(k)\n\t}\n\th := new(digest64)\n\th.key[0] = binary.LittleEndian.Uint64(key)\n\th.key[1] = binary.LittleEndian.Uint64(key[8:])\n\th.Reset()\n\treturn h, nil\n}", "func (rng *Rng) Uint64() uint64 {\n\trng.State += 0x9E3779B97F4A7C15\n\tz := rng.State\n\tz = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9\n\tz = (z ^ (z >> 27)) * 0x94D049BB133111EB\n\treturn z ^ (z >> 31)\n}", "func NewUInt8() *UInt8 {\n\tself := UInt8{}\n\tself.SetDefaults()\n\treturn &self\n}", "func randUInt64() uint64 {\n\tbits := rand.Uint32() % 64\n\tif bits == 0 {\n\t\treturn 0\n\t}\n\tn := uint64(1 << (bits - 1))\n\tn += uint64(rand.Int63()) & ((1 << (bits - 1)) - 1)\n\treturn n\n}", "func GetUint64(key string) uint64 { return viper.GetUint64(key) }", "func NewUint(value uint) *Uint {\n\treturn &Uint{\n\t\tvalue: value,\n\t}\n}", "func (m Measurement) AddUInt64(name string, value uint64) Measurement {\n\tm.fieldSet[name] = value\n\treturn m\n}", "func Uint64Tag(name interface{}, value uint64) Tag {\n\treturn &tag{\n\t\ttagType: TagUint64,\n\t\tname: name,\n\t\tvalue: value,\n\t}\n}", "func New() UID {\n\treturn UID{\n\t\tNullUUID: uuid.NullUUID{UUID: uuid.New(), Valid: true},\n\t}\n}", "func Uint64Var(p *uint64, name string, value uint64, usage string) {\n\tadd(name, newUint64Value(value, p), usage)\n}", "func NewUID(param ...int) (string, error) {\n\tvar size int\n\tif len(param) == 0 {\n\t\tsize = defaultSize\n\t} else {\n\t\tsize = param[0]\n\t}\n\tbytes := make([]byte, size)\n\t_, err := BytesGenerator(bytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tid := make([]byte, size)\n\tfor i := 0; i < size; i++ {\n\t\tid[i] = defaultAlphabet[bytes[i]&63]\n\t}\n\treturn string(id[:size]), nil\n}", "func New64WithSeed(seed uint64) *Digest64 {\n\treturn (*Digest64)(New128WithSeed(seed, seed))\n}", "func (r *Rand) Uint64() uint64 {\n\t*r ^= Rand(uint64(*r) >> 12)\n\t*r ^= Rand(uint64(*r) << 25)\n\t*r ^= Rand(uint64(*r) >> 27)\n\treturn uint64(*r) * 2685821657736338717\n}", "func (f *Form) Uint64(param string, defaultValue uint64) uint64 {\n\tvals, ok := f.values[param]\n\tif !ok {\n\t\treturn defaultValue\n\t}\n\tparamVal, err := strconv.ParseUint(vals[0], 10, 64)\n\tif err != nil {\n\t\tf.err = err\n\t\treturn defaultValue\n\t}\n\treturn paramVal\n}", "func Uint64(input []byte, startBitPos int) (result uint64, resultPtr *uint64, err error) {\n\tif Len(input)-startBitPos < 64 {\n\t\treturn 0, nil, errors.New(\"Input is less than 64 bits\")\n\t}\n\n\ttmpArr, _, err := SubBits(input, startBitPos, 64)\n\tresult = binary.BigEndian.Uint64(tmpArr)\n\n\treturn result, &result, err\n}", "func (c *Config) GetUint64(pattern string, def ...interface{}) uint64 {\n\tif j := c.getJson(); j != nil {\n\t\treturn j.GetUint64(pattern, def...)\n\t}\n\treturn 0\n}", "func (c UintCodec) New() unsafe.Pointer {\n\treturn unsafe.Pointer(new(uint))\n}", "func Uint64(val interface{}) uint64 {\r\n\r\n\tswitch t := val.(type) {\r\n\tcase int:\r\n\t\treturn uint64(t)\r\n\tcase int8:\r\n\t\treturn uint64(t)\r\n\tcase int16:\r\n\t\treturn uint64(t)\r\n\tcase int32:\r\n\t\treturn uint64(t)\r\n\tcase int64:\r\n\t\treturn uint64(t)\r\n\tcase uint:\r\n\t\treturn uint64(t)\r\n\tcase uint8:\r\n\t\treturn uint64(t)\r\n\tcase uint16:\r\n\t\treturn uint64(t)\r\n\tcase uint32:\r\n\t\treturn uint64(t)\r\n\tcase uint64:\r\n\t\treturn uint64(t)\r\n\tcase float32:\r\n\t\treturn uint64(t)\r\n\tcase float64:\r\n\t\treturn uint64(t)\r\n\tcase bool:\r\n\t\tif t == true {\r\n\t\t\treturn uint64(1)\r\n\t\t}\r\n\t\treturn uint64(0)\r\n\tdefault:\r\n\t\ts := String(val)\r\n\t\ti, _ := strconv.ParseUint(s, 10, 64)\r\n\t\treturn i\r\n\t}\r\n\r\n\tpanic(\"Reached\")\r\n\r\n}" ]
[ "0.78732526", "0.7719561", "0.7704975", "0.75963604", "0.75139385", "0.73335713", "0.7065201", "0.69081914", "0.6897038", "0.6895006", "0.6835414", "0.679808", "0.6780824", "0.6757169", "0.67129046", "0.6652362", "0.65899986", "0.65518826", "0.6498531", "0.6391094", "0.63601905", "0.6358408", "0.6328706", "0.6294023", "0.6281588", "0.6245674", "0.6243125", "0.6219799", "0.6219799", "0.6219799", "0.6200128", "0.6189401", "0.61795473", "0.617936", "0.61450696", "0.6122898", "0.6122843", "0.6109659", "0.6095476", "0.6084508", "0.6084508", "0.6072288", "0.6063395", "0.6061887", "0.6053008", "0.6032076", "0.6003062", "0.598464", "0.5952895", "0.5936909", "0.593509", "0.5934052", "0.5934036", "0.5925494", "0.5922329", "0.58454585", "0.5845201", "0.5835321", "0.5832033", "0.58233404", "0.581233", "0.58053005", "0.57914317", "0.57876575", "0.57679105", "0.5747308", "0.5695887", "0.5693002", "0.5680351", "0.5673168", "0.5656887", "0.56364256", "0.56207734", "0.56205714", "0.56205714", "0.5614209", "0.5609516", "0.5602703", "0.5589012", "0.55815244", "0.5579713", "0.5579118", "0.5575718", "0.5571115", "0.5557104", "0.55544806", "0.5553747", "0.5552259", "0.55460966", "0.5543515", "0.5541354", "0.5539374", "0.5539201", "0.5530275", "0.5520227", "0.55163693", "0.5507413", "0.55030245", "0.5500815", "0.54991364" ]
0.8665488
0
CloneUInt64Slice clones src to dst by calling Clone for each element in src. Panics if len(dst) < len(src).
func CloneUInt64Slice(dst, src []UInt64) { for i := range src { dst[i] = *src[i].Clone() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CloneUInt8Slice(dst, src []UInt8) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func CloneImuSlice(dst, src []Imu) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func CloneFloat64Slice(dst, src []Float64) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func CloneUInt16MultiArraySlice(dst, src []UInt16MultiArray) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func Uint64Slice(src []*uint64) []uint64 {\n\tdst := make([]uint64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tif src[i] != nil {\n\t\t\tdst[i] = *(src[i])\n\t\t}\n\t}\n\treturn dst\n}", "func (es Int64DataPointSlice) CopyTo(dest Int64DataPointSlice) {\n\tnewLen := es.Len()\n\tif newLen == 0 {\n\t\t*dest.orig = []*otlpmetrics.Int64DataPoint(nil)\n\t\treturn\n\t}\n\toldLen := dest.Len()\n\tif newLen <= oldLen {\n\t\t(*dest.orig) = (*dest.orig)[:newLen]\n\t\tfor i, el := range *es.orig {\n\t\t\tnewInt64DataPoint(&el).CopyTo(newInt64DataPoint(&(*dest.orig)[i]))\n\t\t}\n\t\treturn\n\t}\n\torigs := make([]otlpmetrics.Int64DataPoint, newLen)\n\twrappers := make([]*otlpmetrics.Int64DataPoint, newLen)\n\tfor i, el := range *es.orig {\n\t\twrappers[i] = &origs[i]\n\t\tnewInt64DataPoint(&el).CopyTo(newInt64DataPoint(&wrappers[i]))\n\t}\n\t*dest.orig = wrappers\n}", "func Uint64PtrSlice(src []uint64) []*uint64 {\n\tdst := make([]*uint64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "func CutUint64(slice []uint64, i, j uint64) []uint64 {\n\treturn append(slice[:i], slice[j:]...)\n}", "func (ids IDSlice) Copy() IDSlice {\n\tn := len(ids)\n\tnewIds := make([]ID, n)\n\tcopy(newIds, ids)\n\treturn newIds\n}", "func Uint64SlicePtr(src []uint64) []*uint64 {\n\tdst := make([]*uint64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "func Int64Slice(src []*int64) []int64 {\n\tdst := make([]int64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tif src[i] != nil {\n\t\t\tdst[i] = *(src[i])\n\t\t}\n\t}\n\treturn dst\n}", "func NewFromUint64Slice(items []uint64) *SliceOfUint64 {\n\tslicy := &SliceOfUint64{items}\n\treturn slicy\n}", "func CloneTimeReferenceSlice(dst, src []TimeReference) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func Uint64(src []uint64) []uint64 {\n\tdst := make([]uint64, len(src))\n\tcopy(dst, src)\n\treturn dst\n}", "func Int64PtrSlice(src []int64) []*int64 {\n\tdst := make([]*int64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "func clone(dst, src *image.Gray) {\n\tif dst.Stride == src.Stride {\n\t\t// no need to correct stride, simply copy pixels.\n\t\tcopy(dst.Pix, src.Pix)\n\t\treturn\n\t}\n\t// need to correct stride.\n\tfor i := 0; i < src.Rect.Dy(); i++ {\n\t\tdstH := i * dst.Stride\n\t\tsrcH := i * src.Stride\n\t\tcopy(dst.Pix[dstH:dstH+dst.Stride], src.Pix[srcH:srcH+dst.Stride])\n\t}\n}", "func ucopy(dst, src uptr, size uintptr) {\n\telems := (*reflect.SliceHeader)(src).Len\n\tif elems == 0 {\n\t\treturn\n\t}\n\t// Access the slice's underlying data\n\tsrc = uptr((*reflect.SliceHeader)(src).Data)\n\tcopy(\n\t\t(*[math.MaxInt32]byte)(dst)[:uintptr(elems)*size],\n\t\t(*[math.MaxInt32]byte)(src)[:uintptr(elems)*size],\n\t)\n}", "func Int64SlicePtr(src []int64) []*int64 {\n\tdst := make([]*int64, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "func (x *BigUInt) Copy() *BigUInt {\n\ty := &BigUInt{\n\t\tdata: make([]uint8, len(x.data)),\n\t}\n\tfor i, v := range x.data {\n\t\ty.data[i] = v\n\t}\n\treturn y\n}", "func CloneUnloadNode_ResponseSlice(dst, src []UnloadNode_Response) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func CloneProjectedMapSlice(dst, src []ProjectedMap) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func CloneLoadNode_ResponseSlice(dst, src []LoadNode_Response) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func ToUInt64Slice(v []byte) ([]uint64, error) {\n\tpacket, _, err := DecodeNodePacket(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !packet.IsSlice() {\n\t\treturn nil, fmt.Errorf(\"v not a slice: %v\", utils.FormatBytes(v))\n\t}\n\tresult := make([]uint64, 0)\n\tfor _, p := range packet.PrimitivePackets {\n\t\tv, _ := p.ToUInt64()\n\t\tresult = append(result, v)\n\t}\n\treturn result, nil\n}", "func TakeUint64Ptr(n int, list []*uint64) []*uint64 {\n\tif n < 0 {\n\t\treturn []*uint64{}\n\t}\n\n\tnewListLen := len(list)\n\n\tif n < newListLen {\n\t\tnewListLen = n\n\t}\n\tnewList := make([]*uint64, newListLen)\n\tfor i := 0; i < newListLen; i++ {\n\t\tnewList[i] = list[i]\n\t}\n\treturn newList\n}", "func DeleteUint64(slice []uint64, sep uint64) []uint64 {\n\treturn append(slice[:sep], slice[sep+1:]...)\n}", "func TakeUint64(n int, list []uint64) []uint64 {\n\tif n < 0 {\n\t\treturn []uint64{}\n\t}\n\n\tnewListLen := len(list)\n\n\tif n < newListLen {\n\t\tnewListLen = n\n\t}\n\tnewList := make([]uint64, newListLen)\n\tfor i := 0; i < newListLen; i++ {\n\t\tnewList[i] = list[i]\n\t}\n\treturn newList\n}", "func slicecopy(toPtr unsafe.Pointer, toLen int, fromPtr unsafe.Pointer, fromLen int, width uintptr) int {\n\tif fromLen == 0 || toLen == 0 {\n\t\treturn 0\n\t}\n\n\tn := fromLen\n\tif toLen < n {\n\t\tn = toLen\n\t}\n\n\tif width == 0 {\n\t\treturn n\n\t}\n\n\tsize := uintptr(n) * width\n\tif raceenabled {\n\t\tcallerpc := getcallerpc()\n\t\tpc := funcPC(slicecopy)\n\t\tracereadrangepc(fromPtr, size, callerpc, pc)\n\t\tracewriterangepc(toPtr, size, callerpc, pc)\n\t}\n\tif msanenabled {\n\t\tmsanread(fromPtr, size)\n\t\tmsanwrite(toPtr, size)\n\t}\n\n\tif size == 1 { // common case worth about 2x to do here\n\t\t// TODO: is this still worth it with new memmove impl?\n\t\t*(*byte)(toPtr) = *(*byte)(fromPtr) // known to be a byte pointer\n\t} else {\n\t\tmemmove(toPtr, fromPtr, size)\n\t}\n\treturn n\n}", "func (ms *MySlice) Clone() Data {\n\tscopy := make([]int, len(ms.Slice))\n\tcopy(scopy, ms.Slice)\n\tmyslice := new(MySlice)\n\tmyslice.Slice = scopy\n\treturn Data(myslice)\n}", "func SortCopy(x []uint64) []uint64 {\n\ty := make([]uint64, len(x))\n\tcopy(y, x)\n\tSort(y)\n\treturn y\n}", "func memcpy(dst, src unsafe.Pointer, size uintptr)", "func (n *Int64Node) Copy() (n2 *Int64Node) {\n\tn2 = &Int64Node{Value: n.Value}\n\tif len(n.Children) == 0 {\n\t\treturn\n\t}\n\tn2.Children = make([]*Int64Node, len(n.Children))\n\tfor i, nx := range n.Children {\n\t\tif nx != nil {\n\t\t\tn2.Children[i] = nx.Copy()\n\t\t}\n\t}\n\treturn\n}", "func UnpackInt64(dst []int64, src []byte, bitWidth uint) {\n\t_ = src[:ByteCount(bitWidth*uint(len(dst))+8*PaddingInt64)]\n\tunpackInt64(dst, src, bitWidth)\n}", "func sliceUI64(in []byte) []uint64 {\n return (*(*[]uint64)(unsafe.Pointer(&in)))[:len(in)/8]\n}", "func (s Int64) Clone() Int64 {\n\treturn Int64(cast(s).Clone())\n}", "func CloneConfigLogger_ResponseSlice(dst, src []ConfigLogger_Response) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func (s Uint64Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }", "func ShiftUint64(slice []uint64) (uint64, []uint64) {\n\treturn slice[0], slice[1:]\n}", "func CloneTemperatureSlice(dst, src []Temperature) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func CloneMultiNestedSlice(dst, src []MultiNested) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func (dc *Int64DictConverter) Copy(out interface{}, vals []utils.IndexType) error {\n\to := out.([]int64)\n\tfor idx, val := range vals {\n\t\to[idx] = dc.dict[val]\n\t}\n\treturn nil\n}", "func CloneVector3StampedSlice(dst, src []Vector3Stamped) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func ClonePlaneSlice(dst, src []Plane) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func (s *syncMapInt64) copy(dst *syncMapInt64) {\n\tfor _, t := range s.keys() {\n\t\tdst.store(t, s.load(t))\n\t}\n}", "func (mm Uint64Uint64Map) Clone() Uint64Uint64Map {\n\tresult := NewUint64Uint64Map()\n\tfor k, v := range mm {\n\t\tresult[k] = v\n\t}\n\treturn result\n}", "func Copy(x, y Vector) {\n\tif x.N != y.N {\n\t\tpanic(badLength)\n\t}\n\tcblas128.Zcopy(x.N, x.Data, x.Inc, y.Data, y.Inc)\n}", "func UintSlice(src []*uint) []uint {\n\tdst := make([]uint, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tif src[i] != nil {\n\t\t\tdst[i] = *(src[i])\n\t\t}\n\t}\n\treturn dst\n}", "func (set Int64Set) Clone() Int64Set {\n\tclonedSet := NewInt64Set()\n\tfor v := range set {\n\t\tclonedSet.doAdd(v)\n\t}\n\treturn clonedSet\n}", "func CloneWStringSlice(dst, src []WString) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func ToInt64Slice(v []byte) ([]int64, error) {\n\tpacket, _, err := DecodeNodePacket(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !packet.IsSlice() {\n\t\treturn nil, fmt.Errorf(\"v not a slice: %v\", utils.FormatBytes(v))\n\t}\n\tresult := make([]int64, 0)\n\tfor _, p := range packet.PrimitivePackets {\n\t\tv, _ := p.ToInt64()\n\t\tresult = append(result, v)\n\t}\n\treturn result, nil\n}", "func CopySlice(slice []byte) []byte {\n\tcopy := append(slice[:0:0], slice...)\n\treturn copy\n}", "func (bio *BinaryIO) Copy(dst int64, src int64, count int) error {\n\tbuf := makeBuf(count)\n\tfor count > 0 {\n\t\tbuf = truncBuf(buf, count)\n\t\tbio.ReadAt(src, buf)\n\t\tbio.WriteAt(dst, buf)\n\t\tcount -= len(buf)\n\t\tsrc += int64(len(buf))\n\t\tdst += int64(len(buf))\n\t}\n\treturn nil\n}", "func CloneKeyValueSlice(dst, src []KeyValue) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func cloneArray(source []int) []int {\n\tn := len(source)\n\tdestination := make([]int, n, n)\n\tcopy(source, destination)\n\treturn destination\n}", "func NewFromInt64Slice(items []int64) *SliceOfInt64 {\n\tslicy := &SliceOfInt64{items}\n\treturn slicy\n}", "func AppendUints64(dst []byte, vals []uint64) []byte {\n\tmajor := majorTypeArray\n\tl := len(vals)\n\tif l == 0 {\n\t\treturn AppendArrayEnd(AppendArrayStart(dst))\n\t}\n\tif l <= additionalMax {\n\t\tlb := byte(l)\n\t\tdst = append(dst, byte(major|lb))\n\t} else {\n\t\tdst = appendCborTypePrefix(dst, major, uint64(l))\n\t}\n\tfor _, v := range vals {\n\t\tdst = AppendUint64(dst, v)\n\t}\n\treturn dst\n}", "func emitCopyNoRepeat(dst []byte, offset, length int) int {\n\tif offset >= 65536 {\n\t\ti := 0\n\t\tif length > 64 {\n\t\t\t// Emit a length 64 copy, encoded as 5 bytes.\n\t\t\tdst[4] = uint8(offset >> 24)\n\t\t\tdst[3] = uint8(offset >> 16)\n\t\t\tdst[2] = uint8(offset >> 8)\n\t\t\tdst[1] = uint8(offset)\n\t\t\tdst[0] = 63<<2 | tagCopy4\n\t\t\tlength -= 64\n\t\t\tif length >= 4 {\n\t\t\t\t// Emit remaining as repeats\n\t\t\t\treturn 5 + emitCopyNoRepeat(dst[5:], offset, length)\n\t\t\t}\n\t\t\ti = 5\n\t\t}\n\t\tif length == 0 {\n\t\t\treturn i\n\t\t}\n\t\t// Emit a copy, offset encoded as 4 bytes.\n\t\tdst[i+0] = uint8(length-1)<<2 | tagCopy4\n\t\tdst[i+1] = uint8(offset)\n\t\tdst[i+2] = uint8(offset >> 8)\n\t\tdst[i+3] = uint8(offset >> 16)\n\t\tdst[i+4] = uint8(offset >> 24)\n\t\treturn i + 5\n\t}\n\n\t// Offset no more than 2 bytes.\n\tif length > 64 {\n\t\t// Emit a length 60 copy, encoded as 3 bytes.\n\t\t// Emit remaining as repeat value (minimum 4 bytes).\n\t\tdst[2] = uint8(offset >> 8)\n\t\tdst[1] = uint8(offset)\n\t\tdst[0] = 59<<2 | tagCopy2\n\t\tlength -= 60\n\t\t// Emit remaining as repeats, at least 4 bytes remain.\n\t\treturn 3 + emitCopyNoRepeat(dst[3:], offset, length)\n\t}\n\tif length >= 12 || offset >= 2048 {\n\t\t// Emit the remaining copy, encoded as 3 bytes.\n\t\tdst[2] = uint8(offset >> 8)\n\t\tdst[1] = uint8(offset)\n\t\tdst[0] = uint8(length-1)<<2 | tagCopy2\n\t\treturn 3\n\t}\n\t// Emit the remaining copy, encoded as 2 bytes.\n\tdst[1] = uint8(offset)\n\tdst[0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1\n\treturn 2\n}", "func CloneMultiDOFJointTrajectoryPointSlice(dst, src []MultiDOFJointTrajectoryPoint) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func bytesFromUInt64(src uint64) []uint8 {\n\tres := make([]uint8, 0, 8) // allocates a slice with capacity 8 but size 0, which\n\t// will \"grow\" as needed, up to the size of a uint64\n\tacc := src\n\tfor acc != 0 {\n\t\tres = append(res, uint8(acc&0xFF)) // casts, like from 64 to 8 bit ints, are almost always explicit in golang\n\t\tacc >>= 8\n\t}\n\treturn res\n}", "func CloneSliceOfString(n []string) []string {\n\tres := make([]string, 0, len(n))\n\tcopy(res, n)\n\treturn res\n}", "func MarshalVarUint64s(dst []byte, us []uint64) []byte {\n\tfor _, u := range us {\n\t\tif u < 0x80 {\n\t\t\t// Fast path\n\t\t\tdst = append(dst, byte(u))\n\t\t\tcontinue\n\t\t}\n\t\tfor u > 0x7f {\n\t\t\tdst = append(dst, 0x80|byte(u))\n\t\t\tu >>= 7\n\t\t}\n\t\tdst = append(dst, byte(u))\n\t}\n\treturn dst\n}", "func Copy(input []float64) []float64 {\n\toutput := make([]float64, len(input))\n\tcopy(output, input)\n\treturn output\n}", "func Slice_uint64_CTor() CGoHandle {\n\treturn CGoHandle(handleFromPtr_Slice_uint64(&[]uint64{}))\n}", "func UnshiftUint64(sep uint64, i []uint64) []uint64 {\n\treturn append([]uint64{sep}, i...)\n}", "func copy2DSlice(sourceSlice [][]byte, destinationSlice [][]byte) {\n\tfor i := 0; i < len(sourceSlice); i++ {\n\t\tfor j := 0; j < len(sourceSlice[i]); j++ {\n\t\t\tdestinationSlice[i][j] = sourceSlice[i][j]\n\t\t}\n\t}\n}", "func GetUint64s(size int) *Uint64s {\n\tv := uint64sPool.Get()\n\tif v == nil {\n\t\treturn &Uint64s{\n\t\t\tA: make([]uint64, size),\n\t\t}\n\t}\n\tis := v.(*Uint64s)\n\tif n := size - cap(is.A); n > 0 {\n\t\tis.A = append(is.A[:cap(is.A)], make([]uint64, n)...)\n\t}\n\tis.A = is.A[:size]\n\treturn is\n}", "func UnmarshalVarInt64s(dst []int64, src []byte) ([]byte, error) {\n\tidx := uint(0)\n\tfor i := range dst {\n\t\tif idx >= uint(len(src)) {\n\t\t\treturn nil, fmt.Errorf(\"cannot unmarshal varint from empty data\")\n\t\t}\n\t\tc := src[idx]\n\t\tidx++\n\t\tif c < 0x80 {\n\t\t\t// Fast path\n\t\t\tv := int8(c>>1) ^ (int8(c<<7) >> 7) // zig-zag decoding without branching.\n\t\t\tdst[i] = int64(v)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Slow path\n\t\tu := uint64(c & 0x7f)\n\t\tstartIdx := idx - 1\n\t\tshift := uint8(0)\n\t\tfor c >= 0x80 {\n\t\t\tif idx >= uint(len(src)) {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected end of encoded varint at byte %d; src=%x\", idx-startIdx, src[startIdx:])\n\t\t\t}\n\t\t\tif idx-startIdx > 9 {\n\t\t\t\treturn src[idx:], fmt.Errorf(\"too long encoded varint; the maximum allowed length is 10 bytes; got %d bytes; src=%x\",\n\t\t\t\t\t(idx-startIdx)+1, src[startIdx:])\n\t\t\t}\n\t\t\tc = src[idx]\n\t\t\tidx++\n\t\t\tshift += 7\n\t\t\tu |= uint64(c&0x7f) << shift\n\t\t}\n\t\tv := int64(u>>1) ^ (int64(u<<63) >> 63) // zig-zag decoding without branching.\n\t\tdst[i] = v\n\t}\n\treturn src[idx:], nil\n}", "func MarshalVarInt64s(dst []byte, vs []int64) []byte {\n\tfor _, v := range vs {\n\t\tif v < 0x40 && v > -0x40 {\n\t\t\t// Fast path\n\t\t\tc := int8(v)\n\t\t\tv := (c << 1) ^ (c >> 7) // zig-zag encoding without branching.\n\t\t\tdst = append(dst, byte(v))\n\t\t\tcontinue\n\t\t}\n\n\t\tv = (v << 1) ^ (v >> 63) // zig-zag encoding without branching.\n\t\tu := uint64(v)\n\t\tfor u > 0x7f {\n\t\t\tdst = append(dst, 0x80|byte(u))\n\t\t\tu >>= 7\n\t\t}\n\t\tdst = append(dst, byte(u))\n\t}\n\treturn dst\n}", "func BenchmarkDupSet64(b *testing.B) {\n\tdupInit(b)\n\tfor n := 0; n < b.N; n++ {\n\t\tdupIntSet64Data.Dup()\n\t}\n}", "func TakeInt64Ptr(n int, list []*int64) []*int64 {\n\tif n < 0 {\n\t\treturn []*int64{}\n\t}\n\n\tnewListLen := len(list)\n\n\tif n < newListLen {\n\t\tnewListLen = n\n\t}\n\tnewList := make([]*int64, newListLen)\n\tfor i := 0; i < newListLen; i++ {\n\t\tnewList[i] = list[i]\n\t}\n\treturn newList\n}", "func (s *Uint64) Slice() []uint64 {\n\tres := make([]uint64, 0, len(s.m))\n\n\tfor val := range s.m {\n\t\tres = append(res, val)\n\t}\n\treturn res\n}", "func Copy(dst Mutable, src Const) {\n\tif err := errIfDimsNotEq(src, dst); err != nil {\n\t\tpanic(err)\n\t}\n\n\tm, n := src.Dims()\n\tfor i := 0; i < m; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tdst.Set(i, j, src.At(i, j))\n\t\t}\n\t}\n}", "func dedupInt64s(s []int64) []int64 {\n\tp := len(s) - 1\n\tif p <= 0 {\n\t\treturn s\n\t}\n\n\tfor i := p - 1; i >= 0; i-- {\n\t\tif s[p] != s[i] {\n\t\t\tp--\n\t\t\ts[p] = s[i]\n\t\t}\n\t}\n\n\treturn s[p:]\n}", "func copySlice(a []byte) []byte {\n\trv := make([]byte, len(a))\n\tcopy(rv, a)\n\treturn rv\n}", "func ReversedUint64(slice []uint64) []uint64 {\n\tfor left, right := 0, len(slice)-1; left < right; left, right = left+1, right-1 {\n\t\tslice[left], slice[right] = slice[right], slice[left]\n\t}\n\treturn slice\n}", "func (s *SliceOfUint64) Unshift(item uint64) *SliceOfUint64 {\n\ts.items = append([]uint64{item}, s.items...)\n\treturn s\n}", "func CloneGetAvailableStates_ResponseSlice(dst, src []GetAvailableStates_Response) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func (c *SequenceClockImpl) clone() SequenceClockImpl {\n\tcopy := SequenceClockImpl{\n\t\tvalue: make([]uint64, KMaxVbNo),\n\t\tcas: c.cas,\n\t}\n\n\tfor k, v := range c.value {\n\t\tcopy.value[k] = v\n\t}\n\treturn copy\n}", "func UnmarshalVarUint64s(dst []uint64, src []byte) ([]byte, error) {\n\tidx := uint(0)\n\tfor i := range dst {\n\t\tif idx >= uint(len(src)) {\n\t\t\treturn nil, fmt.Errorf(\"cannot unmarshal varuint from empty data\")\n\t\t}\n\t\tc := src[idx]\n\t\tidx++\n\t\tif c < 0x80 {\n\t\t\t// Fast path\n\t\t\tdst[i] = uint64(c)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Slow path\n\t\tu := uint64(c & 0x7f)\n\t\tstartIdx := idx - 1\n\t\tshift := uint8(0)\n\t\tfor c >= 0x80 {\n\t\t\tif idx >= uint(len(src)) {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected end of encoded varint at byte %d; src=%x\", idx-startIdx, src[startIdx:])\n\t\t\t}\n\t\t\tif idx-startIdx > 9 {\n\t\t\t\treturn src[idx:], fmt.Errorf(\"too long encoded varint; the maximum allowed length is 10 bytes; got %d bytes; src=%x\",\n\t\t\t\t\t(idx-startIdx)+1, src[startIdx:])\n\t\t\t}\n\t\t\tc = src[idx]\n\t\t\tidx++\n\t\t\tshift += 7\n\t\t\tu |= uint64(c&0x7f) << shift\n\t\t}\n\t\tdst[i] = u\n\t}\n\treturn src[idx:], nil\n}", "func Clone(in []string) (out []string) {\n\tout = make([]string, len(in))\n\tcopy(out, in)\n\treturn\n}", "func (s *SliceOfUint64) Shift() *SliceOfUint64 {\n\ts.items = s.items[1:]\n\treturn s\n}", "func copyIntSlice(s []int) []int {\n\tcopy := []int{}\n\tfor _, item := range s {\n\t\tcopy = append(copy, item)\n\t}\n\treturn copy\n}", "func (s *SliceOfUint64) Concat(items []uint64) *SliceOfUint64 {\n\ts.items = append(s.items, items...)\n\treturn s\n}", "func CloneNodeEntitiesInfoSlice(dst, src []NodeEntitiesInfo) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func MarshalVarUint64(dst []byte, u uint64) []byte {\n\tvar tmp [1]uint64\n\ttmp[0] = u\n\treturn MarshalVarUint64s(dst, tmp[:])\n}", "func CopyMem(source uint64, dest uint64, size uint64)", "func (x Vector64) Clone() Vector64 {\n\tcloneX := make(Vector64, len(x))\n\tcopy(cloneX, x)\n\treturn cloneX\n}", "func Int64(src []int64) []int64 {\n\tdst := make([]int64, len(src))\n\tcopy(dst, src)\n\treturn dst\n}", "func CycleUint64(s []uint64) <-chan uint64 {\n\tch := make(chan uint64, 1)\n\tgo func() {\n\t\tfor i := 0;; i++ {\n\t\t\tch <- s[i%len(s)]\n\t\t}\n\t}()\n\treturn ch\n}", "func UintPtrSlice(src []uint) []*uint {\n\tdst := make([]*uint, len(src))\n\tfor i := 0; i < len(src); i++ {\n\t\tdst[i] = &(src[i])\n\t}\n\treturn dst\n}", "func loadPrefixSafe(dst []byte, src []uint64, length int) ([]byte, int) {\n\t// prefix is stored as 8-byte multiples (uint64)\n\tvar (\n\t\tslots int\n\t\tdl int\n\t)\n\tif length == 255 {\n\t\t// prefixLen == 255 means it's >= 255, the real length is for simplicity stored in the next 8 byte slot (the unsafe version uses only 2 bytes for length)\n\t\tlength = int(src[0])\n\t\tslots = (length + 7) >> 3\n\t\tdl = slots << 3\n\t\tsrc = src[1 : slots+1]\n\t\tslots++\n\t} else {\n\t\tslots = (length + 7) >> 3\n\t\tdl = slots << 3\n\t\tsrc = src[:slots]\n\t}\n\t// fix size of dst\n\tif cap(dst) >= dl {\n\t\tdst = dst[:dl]\n\t} else {\n\t\tdst = make([]byte, dl)\n\t}\n\tk := 0\n\tfor _, a := range src {\n\t\t//binary.BigEndian.PutUint64(dst[k:k+8], a)\n\t\tfor j := 7; j >= 0; j-- {\n\t\t\tdst[k+j] = byte(a)\n\t\t\ta = a >> 8\n\t\t}\n\t\tk += 8\n\t}\n\treturn dst[:length], slots\n}", "func (ms Int64DataPoint) CopyTo(dest Int64DataPoint) {\n\tif ms.IsNil() {\n\t\t*dest.orig = nil\n\t\treturn\n\t}\n\tif dest.IsNil() {\n\t\tdest.InitEmpty()\n\t}\n\tms.LabelsMap().CopyTo(dest.LabelsMap())\n\tdest.SetStartTime(ms.StartTime())\n\tdest.SetTimestamp(ms.Timestamp())\n\tdest.SetValue(ms.Value())\n}", "func CloneSliceOfColIdent(n []ColIdent) []ColIdent {\n\tres := make([]ColIdent, 0, len(n))\n\tfor _, x := range n {\n\t\tres = append(res, CloneColIdent(x))\n\t}\n\treturn res\n}", "func CloneLV(ctx context.Context, src, dest string) (string, error) {\n\t// FIXME(farcaller): bloody insecure. And broken.\n\tsp, _ := opentracing.StartSpanFromContext(ctx, \"sys.dd\")\n\tsp.SetTag(\"component\", \"dd\")\n\tsp.SetTag(\"span.kind\", \"client\")\n\tdefer sp.Finish()\n\n\tcmd := exec.Command(\"dd\", fmt.Sprintf(\"if=%s\", src), fmt.Sprintf(\"of=%s\", dest), \"bs=4M\")\n\tout, err := cmd.CombinedOutput()\n\treturn string(out), err\n}", "func CloneJoyFeedbackSlice(dst, src []JoyFeedback) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func CopyN(in chan int,\n\tout []chan int) {\n\tl := len(out)\n\tvar i, v int = 0, 0\n\tfor {\n\t\ti = 0\n\t\tv = <-in\n\t\tfor i < l {\n\t\t\tgo SendValue(v, out[i])\n\t\t\ti = i + 1\n\t\t}\n\t}\n}", "func CloneUpdateFilename_RequestSlice(dst, src []UpdateFilename_Request) {\n\tfor i := range src {\n\t\tdst[i] = *src[i].Clone()\n\t}\n}", "func InsertUint64(slice []uint64, element, position uint64) []uint64 {\n\treturn append(slice[:position], append([]uint64{element}, slice[position:]...)...)\n}", "func FromUint64(buffer [][]uint64, startRow, startCol, rows, cols int) ([][]uint64, error) {\n\tview := make([][]uint64, rows)\n\tif len(buffer) < startRow+rows {\n\t\treturn nil, fmt.Errorf(\"matrix has less rows than asked: %d x %d\", len(buffer), startRow+rows)\n\t}\n\tfor i := range view {\n\t\tif len(buffer[startRow+i]) < startCol+cols {\n\t\t\treturn nil, fmt.Errorf(\"row %d has less cols than asked: %d x %d\", i, len(buffer[startRow+i]), startCol+cols)\n\t\t}\n\t\tview[i] = buffer[startRow+i][startCol : startCol+cols : startCol+cols]\n\t}\n\treturn view, nil\n}", "func (pu *ProxyUser) DeepClone() *ProxyUser {\n\tif pu == nil {\n\t\treturn nil\n\t}\n\tcloned := ProxyUser{}\n\tcloned = *pu\n\tcloned.StorageArrayIdentifiers = make([]string, len(pu.StorageArrayIdentifiers))\n\tcopy(cloned.StorageArrayIdentifiers, pu.StorageArrayIdentifiers)\n\treturn &cloned\n}", "func UnmarshalVarInt64(src []byte) ([]byte, int64, error) {\n\tvar tmp [1]int64\n\ttail, err := UnmarshalVarInt64s(tmp[:], src)\n\treturn tail, tmp[0], err\n}" ]
[ "0.6897268", "0.6507103", "0.6395663", "0.6381664", "0.61048645", "0.56997764", "0.5694446", "0.5657911", "0.5633476", "0.5577525", "0.55724555", "0.5572285", "0.5505419", "0.54988307", "0.5482363", "0.54418826", "0.5430907", "0.54308385", "0.5412383", "0.5385675", "0.52670246", "0.52437174", "0.52430093", "0.52284443", "0.5216756", "0.52140087", "0.5201792", "0.52011716", "0.5183444", "0.51328856", "0.5126937", "0.51168275", "0.5083611", "0.5059875", "0.50524676", "0.50518334", "0.5039812", "0.50249434", "0.50227284", "0.50227165", "0.50058264", "0.499699", "0.4986518", "0.4964682", "0.49377447", "0.4913171", "0.491036", "0.48759407", "0.48722032", "0.48523787", "0.48477834", "0.48308653", "0.48225892", "0.48192272", "0.4819107", "0.48166788", "0.4816673", "0.48156342", "0.480842", "0.47905096", "0.47895828", "0.47837487", "0.4783734", "0.4772127", "0.47621548", "0.47574523", "0.47568563", "0.47554728", "0.47549108", "0.47427493", "0.47411942", "0.47381243", "0.47353372", "0.47281605", "0.4710484", "0.47084403", "0.47081566", "0.4706102", "0.4703069", "0.47022346", "0.46855205", "0.4684928", "0.46823326", "0.46814775", "0.4674469", "0.4667699", "0.46659106", "0.4656125", "0.46541262", "0.46524563", "0.46322483", "0.46270362", "0.46166342", "0.46124965", "0.46036658", "0.45895413", "0.45879254", "0.45843855", "0.457561", "0.45749673" ]
0.83064985
0
GetEcsServiceConfig returns config for aws_ecs_service
func GetEcsServiceConfig(c *ecs.Service) []AWSResourceConfig { cf := EcsServiceConfig{ Config: Config{ Name: c.ServiceName, Tags: c.Tags, }, IamRole: c.Role, } return []AWSResourceConfig{{ Resource: cf, Metadata: c.AWSCloudFormationMetadata, }} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetServiceConfig(req *restful.Request, resp *restful.Response) {\n\tconst (\n\t\thandler = \"GetServiceConfig\"\n\t)\n\tspan := v1http.SetHTTPSpanContextInfo(req, handler)\n\tdefer span.Finish()\n\n\tr, err := generateData(req, getMultiCls)\n\tif err != nil {\n\t\tutils.SetSpanLogTagError(span, err)\n\t\tblog.Errorf(\"%s | err: %v\", common.BcsErrStorageGetResourceFailStr, err)\n\t\tlib.ReturnRest(&lib.RestResponse{\n\t\t\tResp: resp,\n\t\t\tErrCode: common.BcsErrStorageGetResourceFail,\n\t\t\tMessage: common.BcsErrStorageGetResourceFailStr})\n\t\treturn\n\t}\n\tlib.ReturnRest(&lib.RestResponse{Resp: resp, Data: r})\n}", "func (configProvider) GetServiceConfig(c context.Context) (*tricium.ServiceConfig, error) {\n\treturn getServiceConfig(c)\n}", "func getConfig() (aws.Config, error) {\n\tif os.Getenv(\"AWS_REGION\") == \"\" {\n\t\treturn aws.Config{}, errors.New(\"AWS_REGION is not set\")\n\t}\n\n\tvar cfg aws.Config\n\tvar err error\n\n\tif awsEndpoint := os.Getenv(\"CUSTOM_AWS_ENDPOINT_URL\"); awsEndpoint != \"\" {\n\t\tcustomResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {\n\t\t\treturn aws.Endpoint{\n\t\t\t\tPartitionID: \"aws\",\n\t\t\t\tURL: awsEndpoint,\n\t\t\t}, nil\n\t\t})\n\n\t\tcfg, err = config.LoadDefaultConfig(\n\t\t\tcontext.TODO(),\n\t\t\tconfig.WithEndpointResolverWithOptions(customResolver))\n\t} else {\n\t\tcfg, err = config.LoadDefaultConfig(context.TODO())\n\t}\n\n\tif err != nil {\n\t\treturn aws.Config{}, err\n\t}\n\treturn cfg, nil\n}", "func (mockProvider) GetServiceConfig(c context.Context) (*tricium.ServiceConfig, error) {\n\treturn &tricium.ServiceConfig{}, nil\n}", "func GetEsConfig(key string) ConfigEs {\n\tvar conf ConfigEs\n\tconf.Addr = GetString(key + \".\" + \"addr\")\n\tconf.UserName = GetString(key + \".\" + \"userName\")\n\tconf.Password = GetString(key + \".\" + \"password\")\n\tconf.TimeOutMs = GetUInt32(key + \".\" + \"timeOutMs\")\n\n\treturn conf\n}", "func (s *server) GetServiceConfig(ctx context.Context, _ *transactionpb.GetServiceConfigRequest) (*transactionpb.GetServiceConfigResponse, error) {\n\tsubsidizer := s.subsidizer.Public().(ed25519.PublicKey)\n\n\tappIndex, _ := app.GetAppIndex(ctx)\n\tif appIndex > 0 {\n\t\tcfg, err := s.appConfig.Get(ctx, appIndex)\n\t\tif err != nil && err != app.ErrNotFound {\n\t\t\treturn nil, status.Error(codes.Internal, \"failed to get app config\")\n\t\t} else if err == nil && cfg.Subsidizer != nil {\n\t\t\tsubsidizer = cfg.Subsidizer\n\t\t}\n\t}\n\n\treturn &transactionpb.GetServiceConfigResponse{\n\t\tToken: &commonpb.SolanaAccountId{\n\t\t\tValue: s.token,\n\t\t},\n\t\tTokenProgram: &commonpb.SolanaAccountId{\n\t\t\tValue: token.ProgramKey,\n\t\t},\n\t\tSubsidizerAccount: &commonpb.SolanaAccountId{\n\t\t\tValue: subsidizer,\n\t\t},\n\t}, nil\n}", "func (r *AppConfig) GetServiceConfig(sName string) CommonServiceConfig {\n\tsCfg, _ := r.ServiceConfig[sName]\n\n\treturn sCfg\n}", "func (s *Service) ServiceConfig() *registry.ServiceConfig {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.config.copy()\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 (client *ApiECSClient) serviceClient() (*svc.AmazonEC2ContainerServiceV20141113Client, error) {\n\tconfig := client.config\n\n\tsigner := authv4.NewHttpSigner(config.AWSRegion, ECS_SERVICE, client.CredentialProvider(), nil)\n\n\tc := codec.AwsJson{Host: config.APIEndpoint, SignerV4: signer}\n\n\td, err := dialer.TLS(config.APIEndpoint, config.APIPort, &tls.Config{InsecureSkipVerify: client.insecureSkipVerify})\n\n\tif err != nil {\n\t\tlog.Error(\"Cannot resolve url\", \"url\", config.APIEndpoint, \"port\", config.APIPort, \"err\", err)\n\t\treturn nil, err\n\t}\n\n\tecs := svc.NewAmazonEC2ContainerServiceV20141113Client(d, c)\n\treturn ecs, nil\n}", "func (p *DNSProvider) GetConfig() *aws.Config {\n\tawsConfig := &aws.Config{\n\t\tRegion: aws.String(\"us-west-2\"),\n\t\tCredentials: credentials.NewStaticCredentials(p.AccessKey, p.SecretKey, \"\"),\n\t}\n\treturn awsConfig\n}", "func getConfig() (aws.Config, error) {\n\tif os.Getenv(\"AWS_REGION\") == \"\" {\n\t\treturn aws.Config{}, errors.New(\"AWS_REGION is not set\")\n\t}\n\tcfg, err := config.LoadDefaultConfig(context.TODO())\n\tif err != nil {\n\t\treturn aws.Config{}, err\n\t}\n\treturn cfg, nil\n}", "func (s *site) getEtcdConfig(ctx context.Context, opCtx *operationContext, server *ProvisionedServer) (*etcdConfig, error) {\n\tetcdClient, err := clients.DefaultEtcdMembers()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tmembers, err := etcdClient.List(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tinitialCluster := []string{opCtx.provisionedServers.InitialCluster(s.domainName)}\n\t// add existing members\n\tfor _, member := range members {\n\t\taddress, err := utils.URLHostname(member.PeerURLs[0])\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tinitialCluster = append(initialCluster, fmt.Sprintf(\"%s:%s\",\n\t\t\tmember.Name, address))\n\t}\n\tproxyMode := etcdProxyOff\n\tif !server.IsMaster() {\n\t\tproxyMode = etcdProxyOn\n\t}\n\treturn &etcdConfig{\n\t\tinitialCluster: strings.Join(initialCluster, \",\"),\n\t\tinitialClusterState: etcdExistingCluster,\n\t\tproxyMode: proxyMode,\n\t}, nil\n}", "func (o FunctionOutput) ServiceConfig() ServiceConfigResponseOutput {\n\treturn o.ApplyT(func(v *Function) ServiceConfigResponseOutput { return v.ServiceConfig }).(ServiceConfigResponseOutput)\n}", "func GetHSSConfig() (*mconfig.HSSConfig, error) {\n\tserviceBaseName := filepath.Base(os.Args[0])\n\tserviceBaseName = strings.TrimSuffix(serviceBaseName, filepath.Ext(serviceBaseName))\n\tif hssServiceName != serviceBaseName {\n\t\tglog.Errorf(\n\t\t\t\"NOTE: HSS Service name: %s does not match its managed configs key: %s\\n\",\n\t\t\tserviceBaseName, hssServiceName)\n\t}\n\n\tconfigsPtr := &mconfig.HSSConfig{}\n\terr := configs.GetServiceConfigs(hssServiceName, configsPtr)\n\tif err != nil || configsPtr.Server == nil || configsPtr.DefaultSubProfile == nil {\n\t\tglog.Errorf(\"%s Managed Configs Load Error: %v\\n\", hssServiceName, err)\n\t\treturn &mconfig.HSSConfig{\n\t\t\tServer: &mconfig.DiamServerConfig{\n\t\t\t\tProtocol: diameter.GetValueOrEnv(diameter.NetworkFlag, ServerProtocol, hssDefaultProtocol),\n\t\t\t\tAddress: diameter.GetValueOrEnv(diameter.AddrFlag, ServerAddress, \"\"),\n\t\t\t\tLocalAddress: diameter.GetValueOrEnv(diameter.LocalAddrFlag, ServerLocalAddress, \"\"),\n\t\t\t\tDestHost: diameter.GetValueOrEnv(diameter.DestHostFlag, ServerDestHost, hssDefaultHost),\n\t\t\t\tDestRealm: diameter.GetValueOrEnv(diameter.DestRealmFlag, ServerDestRealm, hssDefaultRealm),\n\t\t\t},\n\t\t\tLteAuthOp: hssDefaultLteAuthOp,\n\t\t\tLteAuthAmf: hssDefaultLteAuthAmf,\n\t\t\tDefaultSubProfile: &mconfig.HSSConfig_SubscriptionProfile{\n\t\t\t\tMaxUlBitRate: diameter.GetValueUint64(maxUlBitRateFlag, defaultMaxUlBitRate),\n\t\t\t\tMaxDlBitRate: diameter.GetValueUint64(maxDlBitRateFlag, defaultMaxDlBitRate),\n\t\t\t},\n\t\t\tSubProfiles: make(map[string]*mconfig.HSSConfig_SubscriptionProfile),\n\t\t\tStreamSubscribers: *streamSubscribersFlag,\n\t\t}, err\n\t}\n\n\tglog.V(2).Infof(\"Loaded %s configs: %+v\\n\", hssServiceName, configsPtr)\n\treturn &mconfig.HSSConfig{\n\t\tServer: &mconfig.DiamServerConfig{\n\t\t\tAddress: diameter.GetValue(diameter.AddrFlag, configsPtr.Server.Address),\n\t\t\tProtocol: diameter.GetValue(diameter.NetworkFlag, configsPtr.Server.Protocol),\n\t\t\tLocalAddress: diameter.GetValue(diameter.LocalAddrFlag, configsPtr.Server.LocalAddress),\n\t\t\tDestHost: diameter.GetValue(diameter.DestHostFlag, configsPtr.Server.DestHost),\n\t\t\tDestRealm: diameter.GetValue(diameter.DestRealmFlag, configsPtr.Server.DestRealm),\n\t\t},\n\t\tLteAuthOp: configsPtr.LteAuthOp,\n\t\tLteAuthAmf: configsPtr.LteAuthAmf,\n\t\tDefaultSubProfile: &mconfig.HSSConfig_SubscriptionProfile{\n\t\t\tMaxUlBitRate: diameter.GetValueUint64(maxUlBitRateFlag, configsPtr.DefaultSubProfile.MaxUlBitRate),\n\t\t\tMaxDlBitRate: diameter.GetValueUint64(maxDlBitRateFlag, configsPtr.DefaultSubProfile.MaxDlBitRate),\n\t\t},\n\t\tSubProfiles: configsPtr.SubProfiles,\n\t\tStreamSubscribers: configsPtr.StreamSubscribers || *streamSubscribersFlag,\n\t}, nil\n}", "func (s *server) GetConfig(c context.Context, req *google.Empty) (*logdog.GetConfigResponse, error) {\n\tgcfg, err := coordinator.GetServices(c).Config(c)\n\tif err != nil {\n\t\tlog.Fields{\n\t\t\tlog.ErrorKey: err,\n\t\t}.Errorf(c, \"Failed to load configuration.\")\n\t\treturn nil, grpcutil.Internal\n\t}\n\n\treturn &logdog.GetConfigResponse{\n\t\tConfigServiceUrl: gcfg.ConfigServiceURL.String(),\n\t\tConfigSet: gcfg.ConfigSet,\n\t\tServiceConfigPath: gcfg.ServiceConfigPath,\n\t}, nil\n}", "func (s *Service) Config() *config.ServiceConfig {\n\treturn s.serviceConfig\n}", "func GetEndpointsConfig() []string {\n\tos.Setenv(\"ETCDCTL_API\", viper.GetString(\"Etcd.Api\"))\n\t//fmt.Println(\"ETCD Api version: \", os.Getenv(\"ETCDCTL_API\"))\n\tos.Setenv(\"ETCDCTL_ENDPOINTS\", viper.GetString(\"Etcd.Endpoints\"))\n\t//fmt.Println(\"ETCD ENDPOINTS: \", os.Getenv(\"ETCDCTL_ENDPOINTS\"))\n\tos.Setenv(\"ETCDCTL_CERT\", viper.GetString(\"Etcd.Cert\"))\n\t//fmt.Println(\"ETCD CERT: \", os.Getenv(\"ETCDCTL_CERT\"))\n\tos.Setenv(\"ETCDCTL_CACERT\", viper.GetString(\"Etcd.CaCert\"))\n\t//fmt.Println(\"ETCD CACERT: \", os.Getenv(\"ETCDCTL_CACERT\"))\n\tos.Setenv(\"ETCDCTL_KEY\", viper.GetString(\"Etcd.Key\"))\n\t//fmt.Println(\"ETCD KEY: \", os.Getenv(\"ETCDCTL_KEY\"))\n\treturn []string{(viper.GetViper().GetString(\"Etcd.Endpoints\"))}\n}", "func (s *Service) Config() *ServiceConfig {\n\treturn s.config\n}", "func (app *application) GetConfig() config.Instance {\n\tloadConfigOnce.Do(func() {\n\t\tconfigInstance := viper.New()\n\t\tconfigInstance.SetConfigName(\"service\")\n\t\tconfigInstance.AddConfigPath(\"./config\")\n\t\terr := configInstance.ReadInConfig()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tapp.config = configInstance\n\t})\n\treturn app.config\n}", "func (s Service) Config() *container.Config {\n\tconfig := s.ContainerConfig\n\tconfig.Image = s.ImageName()\n\treturn &config\n}", "func ConvertToECSNetworkConfiguration(ecsParams *ECSParams) (*ecs.NetworkConfiguration, error) {\n\tif ecsParams == nil {\n\t\treturn nil, nil\n\t}\n\n\tnetworkMode := ecsParams.TaskDefinition.NetworkMode\n\n\tif networkMode != \"awsvpc\" {\n\t\treturn nil, nil\n\t}\n\n\tawsvpcConfig := ecsParams.RunParams.NetworkConfiguration.AwsVpcConfiguration\n\n\tsubnets := awsvpcConfig.Subnets\n\n\tif len(subnets) < 1 {\n\t\treturn nil, errors.New(\"at least one subnet is required in the network configuration\")\n\t}\n\n\tsecurityGroups := awsvpcConfig.SecurityGroups\n\tassignPublicIp := string(awsvpcConfig.AssignPublicIp)\n\n\tecsSubnets := make([]*string, len(subnets))\n\tfor i, subnet := range subnets {\n\t\tecsSubnets[i] = aws.String(subnet)\n\t}\n\n\tecsSecurityGroups := make([]*string, len(securityGroups))\n\tfor i, sg := range securityGroups {\n\t\tecsSecurityGroups[i] = aws.String(sg)\n\t}\n\n\tecsAwsVpcConfig := &ecs.AwsVpcConfiguration{\n\t\tSubnets: ecsSubnets,\n\t\tSecurityGroups: ecsSecurityGroups,\n\t}\n\n\t// For tasks launched with network config in EC2 mode, assign_pubic_ip field is not accepted\n\tif assignPublicIp != \"\" {\n\t\tecsAwsVpcConfig.AssignPublicIp = aws.String(assignPublicIp)\n\t}\n\n\tecsNetworkConfig := &ecs.NetworkConfiguration{\n\t\tAwsvpcConfiguration: ecsAwsVpcConfig,\n\t}\n\n\treturn ecsNetworkConfig, nil\n}", "func (s *Service) Config() *svcconfig.Config {\n\treturn s.config.Config()\n}", "func (s *Services) Config() *Configuration { return &s.config }", "func (p *Provider) GetConfig() *aws.Config {\n\tawsConfig := &aws.Config{\n\t\tRegion: aws.String(p.Region),\n\t\tCredentials: credentials.NewStaticCredentials(p.AccessKey, p.SecretKey, \"\"),\n\t}\n\treturn awsConfig\n}", "func (p *EtcdClientV3) GetConfig() *ClientConfig {\n\treturn &ClientConfig{\n\t\tendpoints: p.endpoints,\n\t\tTLSConfig: p.tlsConfig,\n\t}\n}", "func getConfig() aws.Config {\n\tconfigMu.Lock()\n\tdefer configMu.Unlock()\n\n\tif cfg != nil {\n\t\treturn *cfg\n\t}\n\tc, err := config.LoadDefaultConfig(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcfg = &c\n\treturn *cfg\n}", "func getClusterConfig(inCluster bool) (*rest.Config, error) {\n\tif inCluster {\n\t\treturn rest.InClusterConfig()\n\t}\n\tconfigFile := getKubeConfigFile()\n\n\tif len(configFile) > 0 {\n\n\t\tlog.Infof(\"Reading config from file: %v\", configFile)\n\t\t// use the current context in kubeconfig\n\t\t// This is very useful for running locally.\n\t\tclientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(\n\t\t\t&clientcmd.ClientConfigLoadingRules{ExplicitPath: configFile},\n\t\t\t&clientcmd.ConfigOverrides{ClusterInfo: clientcmdapi.Cluster{Server: \"\"}})\n\n\t\trawConfig, err := clientConfig.RawConfig()\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := modifyGcloudCommand(&rawConfig); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tconfig, err := clientConfig.ClientConfig()\n\t\treturn config, err\n\t}\n\n\t// Work around https://github.com/kubernetes/kubernetes/issues/40973\n\t// See https://github.com/coreos/etcd-operator/issues/731#issuecomment-283804819\n\tif len(os.Getenv(\"KUBERNETES_SERVICE_HOST\")) == 0 {\n\t\taddrs, err := net.LookupHost(\"kubernetes.default.svc\")\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif err := os.Setenv(\"KUBERNETES_SERVICE_HOST\", addrs[0]); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif len(os.Getenv(\"KUBERNETES_SERVICE_PORT\")) == 0 {\n\t\tif err := os.Setenv(\"KUBERNETES_SERVICE_PORT\", \"443\"); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tconfig, err := rest.InClusterConfig()\n\treturn config, err\n}", "func AWSCfg(ctx context.Context, accessKeyID, secretKey string) aws.Config {\n\topts := []func(*config.LoadOptions) error{\n\t\tconfig.WithRegion(\"us-west-1\"),\n\t}\n\n\t// In local environment we use the default credentials chain that\n\t// will automatically pull creds from saml2aws,\n\tif !Local {\n\t\topts = append(opts, config.WithCredentialsProvider(\n\t\t\tcredentials.NewStaticCredentialsProvider(accessKeyID, secretKey, \"\"),\n\t\t))\n\t}\n\n\tcfg, err := config.LoadDefaultConfig(ctx, opts...)\n\tif err != nil {\n\t\tfmt.Println(\"failed to load aws config:\", err)\n\t\tos.Exit(1)\n\t}\n\n\treturn cfg\n}", "func ReadECSParams(filename string) (*ECSParams, error) {\n\tif filename == \"\" {\n\t\tdefaultFilename := \"ecs-params.yml\"\n\t\tif _, err := os.Stat(defaultFilename); err == nil {\n\t\t\tfilename = defaultFilename\n\t\t} else {\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\n\t// NOTE: Readfile reads all data into memory and closes file. Could\n\t// eventually refactor this to read different sections separately.\n\tecsParamsData, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Error reading file '%v'\", filename)\n\t}\n\tecsParamsData = []byte(os.ExpandEnv(string(ecsParamsData)))\n\tecsParams := &ECSParams{}\n\n\tif err = yaml.Unmarshal([]byte(ecsParamsData), &ecsParams); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Error unmarshalling yaml data from ECS params file: %v\", filename)\n\t}\n\n\treturn ecsParams, nil\n}", "func (c *clustermgrClient) GetConfig(ctx context.Context, key string) (val string, err error) {\n\tc.rwLock.RLock()\n\tdefer c.rwLock.RUnlock()\n\n\tspan := trace.SpanFromContextSafe(ctx)\n\tret, err := c.client.GetConfig(ctx, key)\n\tif err != nil {\n\t\tspan.Errorf(\"get config failed: key[%s], err[%+v]\", key, err)\n\t\treturn\n\t}\n\treturn ret, err\n}", "func (p providerServices) EKS() eks.EKSer {\n\treturn p.eks\n}", "func GetEcsConnection(creds *credentials.Credentials, region string) *ecs.ECS {\n\treturn ecs.New(session.New(), &aws.Config{\n\t\tRegion: aws.String(region),\n\t\tCredentials: creds,\n\t})\n}", "func (k *KubernetesSpecification) getConfig(cnsiRecord *interfaces.CNSIRecord, tokenRecord *interfaces.TokenRecord) (*rest.Config, error) {\n\tmasterURL := cnsiRecord.APIEndpoint.String()\n\treturn k.GetConfigForEndpoint(masterURL, *tokenRecord)\n}", "func (o ClusterOutput) ServiceExternalIpsConfig() ClusterServiceExternalIpsConfigOutput {\n\treturn o.ApplyT(func(v *Cluster) ClusterServiceExternalIpsConfigOutput { return v.ServiceExternalIpsConfig }).(ClusterServiceExternalIpsConfigOutput)\n}", "func GetEdgegridConfig(c *cli.Context) (*edgegrid.Config, error) {\n\tedgercOps := []edgegrid.Option{\n\t\tedgegrid.WithEnv(true),\n\t\tedgegrid.WithFile(GetEdgercPath(c)),\n\t\tedgegrid.WithSection(GetEdgercSection(c)),\n\t}\n\tconfig, err := edgegrid.New(edgercOps...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif c.IsSet(\"accountkey\") {\n\t\tconfig.AccountKey = c.String(\"accountkey\")\n\t}\n\treturn config, nil\n}", "func (e *localExocomDependency) GetDockerConfig() (types.DockerConfig, error) {\n\tserviceRoutes, err := e.getServiceRoutesString()\n\tif err != nil {\n\t\treturn types.DockerConfig{}, err\n\t}\n\treturn types.DockerConfig{\n\t\tContainerName: e.GetContainerName(),\n\t\tImage: fmt.Sprintf(\"originate/exocom:%s\", e.config.Version),\n\t\tEnvironment: map[string]string{\n\t\t\t\"ROLE\": \"exocom\",\n\t\t\t\"SERVICE_ROUTES\": serviceRoutes,\n\t\t},\n\t\tRestart: \"on-failure\",\n\t}, nil\n}", "func getServiceConfig(cfg *CmdConfig) (KubeObjects, error) {\n\t// Intialize KubeObjects\n\tvar kubeObjects KubeObjects\n\tkubeObjects.ServiceInstances = make(map[string][]*catalogv1beta1.ServiceInstance)\n\tkubeObjects.ServiceBindings = make(map[string][]*catalogv1beta1.ServiceBinding)\n\tkubeObjects.IngressRouteList = new(contourv1beta1.IngressRouteList)\n\tkubeObjects.NamedSecrets = new(v1.SecretList)\n\n\t// Allowed names for kubernetes object files are deployment.yaml, service.yaml, and ingress.yaml,\n\t// or their environment specific variations.\n\t// Istio CustomResourceDefinitions should be in istio.yaml or the environment specific variation.\n\tpossibleFiles := []string{\n\t\t\"deployment\",\n\t\t\"service\",\n\t\t\"ingress\",\n\t\t\"istio\",\n\t\t\"job\",\n\t\t\"ethos-logging-sidecar\",\n\t\t\"servicecatalog-aws\",\n\t\t\"servicecatalog-azure\",\n\t\t\"hpa\",\n\t\t\"pdb\",\n\t\t\"secret\",\n\t}\n\n\t// Pull down kube configs from Vault.\n\tif err := kubeObjects.getKubeConfigs(cfg); err != nil {\n\t\treturn kubeObjects, err\n\t}\n\n\t// Decode Kubernetes Objects from files.\n\tif err := kubeObjects.processObjects(cfg, possibleFiles); err != nil {\n\t\treturn kubeObjects, err\n\t}\n\n\t// Perform checks/namespacing to ensure resources will not conflict with those of other services.\n\tif validationErr := kubeObjects.validateAndTag(); validationErr != nil {\n\t\treturn kubeObjects, validationErr\n\t}\n\n\tdeploymentErr := prepareDeployment(kubeObjects.parentObject(), cfg.SHA)\n\treturn kubeObjects, deploymentErr\n}", "func GetConfigServerEndpoint() (string, error) {\n\tconfigServerURL := config.GetConfigServerConf().ServerURI\n\tif configServerURL == \"\" {\n\t\tif registry.DefaultServiceDiscoveryService != nil {\n\t\t\topenlog.Debug(\"find config server in registry\")\n\t\t\tccURL, err := endpoint.GetEndpoint(\"default\", \"CseConfigCenter\", \"latest\")\n\t\t\tif err != nil {\n\t\t\t\topenlog.Warn(\"failed to find config server endpoints, err: \" + err.Error())\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tconfigServerURL = ccURL\n\t\t} else {\n\t\t\treturn \"\", ErrRegistryDisabled\n\t\t}\n\t}\n\n\treturn configServerURL, nil\n}", "func NewEKSService(service eks.Service) cluster.Service {\n\treturn eksService{\n\t\tservice: service,\n\t}\n}", "func (c *ClientMgr) Ecs() *ecs.Client {\n\tc.Lock()\n\tdefer c.Unlock()\n\ttokenUpdated, err := c.refreshToken()\n\tlogrus.Debugf(\"Token update: %v, %v\", tokenUpdated, err)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Error refresh OpenAPI token: %v\", err)\n\t}\n\treturn c.ecs\n}", "func GetAWSCredentialConfig(config *cred.Config) (*aws.Config, error) {\n\tawsCredentials := credentials.NewStaticCredentials(config.Key, config.Secret, \"\")\n\t_, err := awsCredentials.Get()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get aws credential: %v, %v\", config.Key, err)\n\t}\n\tawsConfig := aws.NewConfig().WithRegion(config.Region).WithCredentials(awsCredentials)\n\treturn awsConfig, nil\n}", "func getK8sConfig(context string) clientcmd.ClientConfig {\n\trules := clientcmd.NewDefaultClientConfigLoadingRules()\n\toverrides := &clientcmd.ConfigOverrides{}\n\tif context != \"\" {\n\t\toverrides.CurrentContext = context\n\t}\n\treturn clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides)\n}", "func (c *RuntimeSecurityClient) GetConfig() (*api.SecurityConfigMessage, error) {\n\tresponse, err := c.apiClient.GetConfig(context.Background(), &api.GetConfigParams{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "func GetClusterConfig(req *restful.Request, resp *restful.Response) {\n\tconst (\n\t\thandler = \"GetClusterConfig\"\n\t)\n\tspan := v1http.SetHTTPSpanContextInfo(req, handler)\n\tdefer span.Finish()\n\n\tr, err := generateData(req, getCls)\n\tif err != nil {\n\t\tutils.SetSpanLogTagError(span, err)\n\t\tblog.Errorf(\"%s | err: %v\", common.BcsErrStorageGetResourceFailStr, err)\n\t\tlib.ReturnRest(&lib.RestResponse{\n\t\t\tResp: resp,\n\t\t\tErrCode: common.BcsErrStorageGetResourceFail,\n\t\t\tMessage: common.BcsErrStorageGetResourceFailStr})\n\t\treturn\n\t}\n\tlib.ReturnRest(&lib.RestResponse{Resp: resp, Data: r})\n}", "func configForContext(context string) (*rest.Config, error) {\n\tconfig, err := kube.GetConfig(context).ClientConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get Kubernetes config for context %q: %s\", context, err)\n\t}\n\treturn config, nil\n}", "func (edge EdgeClusterServiceDetail) GetKubeConfig() *rest.Config {\n\tvar kubeconfig string\n\n\t//get hoem directory path\n\thomeDir := microbusiness.GetHomeDirectoryPath()\n\tlog.Print(homeDir)\n\n\tif homeDir != \"\" {\n\t\tflag.StringVar(&kubeconfig, \"kubeconfig\", filepath.Join(homeDir, \".kube\", edge.ConfigName), \"(optional) path to config file\")\n\t} else {\n\t\tflag.StringVar(&kubeconfig, \"kubeconfig\", \"\", \"path to kube config file\")\n\t}\n\n\tlog.Println(\"building config ...\")\n\n\tconfigContext, err := clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\n\tmicrobusiness.HandleError(err)\n\n\treturn configContext\n}", "func (app *Application) GetCloudConfig(context *gin.Context) {\n\tclientIP := context.ClientIP()\n\n\tlog.Printf(\"Received cloud-config request from %s\", clientIP)\n\n\tvar server *compute.Server\n\n\tif clientIP != \"127.0.0.1\" {\n\t\tremoteMACAddress := arp.Search(clientIP)\n\t\tif remoteMACAddress == \"\" {\n\t\t\tcontext.String(http.StatusBadRequest,\n\t\t\t\t\"Sorry, I can't figure out your MAC address from your IPv4 address (%s).\", clientIP,\n\t\t\t)\n\n\t\t\treturn\n\t\t}\n\n\t\tserver = app.FindServerByMACAddress(remoteMACAddress)\n\t\tif server == nil {\n\t\t\tcontext.String(http.StatusBadRequest,\n\t\t\t\t\"Sorry, %s, I can't find the server your MAC address corresponds to.\",\n\t\t\t\tremoteMACAddress,\n\t\t\t)\n\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tlog.Printf(\"Request originates from local machine; treating this as a test request.\")\n\n\t\tserver = createTestServer()\n\t}\n\n\tcloudConfig, err := app.GenerateCloudConfig(*server)\n\tif err != nil {\n\t\tcontext.Error(err)\n\n\t\treturn\n\t}\n\n\tcloudConfigYaml, err := yaml.Marshal(cloudConfig)\n\tif err != nil {\n\n\t\tcontext.Error(err)\n\n\t\treturn\n\n\t}\n\n\tcontext.String(http.StatusOK, fmt.Sprintf(\"#cloud-config\\n%s\",\n\t\tstring(cloudConfigYaml),\n\t))\n}", "func (s *Service) getConfig(c echo.Context) error {\n\t// Get the config\n\tconf, err := s.datastore.GetConfig(c.Param(\"config_id\"))\n\tif err != nil {\n\t\t// Not found\n\t\tif errors.Is(err, shipyard.ErrNotFound) {\n\t\t\treturn echo.NewHTTPError(http.StatusNotFound, \"Requested resource was not found\")\n\t\t}\n\n\t\t// Other errors\n\t\ts.logger.Errorf(\"echo/getConfig get config: %s\")\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, \"Failed to get Config\")\n\t}\n\n\treturn c.JSON(http.StatusOK, conf)\n}", "func (c *AKSCluster) GetK8sConfig() ([]byte, error) {\n\tif c.k8sConfig != nil {\n\t\treturn c.k8sConfig, nil\n\t}\n\tclient, err := c.GetAKSClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.With(log.Logger)\n\n\tdatabase := model.GetDB()\n\tdatabase.Where(model.AzureClusterModel{ClusterModelId: c.modelCluster.ID}).First(&c.modelCluster.Azure)\n\t//TODO check banzairesponses\n\tconfig, err := azureClient.GetClusterConfig(client, c.modelCluster.Name, c.modelCluster.Azure.ResourceGroup, \"clusterUser\")\n\tif err != nil {\n\t\t// TODO status code !?\n\t\treturn nil, err\n\t}\n\tlog.Info(\"Get k8s config succeeded\")\n\tc.k8sConfig = []byte(config.Properties.KubeConfig)\n\treturn c.k8sConfig, nil\n}", "func readConfig(c *cli.Context) (service.Config, error) {\n\typath := c.GlobalString(\"config\")\n\tconfig := service.Config{}\n\tif _, err := os.Stat(ypath); err != nil {\n\t\treturn config, errors.New(\"config file path is not valid\")\n\t}\n\tydata, err := ioutil.ReadFile(ypath)\n\tif err != nil {\n\t\treturn config, err\n\t}\n\terr = yaml.Unmarshal([]byte(ydata), &config)\n\treturn config, err\n}", "func GetConfig(c echo.Context) error {\n\tid := os.Getenv(\"SYSTEM_ID\")\n\tif len(id) == 0 {\n\t\treturn c.String(http.StatusInternalServerError, \"SYSTEM_ID is not set\")\n\t}\n\n\tsplit := strings.Split(id, \"-\")\n\tif len(split) != 3 {\n\t\treturn c.String(http.StatusInternalServerError, fmt.Sprintf(\"invalid SYSTEM_ID %q\", id))\n\t}\n\n\tconfig, err := schedule.GetConfig(c.Request().Context(), split[0]+\"-\"+split[1])\n\tif err != nil {\n\t\treturn c.String(http.StatusInternalServerError, err.Error())\n\t}\n\n\tlastRequest = time.Now()\n\treturn c.JSON(http.StatusOK, config)\n}", "func (p providerServices) EKSCtl() eksctl.EKSCtl {\n\treturn p.eksctl\n}", "func GetEndpointConfig(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EndpointConfigState, opts ...pulumi.ResourceOption) (*EndpointConfig, error) {\n\tvar resource EndpointConfig\n\terr := ctx.ReadResource(\"aws-native:sagemaker:EndpointConfig\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (o Ocs) GetConfig(w http.ResponseWriter, r *http.Request) {\n\tmustNotFail(render.Render(w, r, response.DataRender(&data.ConfigData{\n\t\tVersion: \"1.7\", // TODO get from env\n\t\tWebsite: \"ocis\", // TODO get from env\n\t\tHost: \"\", // TODO get from FRONTEND config\n\t\tContact: \"\", // TODO get from env\n\t\tSSL: \"true\", // TODO get from env\n\t})))\n}", "func (c *KubernetesSpecification) GetConfigForEndpoint(masterURL string, token interfaces.TokenRecord) (*restclient.Config, error) {\n\treturn clientcmd.BuildConfigFromKubeconfigGetter(masterURL, func() (*clientcmdapi.Config, error) {\n\n\t\tname := \"cluster-0\"\n\n\t\t// Create a config\n\n\t\t// Initialize a new config\n\t\tcontext := clientcmdapi.NewContext()\n\t\tcontext.Cluster = name\n\t\tcontext.AuthInfo = name\n\n\t\t// Configure the cluster\n\t\tcluster := clientcmdapi.NewCluster()\n\t\tcluster.Server = masterURL\n\t\tcluster.InsecureSkipTLSVerify = true\n\n\t\t// Configure auth information\n\t\tauthInfo := clientcmdapi.NewAuthInfo()\n\t\terr := c.addAuthInfoForEndpoint(authInfo, token)\n\n\t\tconfig := clientcmdapi.NewConfig()\n\t\tconfig.Clusters[name] = cluster\n\t\tconfig.Contexts[name] = context\n\t\tconfig.AuthInfos[name] = authInfo\n\t\tconfig.CurrentContext = context.Cluster\n\n\t\treturn config, err\n\t})\n\n}", "func (b *backend) getClientConfig(s logical.Storage, region, stsRole, clientType string) (*aws.Config, error) {\n\n\tconfig, err := b.getRawClientConfig(s, region, clientType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif config == nil {\n\t\treturn nil, fmt.Errorf(\"could not compile valid credentials through the default provider chain\")\n\t}\n\n\tif stsRole != \"\" {\n\t\tassumeRoleConfig, err := b.getRawClientConfig(s, region, \"sts\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif assumeRoleConfig == nil {\n\t\t\treturn nil, fmt.Errorf(\"could not configure STS client\")\n\t\t}\n\t\tassumedCredentials := stscreds.NewCredentials(session.New(assumeRoleConfig), stsRole)\n\t\t// Test that we actually have permissions to assume the role\n\t\tif _, err = assumedCredentials.Get(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconfig.Credentials = assumedCredentials\n\t}\n\n\treturn config, nil\n}", "func (client *Client) DescribeClusterServiceConfigForAdmin(request *DescribeClusterServiceConfigForAdminRequest) (response *DescribeClusterServiceConfigForAdminResponse, err error) {\n\tresponse = CreateDescribeClusterServiceConfigForAdminResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (service *envConfigurationService) GetEdgeClusterServiceAddress() (string, error) {\n\taddress := os.Getenv(\"EDGE_CLUSTER_ADDRESS\")\n\tif strings.Trim(address, \" \") == \"\" {\n\t\treturn \"\", commonErrors.NewUnknownError(\"EDGE_CLUSTER_ADDRESS is required\")\n\t}\n\n\treturn address, nil\n}", "func GetE2EConfig(mode ops.Mode, cmd *cobra.Command) (*ops.E2EConfig, error) {\n\tflags := cmd.PersistentFlags()\n\tcfg := mode.Get().E2EConfig\n\tif flags.Changed(e2eFocusFlag) {\n\t\tfocus, err := flags.GetString(e2eFocusFlag)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"couldn't retrieve focus flag\")\n\t\t}\n\t\tcfg.Focus = focus\n\t}\n\n\tif flags.Changed(e2eSkipFlag) {\n\t\tskip, err := flags.GetString(e2eSkipFlag)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"couldn't retrieve skip flag\")\n\t\t}\n\t\tcfg.Skip = skip\n\t}\n\treturn &cfg, nil\n}", "func (a *Client) GetConfig(params *GetConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetConfigOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetConfigParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getConfig\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/customers/{cUUID}/runtime_config/{scope}\",\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: &GetConfigReader{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, err\n\t}\n\tsuccess, ok := result.(*GetConfigOK)\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 getConfig: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func getConfig(cfgFile string, pCfg *ContivConfig) error {\n\tbytes, err := ioutil.ReadFile(cfgFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpCfg.SvcSubnet = defSvcSubnet\n\terr = json.Unmarshal(bytes, pCfg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error parsing config file: %s\", err)\n\t}\n\n\treturn nil\n}", "func GetK8sConfig(c *gin.Context) ([]byte, bool) {\n\tlog := logger.WithFields(logrus.Fields{\"tag\": \"GetKubernetesConfig\"})\n\tcommonCluster, ok := GetCommonClusterFromRequest(c)\n\tif ok != true {\n\t\treturn nil, false\n\t}\n\tkubeConfig, err := commonCluster.GetK8sConfig()\n\tif err != nil {\n\t\tlog.Errorf(\"Error getting config: %s\", err.Error())\n\t\tc.JSON(http.StatusBadRequest, htype.ErrorResponse{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: \"Error getting kubeconfig\",\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn nil, false\n\t}\n\treturn kubeConfig, true\n}", "func (p *Provider) GetConfigFile() (*kubernetes.Clientset, string, error) {\n\tsDec, err := base64.StdEncoding.DecodeString(p.Config)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"Error decoding k8 config: %s\", err)\n\t}\n\tconfigFile, err := ioutil.TempFile(\"\", \"k8-config\")\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"Error creating tmp file: %s\", err)\n\t}\n\terr = ioutil.WriteFile(configFile.Name(), sDec, 0400)\n\tif err != nil {\n\t\treturn nil, configFile.Name(), fmt.Errorf(\"Error writing to tmp file: %s\", err)\n\t}\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", configFile.Name())\n\tif err != nil {\n\t\treturn nil, configFile.Name(), fmt.Errorf(\"Error reading k8 config: %s\", err)\n\t}\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, configFile.Name(), fmt.Errorf(\"Error creating k8 client: %s\", err)\n\t}\n\treturn clientset, configFile.Name(), nil\n}", "func (client *Client) DescribeClusterServiceConfigTag(request *DescribeClusterServiceConfigTagRequest) (response *DescribeClusterServiceConfigTagResponse, err error) {\n\tresponse = CreateDescribeClusterServiceConfigTagResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func GetConfig(configFileName string, trafficOpsHost string, trafficServerHost string, params []TrafficOpsParameter) (string, error) {\n\tswitch configFileName {\n\tcase \"storage.config\":\n\t\treturn createStorageDotConfig(trafficOpsHost, trafficServerHost, params)\n\tdefault:\n\t\treturn \"\", errors.New(\"Config file '%s' not valid\")\n\t}\n}", "func (o ClusterOutput) IdentityServiceConfig() ClusterIdentityServiceConfigOutput {\n\treturn o.ApplyT(func(v *Cluster) ClusterIdentityServiceConfigOutput { return v.IdentityServiceConfig }).(ClusterIdentityServiceConfigOutput)\n}", "func (c ServiceConfig) GetHost() string {\n\treturn c.Host\n}", "func (c ServiceConfig) GetHost() string {\n\treturn c.Host\n}", "func GetGceConfig(project, cluster, clusterLocation, zone, node string) (*GceConfig, error) {\n\tif project != \"\" {\n\t\tglog.Infof(\"Using metadata all from flags\")\n\t\tif cluster == \"\" {\n\t\t\tglog.Warning(\"Cluster name was not set. This can be set with --cluster-name\")\n\t\t}\n\t\tif clusterLocation == \"\" {\n\t\t\tglog.Warning(\"Cluster location was not set. This can be set with --cluster-location\")\n\t\t}\n\t\tif zone == \"\" {\n\t\t\t// zone is only used by the older gke_container\n\t\t\tglog.Info(\"Zone was not set. This can be set with --zone-override\")\n\t\t}\n\t\tif node == \"\" {\n\t\t\tglog.Warning(\"Node was not set. This can be set with --node-name\")\n\t\t}\n\t\treturn &GceConfig{\n\t\t\tProject: project,\n\t\t\tZone: zone,\n\t\t\tCluster: cluster,\n\t\t\tClusterLocation: clusterLocation,\n\t\t\tInstance: node,\n\t\t}, nil\n\t}\n\n\tif !gce.OnGCE() {\n\t\treturn nil, fmt.Errorf(\"Not running on GCE.\")\n\t}\n\n\tvar err error\n\tif project == \"\" {\n\t\tproject, err = gce.ProjectID()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error while getting project id: %v\", err)\n\t\t}\n\t}\n\n\tif cluster == \"\" {\n\t\tcluster, err = gce.InstanceAttributeValue(\"cluster-name\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error while getting cluster name: %v\", err)\n\t\t}\n\t\tcluster = strings.TrimSpace(cluster)\n\t\tif cluster == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"cluster-name metadata was empty\")\n\t\t}\n\t}\n\n\t// instance/name endpoint is not available on the GKE metadata server.\n\t// Try GCE instance/name endpoint. If error, try instance/hostname.\n\t// If instance/hostname, remove domain to replicate instance/name.\n\tif node == \"\" {\n\t\tnode, err = gce.InstanceName()\n\t\tif err != nil {\n\t\t\tnode, err = gce.Hostname()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error while getting instance (node) name: %v\", err)\n\t\t\t}\n\t\t\tnode = strings.Split(node, \".\")[0]\n\t\t\tglog.Warningf(\"using %s as instance/name\", node)\n\t\t}\n\t}\n\n\tinstanceId, err := gce.InstanceID()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while getting instance id: %v\", err)\n\t}\n\n\tif zone == \"\" {\n\t\tzone, err = gce.Zone()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error while getting zone: %v\", err)\n\t\t}\n\t}\n\n\tif clusterLocation == \"\" {\n\t\tclusterLocation, err = gce.InstanceAttributeValue(\"cluster-location\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error while getting cluster location: %v\", err)\n\t\t}\n\t\tclusterLocation = strings.TrimSpace(clusterLocation)\n\t\tif clusterLocation == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"cluster-location metadata was empty\")\n\t\t}\n\t}\n\n\treturn &GceConfig{\n\t\tProject: project,\n\t\tZone: zone,\n\t\tCluster: cluster,\n\t\tClusterLocation: clusterLocation,\n\t\tInstance: node,\n\t\tInstanceId: instanceId,\n\t}, nil\n}", "func getConfig(serverURL, kubeconfig string) (*rest.Config, error) {\n\tif kubeconfig == \"\" {\n\t\tkubeconfig = os.Getenv(\"KUBECONFIG\")\n\t}\n\t// If we have an explicit indication of where the kubernetes config lives, read that.\n\tif kubeconfig != \"\" {\n\t\treturn clientcmd.BuildConfigFromFlags(serverURL, kubeconfig)\n\t}\n\t// If not, try the in-cluster config.\n\tif c, err := rest.InClusterConfig(); err == nil {\n\t\treturn c, nil\n\t}\n\t// If no in-cluster config, try the default location in the user's home directory.\n\tif usr, err := user.Current(); err == nil {\n\t\tif c, err := clientcmd.BuildConfigFromFlags(\"\", filepath.Join(usr.HomeDir, \".kube\", \"config\")); err == nil {\n\t\t\treturn c, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"could not create a valid kubeconfig\")\n}", "func parseEksConfig(stack interfaces.IStack) (*EksConfig, error) {\n\ttemplatedVars, err := stack.GetTemplatedVars(nil, map[string]interface{}{})\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tprovisionerValues, ok := templatedVars[ProvisionerKey].(map[interface{}]interface{})\n\tif !ok {\n\t\treturn nil, errors.New(\"No provisioner found in stack config. You must at least set the binary path.\")\n\t}\n\tlog.Logger.Tracef(\"Marshalling: %#v\", provisionerValues)\n\n\t// marshal then unmarshal the provisioner values to get the command parameters\n\tbyteData, err := yaml.Marshal(provisionerValues)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tlog.Logger.Tracef(\"Marshalled to: %s\", string(byteData[:]))\n\n\tvar eksConfig EksConfig\n\terr = yaml.Unmarshal(byteData, &eksConfig)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tif eksConfig.Binary == \"\" {\n\t\teksConfig.Binary = eksDefaultBinary\n\t\tlog.Logger.Warnf(\"Using default %s binary '%s'. It's safer to explicitly set the path to a versioned \"+\n\t\t\t\"binary (e.g. %s-1.2.3) in the provisioner configuration\", eksProvisionerName, eksDefaultBinary,\n\t\t\teksDefaultBinary)\n\t}\n\n\teksConfig.clusterName = eksConfig.Params.GetCluster[configKeyEKSClusterName]\n\n\treturn &eksConfig, nil\n}", "func NewConfigService(useLocalFileSystem bool, project string, stage string, service string, resourceHandler *api.ResourceHandler) ConfigService {\n\treturn &configServiceImpl{\n\t\tuseLocalFileSystem: useLocalFileSystem,\n\t\tproject: project,\n\t\tstage: stage,\n\t\tservice: service,\n\t\tresourceHandler: resourceHandler,\n\t}\n}", "func (e *endpoints) getTLSConfig(ctx context.Context) func(*tls.ClientHelloInfo) (*tls.Config, error) {\n\treturn func(hello *tls.ClientHelloInfo) (*tls.Config, error) {\n\t\tcerts, roots, err := e.getCerts(ctx)\n\t\tif err != nil {\n\t\t\te.c.Log.Errorf(\"Could not generate TLS config for gRPC client %v: %v\", hello.Conn.RemoteAddr(), err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tc := &tls.Config{\n\t\t\t// When bootstrapping, the agent does not yet have\n\t\t\t// an SVID. In order to include the bootstrap endpoint\n\t\t\t// in the same server as the rest of the Node API,\n\t\t\t// request but don't require a client certificate\n\t\t\tClientAuth: tls.VerifyClientCertIfGiven,\n\n\t\t\tCertificates: certs,\n\t\t\tClientCAs: roots,\n\t\t}\n\t\treturn c, nil\n\t}\n}", "func GetEciScalingConfiguration(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *EciScalingConfigurationState, opts ...pulumi.ResourceOption) (*EciScalingConfiguration, error) {\n\tvar resource EciScalingConfiguration\n\terr := ctx.ReadResource(\"alicloud:ess/eciScalingConfiguration:EciScalingConfiguration\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func configForContext(kubeConfig, kubeContext string) (*rest.Config, error) {\n\tconfig, err := kube.GetConfig(kubeContext, kubeConfig).ClientConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get Kubernetes config for context %q: %s\", kubeContext, err)\n\t}\n\treturn config, nil\n}", "func GetConfig(c *caddy.Controller) *Config {\r\n\tctx := c.Context().(*netContext)\r\n\tkey := strings.Join(c.ServerBlockKeys, \"~\")\r\n\r\n\t//only check for config if the value is proxy or echo\r\n\t//we need to do this because we specify the ports in the server block\r\n\t//and those values need to be ignored as they are also sent from caddy main process.\r\n\tif strings.Contains(key, \"echo\") || strings.Contains(key, \"proxy\") {\r\n\t\tif cfg, ok := ctx.keysToConfigs[key]; ok {\r\n\t\t\treturn cfg\r\n\t\t}\r\n\t}\r\n\r\n\t// we should only get here if value of key in server block\r\n\t// is not echo or proxy i.e port number :12017\r\n\t// we can't return a nil because caddytls.RegisterConfigGetter will panic\r\n\t// so we return a default (blank) config value\r\n\tcaddytlsConfig, err := caddytls.NewConfig(ctx.instance)\r\n\tif err != nil {\r\n\t\tlog.Printf(\"[ERROR] Making new TLS configuration: %v\", err)\r\n\t\treturn new(Config)\r\n\t}\r\n\r\n\treturn &Config{TLS: caddytlsConfig}\r\n}", "func GetSDKConfig() string {\n\treturn myViper.GetString(\"client.sdkconfig\")\n}", "func GetConfig() common.AresServerConfig {\n\treturn config\n}", "func loadConfig(configFile string) service.ServiceConfig {\n conf := service.ServiceConfig{}\n\n if err := loader.FromFile(&conf, configFile); err != nil {\n StdErr.Write([]byte(err.Error()))\n os.Exit(ERR_CONFIG)\n }\n\n return conf\n}", "func AWSServiceEndpoint() *AWSServiceEndpointApplyConfiguration {\n\treturn &AWSServiceEndpointApplyConfiguration{}\n}", "func GetConfig(appOpts servertypes.AppOptions) *Config {\n\treturn &Config{\n\t\tContractQueryGasLimit: cast.ToUint64(appOpts.Get(\"wasm.contract-query-gas-limit\")),\n\t\tContractDebugMode: cast.ToBool(appOpts.Get(\"wasm.contract-debug-mode\")),\n\t\tWriteVMMemoryCacheSize: cast.ToUint32(appOpts.Get(\"wasm.write-vm-memory-cache-size\")),\n\t\tReadVMMemoryCacheSize: cast.ToUint32(appOpts.Get(\"wasm.read-vm-memory-cache-size\")),\n\t\tNumReadVMs: cast.ToUint32(appOpts.Get(\"wasm.num-read-vms\")),\n\t}\n}", "func (c *Provider) EndpointConfig() fab.EndpointConfig {\n\treturn c.endpointConfig\n}", "func (cp configFactory) getConfig(app *model.App, vmConfig vm.Config, remoteConfig *remote.Config, forceOpts forceOptions,\n\toverrideCP func(env string) (kubeClient, error)) (*config, error) {\n\tscp := &stdClientProvider{\n\t\tapp: app,\n\t\tconfig: remoteConfig,\n\t\tverbosity: cp.verbosity,\n\t\tforceContext: forceOpts.k8sContext,\n\t\toverrideClientProvider: overrideCP,\n\t}\n\treturn cp.internalConfig(app, vmConfig, scp.Client, scp.Attrs)\n}", "func (pr *PeeringRequest) GetConfig(clientset kubernetes.Interface) (*rest.Config, error) {\n\treturn getConfig(clientset, pr.Spec.KubeConfigRef)\n}", "func (z *ZkClient) InitServiceConfig(path string, config map[string]string) {\n\n}", "func getClusterConfig() (rest.Config, error) {\n\tkubeconfig, exists := os.LookupEnv(\"KUBECONFIG\")\n\tif exists != true {\n\t\tlogrus.Warnf(\"KUBECONFIG env var not set\")\n\t}\n\tlogrus.WithField(\"KUBECONFIG\", kubeconfig).Debug(\"Using kubeconfig from env:\")\n\n\t// use the current context in kubeconfig\n\tlogrus.Debug(\"Using the provided KUBECONFIG for the Out-of-cluster config\")\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\tif err != nil {\n\t\treturn rest.Config{}, err\n\t}\n\n\treturn *config, nil\n}", "func (m *MockProviderKubectlClient) GetEksaAWSDatacenterConfig(arg0 context.Context, arg1, arg2, arg3 string) (*v1alpha1.AWSDatacenterConfig, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetEksaAWSDatacenterConfig\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(*v1alpha1.AWSDatacenterConfig)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (sc SfcConfig) getConfig() (*types.SfcConfig, error) {\n\t// get the SFC configuration only once\n\tcfg, err, _ := sc.cg.Do(\"cfg\", func() (interface{}, error) {\n\t\treturn repository.R().SfcConfiguration()\n\t})\n\n\t// loader failed\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cfg.(*types.SfcConfig), nil\n}", "func (c *ConfigService) Get() (*Config, *http.Response, error) {\n\tconfig := new(Config)\n\tapiError := new(APIError)\n\tresp, err := c.sling.New().Get(\"configuration.json\").Receive(config, apiError)\n\treturn config, resp, relevantError(err, *apiError)\n}", "func (c baseClient) getEngineConfigFilePath(ctx context.Context, engine containerd.Container) (string, error) {\n\tspec, err := engine.Spec(ctx)\n\tconfigFile := \"\"\n\tif err != nil {\n\t\treturn configFile, err\n\t}\n\tfor i := 0; i < len(spec.Process.Args); i++ {\n\t\targ := spec.Process.Args[i]\n\t\tif strings.HasPrefix(arg, \"--config-file\") {\n\t\t\tif strings.Contains(arg, \"=\") {\n\t\t\t\tsplit := strings.SplitN(arg, \"=\", 2)\n\t\t\t\tconfigFile = split[1]\n\t\t\t} else {\n\t\t\t\tif i+1 >= len(spec.Process.Args) {\n\t\t\t\t\treturn configFile, ErrMalformedConfigFileParam\n\t\t\t\t}\n\t\t\t\tconfigFile = spec.Process.Args[i+1]\n\t\t\t}\n\t\t}\n\t}\n\n\tif configFile == \"\" {\n\t\t// TODO - any more diagnostics to offer?\n\t\treturn configFile, ErrEngineConfigLookupFailure\n\t}\n\treturn configFile, nil\n}", "func (c baseClient) getEngineConfigFilePath(ctx context.Context, engine containerd.Container) (string, error) {\n\tspec, err := engine.Spec(ctx)\n\tconfigFile := \"\"\n\tif err != nil {\n\t\treturn configFile, err\n\t}\n\tfor i := 0; i < len(spec.Process.Args); i++ {\n\t\targ := spec.Process.Args[i]\n\t\tif strings.HasPrefix(arg, \"--config-file\") {\n\t\t\tif strings.Contains(arg, \"=\") {\n\t\t\t\tsplit := strings.SplitN(arg, \"=\", 2)\n\t\t\t\tconfigFile = split[1]\n\t\t\t} else {\n\t\t\t\tif i+1 >= len(spec.Process.Args) {\n\t\t\t\t\treturn configFile, ErrMalformedConfigFileParam\n\t\t\t\t}\n\t\t\t\tconfigFile = spec.Process.Args[i+1]\n\t\t\t}\n\t\t}\n\t}\n\n\tif configFile == \"\" {\n\t\t// TODO - any more diagnostics to offer?\n\t\treturn configFile, ErrEngineConfigLookupFailure\n\t}\n\treturn configFile, nil\n}", "func (c *ConfigServer) GetConfig(ctx context.Context, req *empty.Empty) (*api.GetConfigResponse, error) {\n\tclient := getClient(ctx)\n\tallowed, err := auth.IsAuthorized(client, \"\", \"list\", \"\", \"namespaces\", \"\")\n\tif err != nil || !allowed {\n\t\treturn nil, err\n\t}\n\n\tsysConfig, err := client.GetSystemConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnodePool := &api.NodePool{\n\t\tLabel: *sysConfig.GetValue(\"applicationNodePoolLabel\"),\n\t\tOptions: make([]*api.NodePoolOption, 0),\n\t}\n\n\tnodePoolOptions, err := sysConfig.NodePoolOptions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttype ConfigServer struct{}\n\tfor _, option := range nodePoolOptions {\n\t\tnodePool.Options = append(nodePool.Options, &api.NodePoolOption{\n\t\t\tName: option.Name,\n\t\t\tValue: option.Value,\n\t\t})\n\t}\n\n\treturn &api.GetConfigResponse{\n\t\tApiUrl: sysConfig[\"ONEPANEL_API_URL\"],\n\t\tDomain: sysConfig[\"ONEPANEL_DOMAIN\"],\n\t\tFqdn: sysConfig[\"ONEPANEL_FQDN\"],\n\t\tNodePool: nodePool,\n\t}, err\n}", "func (r *ECMResource) Get(id string) (*ECMConfig, error) {\n\tvar item ECMConfig\n\tif err := r.c.ReadQuery(BasePath+ECMEndpoint, &item); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &item, nil\n}", "func GetConfig() interface{} {\n\treturn std.GetConfig()\n}", "func (c *Config) GetService(host string) *Service {\n\tdomainPattern := regexp.MustCompile(`(\\w*\\:\\/\\/)?(.+)` + c.Domain)\n\tparts := domainPattern.FindAllString(host, -1)\n\t//we must lock the access as the configuration can be dynamically loaded\n\tselect {\n\tcase srv := <-configChan:\n\t\tc.Services = srv\n\tdefault:\n\t}\n\tfor _, s := range c.Services {\n\t\tif len(parts) > 0 && s.Name+c.Domain == parts[0] {\n\t\t\treturn &s\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetConfig(host string, verifyTLS bool, apiKey string, project string, config string) (models.ConfigInfo, Error) {\n\tvar params []queryParam\n\tparams = append(params, queryParam{Key: \"project\", Value: project})\n\tparams = append(params, queryParam{Key: \"config\", Value: config})\n\n\turl, err := generateURL(host, \"/v3/configs/config\", params)\n\tif err != nil {\n\t\treturn models.ConfigInfo{}, 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 models.ConfigInfo{}, Error{Err: err, Message: \"Unable to fetch configs\", Code: statusCode}\n\t}\n\n\tvar result map[string]interface{}\n\terr = json.Unmarshal(response, &result)\n\tif err != nil {\n\t\treturn models.ConfigInfo{}, Error{Err: err, Message: \"Unable to parse API response\", Code: statusCode}\n\t}\n\n\tconfigInfo, ok := result[\"config\"].(map[string]interface{})\n\tif !ok {\n\t\treturn models.ConfigInfo{}, Error{Err: fmt.Errorf(\"Unexpected type parsing config, expected map[string]interface{}, got %T\", result[\"config\"]), Message: \"Unable to parse API response\", Code: statusCode}\n\t}\n\tinfo := models.ParseConfigInfo(configInfo)\n\treturn info, Error{}\n}", "func determineConfig() (*rest.Config, error) {\n\tkubeconfigPath := os.Getenv(\"KUBECONFIG\")\n\tvar config *rest.Config\n\tvar err error\n\n\t// determine whether to use in cluster config or out of cluster config\n\t// if kubeconfigPath is not specified, default to in cluster config\n\t// otherwise, use out of cluster config\n\tif kubeconfigPath == \"\" {\n\t\tlog.Info(\"Using in cluster k8s config\")\n\t\tconfig, err = rest.InClusterConfig()\n\t} else {\n\t\tlog.Info(\"Using out of cluster k8s config: \", kubeconfigPath)\n\n\t\tconfig, err = clientcmd.BuildConfigFromFlags(\"\", kubeconfigPath)\n\t}\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"determine Kubernetes config failed\")\n\t}\n\n\treturn config, nil\n}", "func (r *AppConfig) GetDefaultServiceConfig() CommonServiceConfig {\n\treturn r.DefaultServiceConfig\n}", "func (c *Client) DatacenterConfigGet(datacenterName string) (*DatacenterConfig, error) {\n\tvar datacenterConfig DatacenterConfig\n\n\terr := c.rpcClient.CallFor(\n\t\t&datacenterConfig,\n\t\t\"datacenter_config\",\n\t\tdatacenterName)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &datacenterConfig, nil\n}" ]
[ "0.6821646", "0.67600626", "0.66528106", "0.6580003", "0.657921", "0.6567093", "0.624718", "0.61671364", "0.6118922", "0.60779226", "0.60774213", "0.60474586", "0.59474874", "0.59273213", "0.5882051", "0.5842291", "0.5829497", "0.5804335", "0.57492363", "0.5749054", "0.57445234", "0.5738926", "0.5737981", "0.5737009", "0.57130265", "0.56660265", "0.5664692", "0.5648582", "0.56080717", "0.5586027", "0.5570339", "0.556454", "0.55554855", "0.55517554", "0.55461454", "0.5503047", "0.5497285", "0.5486408", "0.54696506", "0.5468359", "0.5457105", "0.54566395", "0.5451721", "0.54320425", "0.54283357", "0.54213804", "0.5386329", "0.5374118", "0.5367889", "0.5362287", "0.53601754", "0.5358133", "0.5352991", "0.5347362", "0.5336133", "0.53340876", "0.5333206", "0.53298897", "0.5328312", "0.53224576", "0.531982", "0.5315417", "0.5306369", "0.5305382", "0.52936965", "0.52936274", "0.5288364", "0.52799046", "0.52799046", "0.52770627", "0.52765685", "0.5259211", "0.5258199", "0.5253932", "0.52492607", "0.52461195", "0.52442163", "0.5241172", "0.52324426", "0.5218398", "0.52136916", "0.5211932", "0.5210439", "0.5208906", "0.52062774", "0.5205921", "0.5203272", "0.5195031", "0.5189572", "0.51871586", "0.51847035", "0.51847035", "0.5181943", "0.5181325", "0.5180845", "0.517592", "0.51671565", "0.5164308", "0.5161854", "0.51559013" ]
0.83150405
0
GetPageConfig will parse the web post entry at filepath.
func GetPageConfig(filepath, sitepath string) (Post, error) { cfg, err := getPageConfig(filepath) if err != nil { return cfg, err } cfg.FilePath = filepath cfg.SitePath = sitepath if cfg.Date != "" { t, err := time.Parse(time.RFC3339, cfg.Date) if err != nil { return cfg, fmt.Errorf("parsing date %s: %w", cfg.Date, err) } date := t.Format(time.RFC3339) if cfg.Date != date { return cfg, fmt.Errorf("dates don't match: %s != %s", cfg.Date, date) } } return cfg, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ParseConfigFile(url string, wd *url.URL) (*Config, error) {\n\treturn ParseConfigFileWithSchemes(urlfetch.DefaultSchemes, url, wd)\n}", "func (o Ocs) GetConfig(w http.ResponseWriter, r *http.Request) {\n\tmustNotFail(render.Render(w, r, response.DataRender(&data.ConfigData{\n\t\tVersion: \"1.7\", // TODO get from env\n\t\tWebsite: \"ocis\", // TODO get from env\n\t\tHost: \"\", // TODO get from FRONTEND config\n\t\tContact: \"\", // TODO get from env\n\t\tSSL: \"true\", // TODO get from env\n\t})))\n}", "func GetConfigHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tconfigName := ps.ByName(\"config\")\n\n\tconfiguration, err := ubus.UciGetConfig(uci.ConfigType(configName))\n\tif err != nil {\n\t\trend.JSON(w, http.StatusOK, map[string]string{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\trend.JSON(w, http.StatusOK, configuration)\n}", "func GetConfig(path string) (*viper.Viper, error) {\n\tconfig, err := getConfig(path, \"WILLIAM\", \"yaml\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn config, nil\n}", "func GetConfigHandler(w http.ResponseWriter, r *http.Request) {\n\thttp.ServeFile(w, r, \"swagger.json\")\n}", "func GetConfig(filePath string) (*Configuration, error) {\n\tpath, _ := filepath.Abs(filePath)\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig := Configuration{}\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig.processConfig()\n\n\treturn &config, nil\n}", "func GetConfig(filePath string) *Config {\n\tviper.SetConfigFile(filePath)\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to Read Config: %v\\n\", err)\n\t}\n\tvar C Config\n\tviper.Unmarshal(&C)\n\tviper.SetDefault(`loglevel`, `info`)\n\tviper.SetDefault(`interval`, `5s`)\n\tC.LogLevel = viper.GetString(`loglevel`)\n\tC.Interval = viper.GetDuration(`interval`)\n\tfor _, c := range C.LBServers {\n\t\tif c.PoolWorkers < len(c.Metrics)*10 {\n\t\t\tc.PoolWorkers = len(c.Metrics) * 10\n\t\t}\n\t\tif c.PoolWorkerQueue < 1000 {\n\t\t\tc.PoolWorkerQueue = 1000\n\t\t}\n\t}\n\treturn &C\n}", "func GetConfig() string {\n\tproberMu.Lock()\n\tdefer proberMu.Unlock()\n\treturn prober.textConfig\n}", "func (CTRL *BaseController) ConfigPage(page string) {\n\tCTRL.GetDB()\n\tCTRL.GetCache()\n\ttheme := template.GetActiveTheme(false)\n\tCTRL.Layout = theme[0] + \"/\" + \"layout-admin.html\"\n\tdevice := CTRL.Ctx.Input.GetData(\"device_type\").(string)\n\tCTRL.LayoutSections = make(map[string]string)\n\tCTRL.LayoutSections[\"Head\"] = theme[0] + \"/\" + \"partial/html_head_\" + device + \".html\"\n\tCTRL.TplName = theme[0] + \"/\" + page\n\tCTRL.Data[\"Theme\"] = theme[0]\n\tCTRL.Data[\"Style\"] = theme[1]\n\tCTRL.Data[\"ModuleMenu\"] = CTRL.GetModuleMenu()\n\tCTRL.GetBlocks()\n\t//CTRL.GetActiveModule()\n\t//CTRL.GetActiveCategory()\n\t//CTRL.GetActiveAds()\n}", "func getConfig(path string) (*configparser.ConfigParser, error){\r\n p, err := configparser.NewConfigParserFromFile(path)\r\n if err != nil {\r\n return nil,err\r\n }\r\n\r\n return p,nil\r\n}", "func GetConfig(filePath string) (*Config, error) {\n\tconfig := Config{}\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &config, nil\n}", "func (c *GinHttp) getConfig() *GinHttp {\n\tif _, err := toml.DecodeFile(ConfPath+c.getTomlFile(), &c); err != nil {\n\t\tfmt.Println(err)\n\t\treturn c\n\t}\n\treturn c\n}", "func GetConfigFile() string {\n\treturn *configFile\n}", "func GetConfig(configFile string) (*viper.Viper, error) {\n\ts, err := os.Stat(configFile)\n\tif os.IsNotExist(err) {\n\t\treturn nil, err\n\t}\n\tif s.IsDir() {\n\t\treturn nil, errors.New(\"Config file is not a file\")\n\t}\n\tc := viper.New()\n\tdir := filepath.Dir(configFile)\n\tc.SetConfigName(strings.TrimSuffix(filepath.Base(configFile), filepath.Ext(configFile)))\n\tc.SetConfigType(\"json\")\n\tc.AddConfigPath(dir)\n\terr = c.ReadInConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "func GetConfig(filePath string) (Config, error) {\n\traw, err := ioutil.ReadFile(filePath)\n\n\tvar config Config\n\terr = json.Unmarshal(raw, &config)\n\n\treturn config, err\n}", "func (c Config) GetConfigFile() string {\n\treturn c.viper.GetString(configFile)\n}", "func GetPageFile(c *gin.Context) {\n p, _ := c.Get(\"serviceProvider\")\n var serviceProvider *services.ServiceProvider\n serviceProvider = p.(*services.ServiceProvider)\n\tfileName := c.Param(\"page\")\n\thtmlFolder := serviceProvider.GetConfig().StaticFolder\n\tpath := fmt.Sprintf(\"%s/_next/static/chunks/pages/%s\", htmlFolder, fileName)\n\tc.File(path)\n}", "func (m *Tracing_Http) GetConfig() *_struct.Struct {\n\tif x, ok := m.GetConfigType().(*Tracing_Http_Config); ok {\n\t\treturn x.Config\n\t}\n\treturn nil\n}", "func GetConfig(f string) (*Configs, error) {\n\tconfig := &Configs{}\n\tfile, err := ioutil.ReadFile(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = GetYaml(file, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn config, nil\n}", "func GetConfig(f string) (*Configs, error) {\n\tconfig := &Configs{}\n\tfile, err := os.ReadFile(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = GetYaml(file, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn config, nil\n}", "func GetConfig() datatypes.Config {\n\tlogLevel := os.Getenv(\"LOG_LEVEL\")\n\tif logLevel != \"\" {\n\t\tlogging.SetLogLevel(logLevel)\n\t\tlogging.LogSystem(datatypes.Logging{Message: fmt.Sprintf(\"LOG_LEVEL set to %v from env var\", logLevel)})\n\t} else {\n\t\tlogging.LogSystem(datatypes.Logging{Message: \"LOG_LEVEL not found in ENV. Defaulting to ERROR\"})\n\t}\n\n\tlogging.LogInfo(datatypes.Logging{Message: \"** Reading in goDynaPerfSignature Config\"})\n\n\tserver := os.Getenv(\"DT_SERVER\")\n\tif server == \"\" {\n\t\tlogging.LogInfo(datatypes.Logging{Message: \"A Dynatrace server was not provided. Requests will not work unless a DT_SERVER is given in the POST body.\"})\n\t} else {\n\t\tlogging.LogInfo(datatypes.Logging{Message: fmt.Sprintf(\"Loaded default DT_SERVER: %v. This can be overridden with any API POST\", server)})\n\t}\n\n\tenv := os.Getenv(\"DT_ENV\")\n\tif env == \"\" {\n\t\tlogging.LogInfo(datatypes.Logging{Message: \"A Dynatrace environment was not provided. If your tenant has multiple environments, you will need to include the DT_ENV in the POST body of requests.\"})\n\t} else {\n\t\tlogging.LogInfo(datatypes.Logging{Message: fmt.Sprintf(\"Loaded default DT_ENV: %v. This can be overridden with any API POST.\", env)})\n\t}\n\n\tapiToken := os.Getenv(\"DT_API_TOKEN\")\n\tif apiToken == \"\" {\n\t\tlogging.LogInfo(datatypes.Logging{Message: \"A Dynatrace API token was not provided. DT_API_TOKEN must be given with every API POST.\"})\n\t} else {\n\t\tlogging.LogInfo(datatypes.Logging{Message: fmt.Sprintf(\"Loaded default DT_API_TOKEN: %v. This can be overridden with any API POST.\", apiToken)})\n\t}\n\n\tconfig := datatypes.Config{\n\t\tAPIToken: apiToken,\n\t\tEnv: env,\n\t\tServer: server,\n\t}\n\treturn config\n}", "func ParseConfig(configFile string) *SubmitConfig {\n\t// ------------------- load paddle config -------------------\n\tbuf, err := ioutil.ReadFile(configFile)\n\tconfig := SubmitConfig{}\n\tif err == nil {\n\t\tyamlErr := yaml.Unmarshal(buf, &config)\n\t\tif yamlErr != nil {\n\t\t\tglog.Errorf(\"load config %s error: %v\\n\", configFile, yamlErr)\n\t\t\treturn nil\n\t\t}\n\t\t// put active config\n\t\tconfig.ActiveConfig = nil\n\t\tfor _, item := range config.DC {\n\t\t\tif item.Name == config.CurrentDatacenter {\n\t\t\t\tconfig.ActiveConfig = &item\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn &config\n\t}\n\tglog.Errorf(\"config %s error: %v\\n\", configFile, err)\n\treturn nil\n}", "func getConfigFilePath() string {\n\tvar configFile string\n\tflag.StringVar(&configFile, \"config\", \"./config.json\", \"JSON config file path\")\n\tflag.Parse()\n\n\tlog.Printf(\"Using config file %s\", configFile)\n\n\treturn configFile\n}", "func ParseConfig(filepath string) error {\n\tf, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconf := make(map[string]interface{})\n\n\terr = json.Unmarshal(f, &conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconList := make(map[string]Elem)\n\tconfig = list{self: \"\", value: conList}\n\n\tlog.Printf(\"about to parse config\\n\")\n\tparseMap(conf, &config)\n\tlog.Printf(\"parsed config\\n\")\n\n\treturn nil\n}", "func (m *Tracing_Http) GetConfig() *types.Struct {\n\tif x, ok := m.GetConfigType().(*Tracing_Http_Config); ok {\n\t\treturn x.Config\n\t}\n\treturn nil\n}", "func (m *settings) readConfig() {\n\tlog.Printf(\"Reading configuration...\")\n\tjsonBlob, err := ioutil.ReadFile(m.filename)\n\tif err != nil {\n\t\tlog.Printf(\"No config file found. Using new config file.\")\n\t\treturn\n\t}\n\tif err := json.Unmarshal(jsonBlob, &m.redirects); err != nil {\n\t\tlog.Printf(\"Error unmarshalling %s\", err)\n\t}\n}", "func ProcessConfig() (c *Config, err error) {\n\tfile, err := os.Open(\"config.json\")\n\tif err != nil {\n\t\tlog.Println(\"Config not found in working directory, trying user's home\")\n\t\tcfgName, err2 := utils.GetHomeDirConfigFileName(\"config.json\", \".kdevpije\")\n\t\tif err2 != nil {\n\t\t\tlog.Println(\"Error obtaining home directory:\", err2)\n\t\t\treturn c, err2\n\t\t}\n\t\tvar err3 error\n\t\tfile, err3 = os.Open(cfgName)\n\t\tif err3 != nil {\n\t\t\tlog.Println(\"Config not found in ~/.kdevpije/\")\n\t\t\treturn c, err3\n\t\t}\n\t}\n\tdecoder := json.NewDecoder(file)\n\tc = &Config{}\n\terr = decoder.Decode(c)\n\tif err != nil {\n\t\tlog.Fatalln(\"Config decode error\")\n\t\treturn c, err\n\t}\n\tif c.Aliases == nil {\n\t\tc.Aliases = make(map[string][]string)\n\t}\n\tif c.PDConfig == nil {\n\t\tc.PDConfig = pagerduty.NewPDConfiguration()\n\t\tc.PDConfig.Token = \"s23zntFxLYp9NjYK99XH\"\n\t}\n\treturn\n}", "func getConfig(path string) (*config, error) {\n\tf, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg := &config{}\n\tif err := yaml.Unmarshal(f, &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\tfmt.Println(cfg)\n\n\treturn cfg, nil\n\n}", "func ParserConfig(_struct interface{}) error {\n\tpath := \"/var/arposter/config.json\"\n\tfile, err := os.OpenFile(path, os.O_RDONLY, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tdecoder := json.NewDecoder(file)\n\tif err := decoder.Decode(&_struct); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func readConfig(confFile, confPath, confType string) {\n\tviper.SetConfigName(confFile)\n\tviper.AddConfigPath(confPath)\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tfmt.Println(\"Error in reading config file. Exiting \", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t//get all config data into a conf struct\n\tConf = map[string]string{\n\t\t\"scan_success\": viper.GetString(\"common.scan_success\"),\n\t\t\"scan_failure\": viper.GetString(\"common.scan_failure\"),\n\t\t\"sort_success\": viper.GetString(\"common.sort_success\"),\n\t\t\"sort_failure\": viper.GetString(\"common.sort_failure\"),\n\t\t\"inst_name\": viper.GetString(confType + \".inst_name\"),\n\t\t\"cont\": viper.GetString(confType + \".cont\"),\n\t\t\"scan_url\": viper.GetString(confType + \".scan_url\"),\n\t\t\"sort_url\": viper.GetString(confType + \".sort_url\"),\n\t\t\"feedback_url\": viper.GetString(confType + \".feedback_url\"),\n\t\t\"wgh_url\": viper.GetString(confType + \".wgh_url\"),\n\t\t\"event_url\": viper.GetString(confType + \".event_url\"),\n\t\t\"fault_code_url\": viper.GetString(confType + \".fault_code_url\"),\n\t\t\"image_url\": viper.GetString(confType + \".image_url\"),\n\t\t\"initConfig_url\": viper.GetString(confType + \".initConfig_url\"),\n\t}\n\tfor k, v := range Conf {\n\t\tfmt.Printf(\"%s : %s\\n\", k, v)\n\t}\n}", "func GetConfig() Config {\n\tif value, ok := os.LookupEnv(\"APP_DEBUG\"); ok {\n\t\tvalue = strings.Trim(value, \" \\r\\n\")\n\t\tvalue = strings.ToLower(value)\n\t\tif value == \"true\" {\n\t\t\tconfig.Debug = true\n\t\t} else {\n\t\t\tgin.SetMode(gin.ReleaseMode)\n\t\t}\n\t}\n\n\tif value, ok := os.LookupEnv(\"GEO_IP_DB_PATH\"); ok {\n\t\tvalue = strings.Trim(value, \" \\r\\n\")\n\t\tconfig.GeoIP.DBPath = value\n\t} else {\n\t\t// log.Fatalln(\"GEO_IP_DB_PATH is not set\")\n\t}\n\n\tif value, ok := os.LookupEnv(\"REQUEST_ID_LENGTH\"); ok {\n\t\tif length, err := strconv.Atoi(value); err == nil {\n\t\t\tconfig.RequestID.Length = length\n\t\t}\n\t}\n\n\treturn config\n}", "func (app *Application) GetConfig() *Config {\n return app.config\n}", "func ParseFile(configFilePath string) (*Config, error) {\n\t// Read the config file\n\tconfigData, err := ioutil.ReadFile(configFilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse the config JSON\n\tconfig := Config{}\n\terr = json.Unmarshal(configData, &config)\n\tif err != nil {\n\t\treturn nil, errors.New(\"invalid config file\")\n\t}\n\n\t// Validate the ports\n\tif config.TelnetPort <= 0 {\n\t\treturn nil, errors.New(\"invalid telnet port\")\n\t}\n\n\tif config.WebPort <= 0 {\n\t\treturn nil, errors.New(\"invalid web port\")\n\t}\n\n\t// Validate the web client path\n\tinfo, err := os.Stat(config.WebClientPath)\n\tif (err != nil && os.IsNotExist(err)) || !info.IsDir() {\n\t\treturn nil, errors.New(\"invalid web client path\")\n\t}\n\n\treturn &config, nil\n}", "func GetWebConfig(w http.ResponseWriter, r *http.Request) {\n\tmiddleware.EnableCors(&w)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tconfiguration := config.Config.InstanceDetails\n\tconfiguration.Version = config.Config.VersionInfo\n\tif err := json.NewEncoder(w).Encode(configuration); err != nil {\n\t\tbadRequestHandler(w, err)\n\t}\n}", "func GetConfig() Configuration{\n\tcurrentPath := files.GetCurrentDirectory()\n\tjsonFile, err := os.Open(currentPath + \"/config.json\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tfmt.Println(currentPath)\n\tdefer jsonFile.Close()\n\tbyteValue, _ := ioutil.ReadAll(jsonFile)\n\tvar configuration Configuration\n\tjson.Unmarshal(byteValue, &configuration)\n\treturn configuration\n}", "func configRead() (string, error) {\n\n\tfhndl, err := ioutil.ReadFile(\"/etc/testpool/testpool.yml\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\troot, err := simpleyaml.NewYaml(fhndl)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvalue := root.GetPath(\"tpldaemon\", \"profile\", \"log\")\n\treturn value.String()\n\n}", "func ConfigReadFile(path string) (string, []byte, error) {\n\tif strings.HasPrefix(path, \"file://\") {\n\t\tpath = path[7:]\n\t}\n\n\tpos := strings.LastIndexByte(path, '.')\n\tif pos == -1 {\n\t\tpos += len(path)\n\t}\n\n\tdata, err := ioutil.ReadFile(path)\n\tlast := strings.LastIndex(path, \".\") + 1\n\tif last == 0 {\n\t\treturn \"\", nil, fmt.Errorf(\"read file config, type is null\")\n\t}\n\treturn path[pos+1:], data, err\n}", "func GetConfig(configFileName string, trafficOpsHost string, trafficServerHost string, params []TrafficOpsParameter) (string, error) {\n\tswitch configFileName {\n\tcase \"storage.config\":\n\t\treturn createStorageDotConfig(trafficOpsHost, trafficServerHost, params)\n\tdefault:\n\t\treturn \"\", errors.New(\"Config file '%s' not valid\")\n\t}\n}", "func (c ConfigHandler) GetConfig(key string, defaultValue interface{}) interface{} {\n\t// Returns the default value if the key is not defined in the config\n\tif c.config.IsSet(key) == false {\n\t\treturn defaultValue\n\t}\n\treturn c.config.Get(key)\n}", "func getConfig(fpath string) {\n\traw, err := ioutil.ReadFile(fpath)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to read config %q, err: %v\", fpath, err)\n\t\tos.Exit(1)\n\t}\n\terr = json.Unmarshal(raw, &ctx.config)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to json-unmarshal config %q, err: %v\", fpath, err)\n\t\tos.Exit(1)\n\t}\n}", "func (client *WANCableLinkConfig1) GetConfigFile() (NewConfigFile string, err error) {\n\treturn client.GetConfigFileCtx(context.Background())\n}", "func getConfig(configFile string) {\n\tvar err error\n\tvar input = io.ReadCloser(os.Stdin)\n\tif input, err = os.Open(configFile); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer input.Close()\n\n\t// Read the config file\n\tyamlBytes, err := ioutil.ReadAll(input)\n\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Parse the config\n\tif err := yaml.Unmarshal(yamlBytes, &config); err != nil {\n\t\t//log.Fatalf(\"Content: %v\", yamlBytes)\n\t\tlog.Fatalf(\"Could not parse %q: %v\", configFile, err)\n\t}\n}", "func (b *backend) pathConfigRead(ctx context.Context, req *logical.Request, _ *framework.FieldData) (*logical.Response, error) {\n\tc, err := b.GetConfig(ctx, req.Storage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &logical.Response{\n\t\tData: map[string]interface{}{\n\t\t\t\"endpoint\": c.Endpoint,\n\t\t\t\"accessKeyId\": c.AccessKeyId,\n\t\t\t\"secretAccessKey\": c.SecretAccessKey,\n\t\t\t\"useSSL\": c.UseSSL,\n\t\t},\n\t}, nil\n}", "func (o *FormField) GetConfig() FormConfig {\n\tif o == nil || o.Config == nil {\n\t\tvar ret FormConfig\n\t\treturn ret\n\t}\n\treturn *o.Config\n}", "func GetConfig() *PinoyConfig {\n\treturn pcfg\n}", "func readParseFile(filename string) (page Page) {\n\tlog.Debug(\"Parsing File:\", filename)\n\tepoch, _ := time.Parse(\"20060102\", \"19700101\")\n\n\t// setup default page struct\n\tpage = Page{\n\t\tDate: epoch,\n\t\tOutFile: filename,\n\t\tExtension: \".html\",\n\t\tParams: make(map[string]string),\n\t}\n\n\t// read file\n\tvar data, err = ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tlog.Warn(\"Error Reading: \" + filename)\n\t\treturn\n\t}\n\n\t// go through content parse from --- to ---\n\tvar lines = strings.Split(string(data), \"\\n\")\n\tvar found = 0\n\tfor i, line := range lines {\n\t\tline = strings.TrimSpace(line)\n\n\t\tif found == 1 {\n\t\t\t// parse line for param\n\t\t\tcolonIndex := strings.Index(line, \":\")\n\t\t\tif colonIndex > 0 {\n\t\t\t\tkey := strings.ToLower(strings.TrimSpace(line[:colonIndex]))\n\t\t\t\tvalue := strings.TrimSpace(line[colonIndex+1:])\n\t\t\t\tvalue = strings.Trim(value, \"\\\"\") //remove quotes\n\t\t\t\tswitch key {\n\t\t\t\tcase \"title\":\n\t\t\t\t\tpage.Title = value\n\t\t\t\tcase \"category\":\n\t\t\t\t\tpage.Category = value\n\t\t\t\tcase \"layout\":\n\t\t\t\t\tpage.Layout = value\n\t\t\t\tcase \"extension\":\n\t\t\t\t\tpage.Extension = \".\" + value\n\t\t\t\tcase \"date\":\n\t\t\t\t\tpage.Date, _ = time.Parse(\"2006-01-02\", value[0:10])\n\t\t\t\tdefault:\n\t\t\t\t\tpage.Params[key] = value\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else if found >= 2 {\n\t\t\t// params over\n\t\t\tlines = lines[i:]\n\t\t\tbreak\n\t\t}\n\n\t\tif line == \"---\" {\n\t\t\tfound += 1\n\t\t}\n\n\t}\n\n\t// chop off first directory, since that is the template dir\n\tlog.Debug(\"Filename\", filename)\n\tpage.OutFile = filename[strings.Index(filename, string(os.PathSeparator))+1:]\n\tpage.OutFile = strings.Replace(page.OutFile, \".md\", page.Extension, 1)\n\tlog.Debug(\"page.Outfile\", page.OutFile)\n\n\t// next directory(s) category, category includes sub-dir = solog/webdev\n\tif page.Category == \"\" {\n\t\tif strings.Contains(page.OutFile, string(os.PathSeparator)) {\n\t\t\tpage.Category = page.OutFile[0:strings.LastIndex(page.OutFile, string(os.PathSeparator))]\n\t\t\tpage.SimpleCategory = strings.Replace(page.Category, string(os.PathSeparator), \"_\", -1)\n\t\t}\n\t}\n\tlog.Debug(\"page.Category\", page.Category)\n\t// parse date from filename\n\tbase := filepath.Base(page.OutFile)\n\tif base[0:2] == \"20\" || base[0:2] == \"19\" { //HACK: if file starts with 20 or 19 assume date\n\t\tpage.Date, _ = time.Parse(\"2006-01-02\", base[0:10])\n\t\tpage.OutFile = strings.Replace(page.OutFile, base[0:11], \"\", 1) // remove date from final filename\n\t}\n\n\t// add url of page, which includes initial slash\n\t// this is needed to get correct links for multi\n\t// level directories\n\tpage.Url = \"/\" + page.OutFile\n\n\t// convert markdown content\n\tcontent := strings.Join(lines, \"\\n\")\n\tif (config.UseMarkdown) && (page.Params[\"markdown\"] != \"no\") {\n\t\toutput := blackfriday.Run([]byte(content))\n\t\tpage.Content = string(output)\n\t} else {\n\t\tpage.Content = content\n\t}\n\n\treturn page\n}", "func parseConfig(path string) (Config, error) {\n\tconfig := Config{}\n\tfile, err := os.Open(path)\n\tdefer file.Close()\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\treturn config, err\n\t}\n\treturn config, nil\n}", "func (p *Parser) Get(config interface{}) error {\n\tv := reflect.ValueOf(config)\n\tif t := v.Type(); !(t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Struct) {\n\t\treturn NewErrInvalidConfigType(t)\n\t}\n\n\t_, err := p.parse(v.Elem())\n\n\treturn err\n}", "func GetConfig(fileName string) (*MatterwickConfig, error) {\n\tconfig := &MatterwickConfig{}\n\tfileName = findConfigFile(fileName)\n\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn config, errors.Wrap(err, \"unable to open config file\")\n\t}\n\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(config)\n\tif err != nil {\n\t\treturn config, errors.Wrap(err, \"unable to decode config file\")\n\t}\n\n\treturn config, nil\n}", "func GetConfig(item string) string {\n\tswitch item {\n\tcase \"dbtouse\":\n\t\treturn Conf.Dbtouse\n\tcase \"dburl\":\n\t\treturn Conf.Dburl\n\tcase \"connectString\":\n\t\treturn Conf.ConnectString\n\tcase \"Mapsfile\":\n\t\treturn Conf.Mapsfile\n\tcase \"Templatesdir\":\n\t\treturn Conf.Templatesdir\n\tcase \"Tcpport\":\n\t\treturn Conf.Tcpport\n\tcase \"Fnr\":\n\t\treturn fmt.Sprintf(\"%v\", Conf.Fnr)\n\t}\n\treturn \"unknown request\"\n}", "func GetConfig(myCfg string, tolerant, allowSourcing, expand, recursive bool, expandMap map[string]string) map[string]string {\n\tif len(expandMap) > 0 {\n\t\texpand = true\n\t} else {\n\t\texpandMap = map[string]string{}\n\t}\n\tmyKeys := map[string]string{}\n\n\tif recursive {\n\t\tif !expand {\n\t\t\texpandMap = map[string]string{}\n\t\t}\n\t\tfname := \"\"\n\t\tfor _, fname = range grab.RecursiveFileList(myCfg) {\n\t\t\tnewKeys := GetConfig(fname, tolerant, allowSourcing, true, false, expandMap)\n\t\t\tfor k, v := range newKeys {\n\t\t\t\tmyKeys[k] = v\n\t\t\t}\n\t\t}\n\t\tif fname == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\treturn myKeys\n\t}\n\n\tf, err := os.Open(myCfg)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tf.Close()\n\tc, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tcontent := string(c)\n\n\tif content != \"\" && !strings.HasSuffix(content, \"\\n\") {\n\t\tcontent += \"\\n\"\n\t}\n\tif strings.Contains(content, \"\\r\") {\n\t\tmsg.WriteMsg(fmt.Sprintf(\"!!! Please use dos2unix to convert line endings in config file: '%s'\\n\", myCfg), -1, nil)\n\t}\n\tlex := NewGetConfigShlex(strings.NewReader(content), myCfg, true, \"\", tolerant)\n\tlex.Wordchars = \"abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%*_\\\\:;?,./-+{}\"\n\tlex.Quotes = \"\\\"'\"\n\tif allowSourcing {\n\t\tlex.allowSourcing(expandMap)\n\t}\n\tfor {\n\t\tkey, _ := lex.GetToken()\n\t\tif key == \"export\" {\n\t\t\tkey, _ = lex.GetToken()\n\t\t}\n\t\tif key == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tequ, _ := lex.GetToken()\n\t\tif equ == \"\" {\n\t\t\tmsg1 := \"Unexpected EOF\" //TODO error_leader\n\t\t\tif !tolerant {\n\t\t\t\t//raise ParseError(msg)\n\t\t\t} else {\n\t\t\t\tmsg.WriteMsg(fmt.Sprintf(\"%s\\n\", msg1), -1, nil)\n\t\t\t\treturn myKeys\n\t\t\t}\n\t\t} else if equ != \"=\" {\n\t\t\tmsg1 := fmt.Sprintf(\"Invalid token '%s' (not '=')\", equ) //TODO error_leader\n\t\t\tif !tolerant {\n\t\t\t\t//raise ParseError(msg)\n\t\t\t} else {\n\t\t\t\tmsg.WriteMsg(fmt.Sprintf(\"%s\\n\", msg1), -1, nil)\n\t\t\t\treturn myKeys\n\t\t\t}\n\t\t}\n\t\tval, _ := lex.GetToken() /* TODO: fix it\n\t\tif val == \"\" {\n\t\t\tmsg := fmt.Sprintf(\"Unexpected end of config file: variable '%s'\", key) //TODO error_leader\n\t\t\tif !tolerant {\n\t\t\t\t//raise ParseError(msg)\n\t\t\t} else {\n\t\t\t\tmsg.WriteMsg(fmt.Sprintf(\"%s\\n\", msg), -1, nil)\n\t\t\t\treturn myKeys\n\t\t\t}\n\t\t}*/\n\t\tif invalidVarNameRe.MatchString(key) {\n\t\t\tmsg1 := fmt.Sprintf(\"Invalid variable name '%s'\", key) //TODO error_leader\n\t\t\tif !tolerant {\n\t\t\t\t//raise ParseError(msg)\n\t\t\t} else {\n\t\t\t\tmsg.WriteMsg(fmt.Sprintf(\"%s\\n\", msg1), -1, nil)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif expand {\n\t\t\tmyKeys[key] = VarExpand(val, expandMap, nil) //TODO lex.error_leader\n\t\t\texpandMap[key] = myKeys[key]\n\t\t} else {\n\t\t\tmyKeys[key] = val\n\t\t}\n\t}\n\treturn myKeys\n}", "func GetConfig() *Config {\n\tvar configPath string\n\tflag.StringVar(&configPath, \"config-path\", \"../configs/server.toml\", \"config file path\")\n\tflag.Parse()\n\tconfig := NewConfig()\n\t_, err := toml.DecodeFile(configPath, config)\n\tHandleError(err, ErrorFatal)\n\treturn config\n}", "func (a *Admin) GetConfig(_ *http.Request, _ *struct{}, reply *interface{}) error {\n\ta.Log.Debug(\"API called\",\n\t\tzap.String(\"service\", \"admin\"),\n\t\tzap.String(\"method\", \"getConfig\"),\n\t)\n\t*reply = a.NodeConfig\n\treturn nil\n}", "func GetConfig(filename string) Config {\n\tconfig := Config{}\n\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = json.Unmarshal(data, &config)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn config\n}", "func GetConfig() *viper.Viper {\n\treturn config\n}", "func (b *Backend) GetConfig() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"name \" + b.Config.Name + \"\\n\")\n\tsb.WriteString(\"method \" + b.Config.Method + \"\\n\")\n\tsb.WriteString(\"realm \" + b.Config.Realm + \"\\n\")\n\tsb.WriteString(\"provider \" + b.Config.Provider)\n\treturn sb.String()\n}", "func (c *Config) Get(path string) Value {\n\tc.l.RLock()\n\tdefer c.l.RUnlock()\n\n\treturn Value{\n\t\traw: reduce(strings.Split(path, \".\"), c.m),\n\t}\n}", "func (p *Plugin) getConfigData(ctx context.Context, req *request) (string, error) {\n\t// get changed files\n\tchangedFiles, err := p.getScmChanges(ctx, req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// get drone.yml for changed files or all of them if no changes/cron\n\tconfigData := \"\"\n\tif changedFiles != nil {\n\t\tconfigData, err = p.getConfigForChanges(ctx, req, changedFiles)\n\t} else if req.Build.Trigger == \"@cron\" {\n\t\tlogrus.Warnf(\"%s @cron, rebuilding all\", req.UUID)\n\t\tif p.considerFile == \"\" {\n\t\t\tlogrus.Warnf(\"recursively scanning for config files with max depth %d\", p.maxDepth)\n\t\t}\n\t\tconfigData, err = p.getConfigForTree(ctx, req, \"\", 0)\n\t} else if p.fallback {\n\t\tlogrus.Warnf(\"%s no changed files and fallback enabled, rebuilding all\", req.UUID)\n\t\tif p.considerFile == \"\" {\n\t\t\tlogrus.Warnf(\"recursively scanning for config files with max depth %d\", p.maxDepth)\n\t\t}\n\t\tconfigData, err = p.getConfigForTree(ctx, req, \"\", 0)\n\t}\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// no file found\n\tif configData == \"\" {\n\t\treturn \"\", errors.New(\"did not find a .drone.yml\")\n\t}\n\n\t// cleanup\n\tconfigData = removeDocEndRegex.ReplaceAllString(configData, \"\")\n\tconfigData = string(dedupRegex.ReplaceAll([]byte(configData), []byte(\"---\")))\n\treturn configData, nil\n}", "func (c *Config) ReadConfig(configPath string) {\n\t// Init viper\n\tc.v = viper.New()\n\n\t// Init maps where the config will be stored\n\tc.strings = make(map[string]string)\n\tc.booleans = make(map[string]bool)\n\tc.uints = make(map[string]uint)\n\n\t// Define where viper tries to get config information\n\tenvPrefix := \"sprawl\"\n\n\t// Set environment variable prefix, automatically transformed to uppercase\n\tc.v.SetEnvPrefix(envPrefix)\n\n\t// Set replacer to env variables, replacing dots with underscores\n\tc.v.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\"))\n\n\t// Automatically try to fetch all configs from env\n\tc.v.AutomaticEnv()\n\n\t// Initialize viper with Sprawl-specific options\n\tc.v.SetConfigName(\"config\")\n\n\t// Use toml format for config files\n\tc.v.SetConfigType(\"toml\")\n\n\t// Allow build to disable config file directories\n\tif configPath != \"\" {\n\t\t// Check for overriding config files\n\t\tc.v.AddConfigPath(\".\")\n\t\t// Check for user submitted config path\n\t\tc.v.AddConfigPath(configPath)\n\t}\n\n\t// Read config file\n\tif err := c.v.ReadInConfig(); !errors.IsEmpty(err) {\n\t\tif _, ok := err.(viper.ConfigFileNotFoundError); ok {\n\t\t\tfmt.Println(\"Config file not found, using ENV\")\n\t\t} else {\n\t\t\tfmt.Println(\"Config file invalid!\")\n\t\t}\n\t} else {\n\t\tfmt.Println(\"Config successfully loaded.\")\n\t}\n\n\tc.AddString(dbPathVar)\n\tc.AddString(p2pExternalIPVar)\n\tc.AddString(logLevelVar)\n\tc.AddString(logFormatVar)\n\tc.AddUint(p2pPortVar)\n\tc.AddUint(rpcPortVar)\n\tc.AddUint(websocketPortVar)\n\tc.AddBoolean(websocketEnableVar)\n\tc.AddBoolean(dbInMemoryVar)\n\tc.AddBoolean(p2pNATPortMapVar)\n\tc.AddBoolean(p2pRelayVar)\n\tc.AddBoolean(p2pAutoRelayVar)\n\tc.AddBoolean(p2pDebugVar)\n\tc.AddBoolean(errorsEnableStackTraceVar)\n\tc.AddBoolean(ipfsPeerVar)\n\n}", "func Get(path ...string) reader.Value {\n\treturn DefaultConfig.Get(normalizePath(path...)...)\n}", "func (p *Plugin) getConfig(ctx context.Context, req *request) (*drone.Config, error) {\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"after\": req.Build.After,\n\t\t\"before\": req.Build.Before,\n\t\t\"branch\": req.Repo.Branch,\n\t\t\"ref\": req.Build.Ref,\n\t\t\"slug\": req.Repo.Slug,\n\t\t\"trigger\": req.Build.Trigger,\n\t}).Debugf(\"drone-tree-config environment\")\n\n\t// check cache first, when enabled\n\tck := newCacheKey(req)\n\tif p.cacheTTL > 0 {\n\t\tif cached, exists := p.cache.retrieve(req.UUID, ck); exists {\n\t\t\tif cached != nil {\n\t\t\t\treturn &drone.Config{Data: cached.config}, cached.error\n\t\t\t}\n\t\t}\n\t}\n\n\t// fetch the config data. cache it, when enabled\n\treturn p.cacheAndReturn(\n\t\treq.UUID, ck,\n\t\tnewCacheEntry(\n\t\t\tp.getConfigData(ctx, req),\n\t\t),\n\t)\n}", "func GetConfig(section string, option string) string {\n value, err := cfg.String(section, option)\n if err != nil {\n seelog.Errorf(\"Get Config [%v].[%v] Fail : %v\", section, option, err)\n return \"\"\n }\n\n return value\n // result is string \"http://www.example.com/some/path\"\n\n // c.Int(\"service-1\", \"maxclients\")\n // // result is int 200\n\n // c.Bool(\"service-1\", \"delegation\")\n // // result is bool true\n\n // c.String(\"service-1\", \"comments\")\n // // result is string \"This is a multi-line\\nentry\"\n}", "func (c *ConfigImpl) GetConfig(key string) (GoConfig, error) {\n\tkeys := strings.Split(key, \".\")\n\tvalues := subMap(&c.values, keys, false)\n\tif nil == values {\n\t\treturn nil, errors.New(\"Key '\" + key + \"' does not exsists\")\n\t}\n\treturn &ConfigImpl{values: *values, parent: c, def: c.def}, nil\n}", "func GetConfig() interface{} {\n\treturn std.GetConfig()\n}", "func GetConfig(returnType, key string, defaultVal interface{}) (value interface{}, err error) {\n\tsection, err := config.GetSection(returnType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif section[key] != \"\" {\n\t\treturn section[key], nil\n\t}\n\treturn defaultVal, nil\n}", "func (s *ossServer) parseConfig(path string) (*dataRun.Config, error) {\n\tpath = s.resolvePath(path)\n\t// Use demo configuration if no config path is specified.\n\tif path == \"\" {\n\t\treturn nil, errors.New(\"missing config file\")\n\t}\n\n\tconfig := dataRun.NewConfig()\n\tif err := config.FromTomlFile(path); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn config, nil\n}", "func GetConfig() {\n\n\tenv := true\n\ttempcfgdbhostname := os.Getenv(\"APP_DB_HOSTNAME\")\n\ttempcfgport := os.Getenv(\"APP_PORT\")\n\tif tempcfgdbhostname != \"\" {\n\t\tglobalconfig.DBHostName = tempcfgdbhostname\n\t} else {\n\t\tenv = false\n\t}\n\tif tempcfgport != \"\" {\n\t\tglobalconfig.HTTPPortNumber = tempcfgport\n\t} else {\n\t\tenv = false\n\t}\n\n\tif env == false {\n\t\tconfigbytes, err := ioutil.ReadFile(\"config.json\")\n\t\tif err != nil {\n\t\t}\n\t\terr = json.Unmarshal(configbytes, &globalconfig)\n\t\tfmt.Println(globalconfig)\n\t\tif err == nil {\n\t\t\tglobalconfig.Method = \"CofigFile\"\n\t\t}\n\t} else {\n\t\tglobalconfig.Method = \"EnvironmentVars\"\n\t}\n}", "func (c *Config) File() string { return c.viper.GetString(configFile) }", "func (m *HealthCheck_CustomHealthCheck) GetConfig() *types.Struct {\n\tif x, ok := m.GetConfigType().(*HealthCheck_CustomHealthCheck_Config); ok {\n\t\treturn x.Config\n\t}\n\treturn nil\n}", "func GetConfig() (config *Config, err error) {\n\tconfigpath := path.Join(os.Getenv(\"GOPATH\"), \"src\", \"hellofresh\", \"config.json\")\n\tconfigFile, err := os.Open(configpath)\n\tdefer configFile.Close()\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tjsonParser := json.NewDecoder(configFile)\n\tif err = jsonParser.Decode(&config); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func GetRecalboxConfHandler(ctx iris.Context) {\n\tcp := viper.GetString(\"recalbox.confPath\")\n\tcc, err := ioutil.ReadFile(cp)\n\tif err != nil {\n\t\tctx.Values().Set(\"error\", errors.FormatErrorForLog(ctx, err.(error)))\n\t\tctx.StatusCode(500)\n\n\t\treturn\n\t}\n\n\tctx.ViewData(\"ConfPath\", cp)\n\tctx.ViewData(\"ConfContent\", string(cc))\n\n\tctx.ViewData(\"Tr\", iris.Map{\n\t\t\"BtnSave\": ctx.Translate(\"BtnSave\"),\n\t})\n\n\tctx.View(\"views/recalbox-conf.pug\")\n}", "func (c *config) GetConfig(key string, res interface{}) (err error) {\n\tvar (\n\t\treq *http.Request\n\t\tresp *http.Response\n\t\tbs []byte\n\t)\n\tif key != \"\" {\n\t\tc.Key = key\n\t}\n\tif req, err = http.NewRequest(\"GET\", c.buildUrl(), nil); err != nil {\n\t\treturn\n\t}\n\tclient := http.Client{}\n\tif resp, err = client.Do(req); err != nil {\n\t\treturn\n\t}\n\tif resp.StatusCode == http.StatusNotFound {\n\t\terr = ConfigNotFound\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tif bs, err = readAll(resp.Body, _minRead); err != nil {\n\t\treturn\n\t}\n\t_, err = toml.Decode(string(bs), res)\n\treturn\n}", "func (b *TendermintBackend) parseConfig() (*cfg.Config, error) {\n\tv := viper.New()\n\tv.AutomaticEnv()\n\n\tv.SetEnvPrefix(\"TM\")\n\tv.SetConfigName(\"config\") // name of config file (without extension)\n\tv.AddConfigPath(b.RootPath + \"/config\") // search root directory\n\tv.ReadInConfig()\n\tconf := cfg.DefaultConfig()\n\terr := v.Unmarshal(conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconf.SetRoot(b.RootPath)\n\t//Add overrides here\n\tif b.OverrideCfg.RPCListenAddress != \"\" {\n\t\tconf.RPC.ListenAddress = b.OverrideCfg.RPCListenAddress\n\t}\n\tconf.ProxyApp = fmt.Sprintf(\"tcp://127.0.0.1:%d\", b.OverrideCfg.RPCProxyPort)\n\tconf.Consensus.CreateEmptyBlocks = b.OverrideCfg.CreateEmptyBlocks\n\tconf.Mempool.WalPath = \"data/mempool.wal\"\n\n\tcfg.EnsureRoot(b.RootPath)\n\treturn conf, err\n}", "func GetConfig() *Config {\n\treturn &values\n}", "func parseConfig(appConfigPath string) (err error) {\n\tAppConfig, err = newAppConfig(appConfigProvider, appConfigPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn assignConfig(AppConfig)\n}", "func parseConfig(appConfigPath string) (err error) {\n\tAppConfig, err = newAppConfig(appConfigProvider, appConfigPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn assignConfig(AppConfig)\n}", "func readConfig(file string) wConfig {\n\tvar c = wConfig{}\n\t_, err := os.Stat(file)\n\tif err == nil {\n\t\tf, _ := os.Open(file)\n\t\tdefer f.Close()\n\t\tdecoder := json.NewDecoder(f)\n\t\terr := decoder.Decode(&c)\n\t\tcheck(err)\n\t} else {\n\t\tif !os.IsNotExist(err) {\n\t\t\tlog.Fatalf(\"Unable to read %s: %s\\n\", file, err)\n\t\t}\n\t}\n\treturn c\n}", "func GetConfigFile() (string, string) {\n\tdefaultConfig := filepath.Join(file.UserHome(), config.DefaultConfigDir, config.DefaultConfig)\n\tdefaultAppDir, _ := filepath.Split(defaultConfig)\n\treturn defaultAppDir, defaultConfig\n}", "func (db *DB) readConfig() (*ConfigEntry, error) {\n\tdata, err := ioutil.ReadFile(db.ConfigPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar entries map[string]ConfigEntry\n\terr = yaml.Unmarshal(data, &entries)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tentry, exists := entries[db.Domain]\n\tif !exists {\n\t\treturn nil, ErrNotFound\n\t}\n\n\treturn &entry, nil\n}", "func (configProvider) GetProjectConfig(c context.Context, p string) (*tricium.ProjectConfig, error) {\n\treturn getProjectConfig(c, p)\n}", "func GetConfig(useGCPSecrets bool,\n\tyamlConfig bool, jsonConfig bool,\n\tfilePath string, config interface{}) error {\n\tvar data []byte\n\tvar err error\n\tif yamlConfig && jsonConfig {\n\t\treturn errors.New(\"yamlconfig and jsonconfig cannot both be true\")\n\t}\n\n\tif useGCPSecrets {\n\t\tgcloudVars := setGcloudVars()\n\t\tdata, err = gcloudVars.getSecretFromGSM()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tdata, err = ioutil.ReadFile(filePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif yamlConfig {\n\t\terr = yaml.Unmarshal([]byte(data), &config)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if jsonConfig {\n\t\terr = json.Unmarshal([]byte(data), &config)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetConfig() Config {\n\tif !loaded {\n\t\tbyteData, err := ioutil.ReadFile(\"config.json\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tjson.Unmarshal(byteData, &config)\n\t\tloaded = true\n\t}\n\treturn config\n}", "func parseConfig(file *os.File) (Config, error) {\n\tbuilderConfig := Config{}\n\ttomlMetadata, err := toml.NewDecoder(file).Decode(&builderConfig)\n\tif err != nil {\n\t\treturn Config{}, errors.Wrap(err, \"decoding toml contents\")\n\t}\n\n\tundecodedKeys := tomlMetadata.Undecoded()\n\tif len(undecodedKeys) > 0 {\n\t\tunknownElementsMsg := config.FormatUndecodedKeys(undecodedKeys)\n\n\t\treturn Config{}, errors.Errorf(\"%s in %s\",\n\t\t\tunknownElementsMsg,\n\t\t\tstyle.Symbol(file.Name()),\n\t\t)\n\t}\n\n\treturn builderConfig, nil\n}", "func GetAppConfiguration() map[string] interface{} {\r\n\tif (appConfig != nil) {\r\n\t\treturn appConfig;\r\n\t}\r\n\r\n\tdir, _ := os.Getwd();\r\n\tplan, _ := ioutil.ReadFile(dir + \"/conf/config.json\") // filename is the JSON file to read\r\n\tvar data map[string] interface{}\r\n\terr := json.Unmarshal(plan, &data)\r\n\tif (err != nil) {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tappConfig = data;\r\n\tprintConfig();\r\n\treturn data;\r\n}", "func (p Plans) ConfigFile() Path {\n\treturn p.Expand().Join(\"config.json\")\n}", "func ParseConfigFile(filePath string) (*Config, error) {\n\tv := viper.New()\n\tcfg := &Config{v}\n\tcfg.SetDefault(\"init\", \"\") // e.g. \"init.sh\"\n\tcfg.SetDefault(\"run\", \"\") // e.g. \"run.sh\"\n\tcfg.SetDefault(\"clean\", \"\") // e.g. \"clean.sh\"\n\tcfg.SetDefault(\"validate\", \"\") // e.g. \"validate.sh\"\n\tcfg.SetDefault(\"kill\", \"\") // e.g. \"kill.sh\", unexpected death\n\tcfg.SetDefault(\"shutdown\", \"\") // e.g. \"shutdown.sh\", graceful shutdown\n\tcfg.SetDefault(\"explorePolicy\", \"dumb\")\n\tcfg.SetDefault(\"explorePolicyParam\", map[string]interface{}{})\n\tcfg.SetDefault(\"storageType\", \"naive\")\n\tcfg.SetDefault(\"notCleanIfValidationFail\", false)\n\t// Viper Issue: Default value for nested key #71 (https://github.com/spf13/viper/issues/71)\n\tcfg.SetDefault(\"inspectorHandler\",\n\t\tmap[string]interface{}{\n\t\t\t\"pb\": map[string]interface{}{\n\t\t\t\t// TODO: port\n\t\t\t},\n\t\t\t\"rest\": map[string]interface{}{\n\t\t\t\t// TODO: port\n\t\t\t},\n\t\t})\n\t// viper supports JSON, YAML, and TOML\n\tcfg.SetConfigFile(filePath)\n\terr := cfg.ReadInConfig()\n\tif err == nil {\n\t\tif cfg.GetString(\"run\") == \"\" {\n\t\t\terr = errors.New(\"required field \\\"run\\\" is missing\")\n\t\t}\n\t}\n\treturn cfg, err\n}", "func (n Node) GetConfig() *TreeConfig {\n\treturn n.GetRoot().Config\n}", "func readConfig(configFilePath string) *Config {\n\t// fmt.Println(\"doing readConfig\")\n\tfile, err := os.Open(configFilePath)\n\tdefer file.Close()\n\tdecoder := json.NewDecoder(file)\n\tconfig := new(Config)\n\terr = decoder.Decode(config)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn config\n}", "func GetConfig() *Config {\n\treturn &Config{\n\t\tDB: &DBConfig{\n\t\t\tUsername: \"postgres\",\n\t\t\tPassword: \"cristiano1994\",\n\t\t\tDatabase: \"spataro_visitas\",\n\t\t\tPort: 5432,\n\t\t\tHost: \"localhost\",\n\t\t},\n\t}\n}", "func GetConfig() *viper.Viper {\n\tviper.SetConfigName(\"base\")\n\tviper.AddConfigPath(\"config\")\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tif _, ok := err.(viper.ConfigFileNotFoundError); ok {\n\t\t\tlog.Fatal(\"Config file not found\")\n\t\t} else {\n\t\t\tlog.Fatal( \"Config file can't be read\")\n\t\t}\n\t}\n\treturn viper.GetViper()\n}", "func GetConfig() (map[string]string, error) {\n\tdata, err := download(GcpConfigFileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar config map[string]string\n\terr = json.Unmarshal(data, &config)\n\treturn config, err\n}", "func readConfigFile(cfgFile string) (Config, error) {\n\n\tlog.Info(\"RabbitRelay: reading configuration from: \", cfgFile)\n\n\tconfig := Config{}\n\n\tvar err error\n\tfileContents, err := ioutil.ReadFile(cfgFile)\n\n\tif err != nil {\n\n\t\tlog.Critical(\"Error reading config file: \", err)\n\n\t} else {\n\n\t\t// This doesn't work, only the top level items are populated\n\t\t// err = jsonpointer.FindDecode(fileContents,\"\",&config)\n\t\terr = jsonpointer.FindDecode(fileContents, \"/masterRabbitServer\", &config.masterServer)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error reading master server config: \", err)\n\t\t\treturn config, err\n\t\t}\n\t\terr = jsonpointer.FindDecode(fileContents, \"/slaveRabbitServers\", &config.slaveServers)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error reading slave server config: \", err)\n\t\t\treturn config, err\n\t\t}\n\t}\n\treturn config, err\n}", "func GetConfig() Config {\n\tport, ok := os.LookupEnv(\"PORT\")\n\tif !ok {\n\t\tport = \"8080\"\n\t}\n\n\tenv, ok := os.LookupEnv(\"ENV\")\n\tif !ok {\n\t\tenv = \"development\"\n\t}\n\n\tpgHost, ok := os.LookupEnv(\"PG_HOST\")\n\tif !ok {\n\t\tpgHost = \"localhost\"\n\t}\n\n\tpgPort, ok := os.LookupEnv(\"PG_PORT\")\n\tif !ok {\n\t\tpgPort = \"5432\"\n\t}\n\n\tpgUser, ok := os.LookupEnv(\"PG_USER\")\n\tif !ok {\n\t\tpgUser = \"postgres\"\n\t}\n\n\tpgPassword, ok := os.LookupEnv(\"PG_PASSWORD\")\n\tif !ok {\n\t\tpgPassword = \"\"\n\t}\n\n\tpgDBName, ok := os.LookupEnv(\"PG_DB_NAME\")\n\tif !ok {\n\t\tpgDBName = \"ginexamples\"\n\t}\n\n\tlogFile, ok := os.LookupEnv(\"LOGFILE\")\n\tif !ok {\n\t\tlogFile = \"\"\n\t}\n\n\treturn Config{\n\t\tPort: port,\n\t\tEnv: env,\n\t\tPGHost: pgHost,\n\t\tPGPort: pgPort,\n\t\tPGUser: pgUser,\n\t\tPGPassword: pgPassword,\n\t\tPGDBName: pgDBName,\n\t\tLogFile: logFile,\n\t}\n}", "func getConfig() (Config, error) {\n\tvar configPath string\n\tvar err error\n\n\tif !configRead {\n\t\tconfigPath, err = getConfigPath()\n\t\tif err != nil {\n\t\t\treturn Config{}, err\n\t\t}\n\t\tconfig, err = parseConfig(configPath)\n\t\tif err != nil {\n\t\t\treturn Config{}, err\n\t\t}\n\t\tconfigRead = true\n\t}\n\n\treturn config, nil\n}", "func GetConfig(key string) string {\n\tconfig := make(map[string]string)\n\tb, err := ioutil.ReadFile(\"config.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tjson.Unmarshal(b, &config)\n\treturn config[key]\n}", "func (rm *ResourceManager) GetConfig(name string) *interface{} {\n\tif i, ok := rm.configuration[name]; ok {\n\t\treturn &i\n\t}\n\treturn nil\n}", "func getConfig(filename string) Config {\n\tvar conf Config\n\tif _, err := toml.DecodeFile(filename, &conf); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Set the defaults\n\tfor _, output := range conf.Outputs {\n\t\toutput.Topic = conf.Mqtt.BaseTopic + output.Topic\n\t\tfor _, key := range output.Keys {\n\t\t\tif key.Name == \"\" {\n\t\t\t\tkey.Name = conf.DefaultKey\n\t\t\t}\n\t\t\tif key.UnitName == \"\" {\n\t\t\t\tkey.UnitName = conf.DefaultUnitKey\n\t\t\t}\n\t\t}\n\t}\n\treturn conf\n}", "func getConfig(c *gin.Context) {\n\tc.HTML(http.StatusOK, \"config_ui.html\", gin.H{\n\t\t\"config\": biConfig,\n\t})\n}", "func GetConfig() Config {\n\treturn cfg\n}", "func getConfig(configFileName string, configPointer interface{}) error {\r\n\tif fileExists(configFileName) { //Get existing configuration from configFileName\r\n\t\tb, err := ioutil.ReadFile(configFileName)\r\n\t\tif err != nil {\r\n\t\t\treturn errors.WithStack(err)\r\n\t\t}\r\n\r\n\t\terr = json.Unmarshal(b, configPointer)\r\n\t\tif err != nil {\r\n\t\t\t//fmt.Println(\"Failed to unmarshal configuration file\")\r\n\t\t\treturn errors.WithStack(err)\r\n\t\t}\r\n\r\n\t\treturn nil\r\n\t}\r\n\r\n\t//If configFileName doesn't exist, create a new config file\r\n\tb, err := json.MarshalIndent(configPointer, \"\", \" \")\r\n\tif err != nil {\r\n\t\t//fmt.Println(\"Failed to marshal configuration file\")\r\n\t\treturn errors.WithStack(err)\r\n\t}\r\n\r\n\terr = ioutil.WriteFile(configFileName, b, 0644)\r\n\tif err != nil {\r\n\t\t//fmt.Println(\"Failed to write configuration file\")\r\n\t\treturn errors.WithStack(err)\r\n\t}\r\n\r\n\treturn errors.New(\"Configuration file not set\")\r\n}" ]
[ "0.5595617", "0.55334187", "0.55258375", "0.5509629", "0.5492174", "0.54913056", "0.5481108", "0.5445968", "0.54088974", "0.53772765", "0.5319755", "0.5253507", "0.5245969", "0.5245487", "0.5240613", "0.522218", "0.5200091", "0.520003", "0.51966673", "0.5176976", "0.51648146", "0.5161643", "0.51595664", "0.51576674", "0.5156844", "0.51515514", "0.5142542", "0.51382786", "0.5122623", "0.5121728", "0.5118902", "0.51183575", "0.5113999", "0.51115537", "0.5109747", "0.510082", "0.50886303", "0.50878024", "0.5057569", "0.5056976", "0.50549823", "0.50535953", "0.5051532", "0.5050053", "0.50448585", "0.50434124", "0.5035839", "0.5035067", "0.5033942", "0.50336814", "0.50318897", "0.5029541", "0.5022644", "0.5013639", "0.5013568", "0.50131804", "0.5008003", "0.49967122", "0.49906662", "0.49830148", "0.49779916", "0.49771395", "0.49561882", "0.49557394", "0.4951337", "0.4950067", "0.49491987", "0.49423146", "0.4924836", "0.49198624", "0.49182624", "0.4917293", "0.49080154", "0.4898309", "0.48974055", "0.48974055", "0.48911768", "0.4888696", "0.48800442", "0.4879944", "0.48791608", "0.48789874", "0.4877421", "0.48756948", "0.4872039", "0.48704287", "0.48696694", "0.48692694", "0.48686647", "0.48614076", "0.4860744", "0.48589122", "0.48543647", "0.48537153", "0.48518372", "0.48489326", "0.48418036", "0.48396", "0.4836377", "0.48345575" ]
0.776008
0
multidimensional slices and arrays are currently not supported
func MyMultiSliceFunc(nums [][][]int) { fmt.Println(nums) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func main() {\n\ta := make([]int, 5)\n\tprintSlice(\"a\", a)\n\n\tb := make([]int, 0, 7)\n\tprintSlice(\"b\", b)\n\n\tc := b[:2]\n\tprintSlice(\"c\", c)\n\n\td := c[2:5]\n\tprintSlice(\"d\", d)\n\n\t//Slices can be composed into multi-dimensional data structures. The\n\t//length of the inner slices can vary, unlike with multi-dimensional\n\t//arrays.\n\ttwoD := make([][]int, 3)\n\tfor i := 0; i < 3; i++ {\n\t\tinnerLen := i + 1\n\t\ttwoD[i] = make([]int, innerLen)\n\t\tfor j := 0; j < innerLen; j++ {\n\t\t\ttwoD[i][j] = i + j\n\t\t}\n\t}\n\tfmt.Println(\"2d: \", twoD)\n}", "func (t *Dense) slice(start, end int) {\n\tswitch t.t.Kind() {\n\tcase reflect.Bool:\n\t\tdata := t.bools()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Int:\n\t\tdata := t.ints()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Int8:\n\t\tdata := t.int8s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Int16:\n\t\tdata := t.int16s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Int32:\n\t\tdata := t.int32s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Int64:\n\t\tdata := t.int64s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Uint:\n\t\tdata := t.uints()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Uint8:\n\t\tdata := t.uint8s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Uint16:\n\t\tdata := t.uint16s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Uint32:\n\t\tdata := t.uint32s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Uint64:\n\t\tdata := t.uint64s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Uintptr:\n\t\tdata := t.uintptrs()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Float32:\n\t\tdata := t.float32s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Float64:\n\t\tdata := t.float64s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Complex64:\n\t\tdata := t.complex64s()[start:end]\n\t\tt.fromSlice(data)\n\tcase reflect.Complex128:\n\t\tdata := t.complex128s()[start:end]\n\t\tt.fromSlice(data)\n\n\tcase reflect.String:\n\t\tdata := t.strings()[start:end]\n\t\tt.fromSlice(data)\n\n\tcase reflect.UnsafePointer:\n\t\tdata := t.unsafePointers()[start:end]\n\t\tt.fromSlice(data)\n\tdefault:\n\t\tv := reflect.ValueOf(t.v)\n\t\tv = v.Slice(start, end)\n\t\tt.fromSlice(v.Interface())\n\t}\n}", "func (s *slice) slice(start, stop int, elemsize uintptr) slice {\n\tif start >= s.cap_ || start < 0 || stop > s.cap_ || stop < 0 {\n\t\tpanic(\"cuda4/safe: slice index out of bounds\")\n\t}\n\tif start > stop {\n\t\tpanic(\"cuda4/safe: inverted slice range\")\n\t}\n\treturn slice{cu.DevicePtr(uintptr(s.ptr_) + uintptr(start)*elemsize), stop - start, s.cap_ - start}\n}", "func Slice(slice interface{}) {\n\tswitch p := slice.(type) {\n\tcase []bool:\n\t\tBools(p)\n\tcase []uint8:\n\t\tUint8s(p)\n\tcase []uint16:\n\t\tUint16s(p)\n\tcase []uint32:\n\t\tUint32s(p)\n\tcase []uint64:\n\t\tUint64s(p)\n\tcase []int8:\n\t\tInt8s(p)\n\tcase []int16:\n\t\tInt16s(p)\n\tcase []int32:\n\t\tInt32s(p)\n\tcase []int64:\n\t\tInt64s(p)\n\tcase []float32:\n\t\tFloat32s(p)\n\tcase []float64:\n\t\tFloat64s(p)\n\tcase []complex64:\n\t\tComplex64s(p)\n\tcase []complex128:\n\t\tComplex128s(p)\n\tcase []uint:\n\t\tUints(p)\n\tcase []int:\n\t\tInts(p)\n\tcase []uintptr:\n\t\tUintptrs(p)\n\tcase []string:\n\t\tStrings(p)\n\tcase Interface:\n\t\tFlip(p)\n\tdefault:\n\t\trv := reflectValueOf(slice)\n\t\tswap := reflectSwapper(slice)\n\t\tFlip(reflectSlice{rv, swap})\n\t}\n}", "func slice1() {\n\tx := []float64{324234.23423, 232423.2342, 23423.2432, 23423.234, 23423.5556, 435634563.45634563456, 34564356.3456456}\n\n\t// this will check the type for the variable with \"%T\"\n\tfmt.Printf(\"%T \\n\", x)\n\n\t// this will start frm index value 2nd and show all the value prior to 4th place (excluding 4th place)\n\tfmt.Println(\"slicing the slice... by getting the values from index 2 to 4\", x[2:4])\n\n\t// printing the length of the slice, Slice is dynamic in memory allocation\n\tfmt.Println(len(x))\n\n}", "func (self *T) Slice() []float32 {\n\treturn []float32{\n\t\tself[0][0], self[0][1],\n\t\tself[1][0], self[1][1],\n\t}\n}", "func TestArraySection(t *testing.T) {\n\tarr3 := [...]int{1, 3, 4, 5}\n\tarr3_sec := arr3[3:]\n\t//arr4_sec := arr3[-1:] //不支持负数索引\n\tt.Log(arr3_sec)\n}", "func (items Float64Slice) SubSlice(i, j int) Interface { return items[i:j] }", "func (arr *Array) Slice(i, j int) *Array {\n\tvar elems []*Term\n\tvar hashs []int\n\tif j == -1 {\n\t\telems = arr.elems[i:]\n\t\thashs = arr.hashs[i:]\n\t} else {\n\t\telems = arr.elems[i:j]\n\t\thashs = arr.hashs[i:j]\n\t}\n\t// If arr is ground, the slice is, too.\n\t// If it's not, the slice could still be.\n\tgr := arr.ground || termSliceIsGround(elems)\n\n\ts := &Array{elems: elems, hashs: hashs, ground: gr}\n\ts.rehash()\n\treturn s\n}", "func slicesTest() {\n\tarr := [...]string{\"a\", \"b\", \"c\"}\n\ts1 := arr[1:3] // holds arr[1], arr[2]\n\tfmt.Printf(\"length, capacity of slice = %d,%d\\n\", len(s1), cap(s1))\n\ts1[0] = \"new\" //slices change the underlying array\n\tfmt.Println(arr[1])\n\n\ts2 := []int{1, 2, 3} //slice literal, creates underlying array\n\tfmt.Println(s2)\n}", "func (o Op) IsSlice3() bool", "func (*Base) Slice(p ASTPass, node *ast.Slice, ctx Context) {\n\tp.Visit(p, &node.Target, ctx)\n\tp.Fodder(p, &node.LeftBracketFodder, ctx)\n\tif node.BeginIndex != nil {\n\t\tp.Visit(p, &node.BeginIndex, ctx)\n\t}\n\tp.Fodder(p, &node.EndColonFodder, ctx)\n\tif node.EndIndex != nil {\n\t\tp.Visit(p, &node.EndIndex, ctx)\n\t}\n\tp.Fodder(p, &node.StepColonFodder, ctx)\n\tif node.Step != nil {\n\t\tp.Visit(p, &node.Step, ctx)\n\t}\n\tp.Fodder(p, &node.RightBracketFodder, ctx)\n}", "func (p PageGroup) Slice(in any) (any, error) {\n\tswitch items := in.(type) {\n\tcase PageGroup:\n\t\treturn items, nil\n\tcase []any:\n\t\tgroups := make(PagesGroup, len(items))\n\t\tfor i, v := range items {\n\t\t\tg, ok := v.(PageGroup)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"type %T is not a PageGroup\", v)\n\t\t\t}\n\t\t\tgroups[i] = g\n\t\t}\n\t\treturn groups, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid slice type %T\", items)\n\t}\n}", "func (m *Matrix) Slice() []float64 {\n\treturn nil\n}", "func (t *Dense) Slice(slices ...Slice) (retVal Tensor, err error) {\n\tvar newAP *AP\n\tvar ndStart, ndEnd int\n\n\tif newAP, ndStart, ndEnd, err = t.AP.S(t.len(), slices...); err != nil {\n\t\treturn\n\t}\n\n\tview := new(Dense)\n\tview.t = t.t\n\tview.viewOf = t\n\tview.AP = newAP\n\tview.hdr = new(reflect.SliceHeader)\n\tview.data = t.data\n\tview.hdr.Data = t.hdr.Data\n\tview.hdr.Len = t.hdr.Len\n\tview.hdr.Cap = t.hdr.Cap\n\tview.slice(ndStart, ndEnd)\n\n\tif t.IsMasked() {\n\t\tview.mask = t.mask[ndStart:ndEnd]\n\t}\n\treturn view, err\n}", "func (items IntSlice) SubSlice(i, j int) Interface { return items[i:j] }", "func Slice(vc *Config) *Config {\n\n\treturn NewConfig(\n\t\t[]interface{}{},\n\t\tfunc (req http.Request, param string) (status *http.Status, _ interface{}) {\n\n\t\t\tpanic(\"validation.Array(): THIS CODE SHOULD BE UNREACHABLE\")\n\n\t\t\treturn status, param\n\t\t},\n\t\tfunc (req http.Request, param interface{}) (status *http.Status, _ interface{}) {\n\n\t\t\ta, ok := param.([]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn req.Respond(400, ERR_NOT_ARRAY), nil\n\t\t\t}\n\n\t\t\tfor x, item := range a {\n\n\t\t\t\tstatus, value := vc.BodyFunction(req, item)\n\t\t\t\tif status != nil {\n\t\t\t\t\treturn status, nil\n\t\t\t\t}\n\n\t\t\t\ta[x] = value\n\t\t\t}\n\n\t\t\treturn status, a\n\t\t},\n\t)\n}", "func (x *Lazy) Slice(p, q int, ar AnyValue) {\n\n\toar := reflect.ValueOf(ar)\n\tvar ii = 0\n\tk := oar.Len()\n\tfor i := p; i < q && k >= 0; i++ {\n\t\tvar v reflect.Value\n\t\tif _, ok := x.omap[i]; ok {\n\t\t\tv = x.omap[i]\n\t\t} else {\n\t\t\tvar vv = []reflect.Value{x.iar.Index(i)}\n\t\t\tfor j := 0; j < len(x.fns); j++ {\n\t\t\t\tvv = x.fns[j].Call(vv)\n\t\t\t}\n\t\t\tv = vv[0]\n\t\t\tx.omap[p] = v //setting value in v\n\t\t}\n\t\toar.Index(ii).Set(v)\n\t\tii++\n\t\tk--\n\t}\n}", "func (vp *baseVectorParty) Slice(startRow, numRows int) common.SlicedVector {\n\tsize := vp.length - startRow\n\tif size < 0 {\n\t\tsize = 0\n\t}\n\tif size > numRows {\n\t\tsize = numRows\n\t}\n\tvector := common.SlicedVector{\n\t\tValues: make([]interface{}, size),\n\t\tCounts: make([]int, size),\n\t}\n\tfor i := 0; i < size; i++ {\n\t\tvector.Values[i] = vp.getDataValueFn(startRow + i).ConvertToHumanReadable(vp.dataType)\n\t\tvector.Counts[i] = i + 1\n\t}\n\n\treturn vector\n}", "func (self *T) Slice() []float64 {\n\treturn []float64{self[0], self[1]}\n}", "func (v View) Slice() []bool {\n\t// TODO: This forces an alloc, as an alternative a slice could be taken\n\t// as input that can be (re)used by the client. Are there use cases\n\t// where this would actually make sense?\n\tresult := make([]bool, v.Len())\n\tfor i, j := range v.index {\n\t\tresult[i] = v.data[j]\n\t}\n\treturn result\n}", "func main(){\n\tnumslice:=[]int{1,2,3,4,5}\n\tnumslice2 := numslice[0:4] //4 is not the index but the total no. of elements\n\tfmt.Println(numslice2)\n\t// 5 is considered as 4 as the total no. of elements are 5(index from 0 to 4)\n\tfmt.Println(\"numslice2[1]=\",numslice2[1])\n\tfmt.Println(\"numslice3[:2]=\",numslice[:2]) //Starting from 0 to 1 (till 2 u want and not include 2)\n\tfmt.Println(\"numslice4[2:]=\",numslice[2:]) //After 2 all you want (include 2)\n\n\tnumslice3:=make([]int,5,10) //make a slice whose elements are not known where 5 is the size and 10 is the till what it can extend\n\tfmt.Println(numslice3) // prints the full array, no need of for loop\n\tcopy(numslice3,numslice) //copy of elements of numslice to numslice 3\n\tfmt.Println(numslice3[2])\n\tnumslice3=append(numslice3,0,-1) //adding two elements 0 and -1 in numslice 3 position after index4 and size 5\n\tfmt.Println(numslice3)\n\tfmt.Println(numslice3[6])\n}", "func (s *f64) Slice(start, end int) Floating {\n\tstart = s.BufferIndex(0, start)\n\tend = s.BufferIndex(0, end)\n\treturn &f64{\n\t\tchannels: s.channels,\n\t\tbuffer: s.buffer[start:end],\n\t}\n}", "func MkSlice(args ...interface{}) []interface{} {\n\treturn args\n}", "func SliceTest() {\n\tvar a []int\n\tappSlice(a, 1)\n\n}", "func main() {\n\n\t//We might have points between which we want to calculate distance, in that case we can use struct\n\n\tv1 := Vertex1{2,3}\n\tv2 := Vertex1{6,6}\n\n\n\tans := calculateDistance(v1,v2)\n\tfmt.Printf(\"The distance between the 2 points is %f \\n\",ans)\n\n\n\tpointerToV1 := &v1\n\n\tfmt.Println(pointerToV1)\n\tpointerToV1.Y = 23\n\tfmt.Println(*pointerToV1)\n\tfmt.Println(pointerToV1)\n\n\tarray := [6]int{1,2,3,4,5,6}\n\t//for i:=0;i<6;i++ {\n\t//\tfmt.Println(array[i])\n\t//}\n\tfmt.Println(array)\n\n\ts := array[4:5]\n\t//for i:=0;i<len(s);i++ {\n\t//\tfmt.Println(s[i])\n\t//}\n\tfmt.Println(s)\n\tfmt.Println(cap(s),\" \",len(s))\n\n\tfmt.Println(&s[0])\n\tfmt.Println(&array[1])\n\n\tvar s1 []int\n\tfmt.Println(cap(s1),\" \",len(s1))\n\n\ta := make([]int,5,10)\n\tfmt.Println(cap(a),len(a))\n\tb := a[3:5]\n\tfmt.Println(cap(b),len(b))\n\n\n\t// Understanding slices of slices\n\t\tboard := [][]string {\n\t\t\t[]string{\"_\",\"_\",\"_\"},\n\t\t\t[]string{\"_\",\"_\",\"_\"},\n\t\t\t[]string{\"_\",\"_\",\"_\"},\n\t\t}\n\t\tfor i:= range board{\n\t\t\tfor j:= range board[0] {\n\t\t\t\tfmt.Print(board[i][j]+\" \")\n\t\t\t}\n\t\t\tfmt.Println()\n\t\t}\n\n\t\tarr := []int {1,2,3,4,5}\n\t\tfor i,j := range arr {\n\t\t\tfmt.Println(i,j)\n\t\t}\n\n\tvar s3 []int\n\tfmt.Println(s3)\n\ts3 = append(s3,0,2,2)\n\tfmt.Println(s3)\n\n\tvar arr3 = [8]int {6,5,4,3,2,1,0,-1}\n\ts5 := arr3[1:6]\n\tincreaseByOne(s5)\n\tfmt.Println(s5)\n\tfmt.Println(arr3)\n}", "func Array(){\n\t/* local variable definition */\n\tvar angka [5] int32//array\n\tangka[0] = 2\n\tangka[1] = 5\n\tfmt.Println(angka)\n\tvar arr = [] float32{1,2,3,4}//slice\n\tfmt.Println(arr)\n\tfmt.Println(arr[0])\n\tfmt.Println(angka[0])\n\t//len adalah fungsi menghitung panjang array\n\tfor j := 0; j < len(arr); j++ {\n\t\tfmt.Printf(\"Element[%d] = %f\\n\", j, arr[j] )\n\t }\n\n\t// multidimension array\n\tvar nomor [5][2] int32\n\tnomor[0][0] = 10\n\tnomor[0][1] = 11\n\tfmt.Println(nomor[0][0])\n\tfmt.Println(nomor[0][1])\n\n\ta := [3][4] int{ \n\t\t{0, 1, 2, 3} , /* initializers for row indexed by 0 */\n\t\t{4, 5, 6, 7} , /* initializers for row indexed by 1 */\n\t\t{8, 9, 10, 11}} /* initializers for row indexed by 2 */\n\t\n\tfmt.Println(a)\n\tparam := [10]int {1,2,3,4,5,6,7,8,9,10}\n\tmyFunction1(param)\n\tparam2 := []int {1,2,3}\n\tmyFunction2(param2)\n}", "func brokenSlicedArray(names [4]string) {\n\n\t//The following code will be invalid because we're slicing a array from position 1 to 2 which means that we will get only 1 index from the array and we will assign value to the Index 1 which will be out of range for the array.\n\tfmt.Println(\"/////////////////////////////////////// Index out of range with recover ///////////////////////////////////////\")\n\tfmt.Println(names)\n\n\tslicedNamesOne := names[0:2]\n\n\tfmt.Println(slicedNamesOne)\n\n\t// Correct will be // slicedNamesTwo := names[0:2]\n\t// this will 'panic' must recover\n\tslicedNamesTwo := names[1:2]\n\n\t// The program is going to 'panic' and enter the if statement.\n\tif r := recover(); r != nil {\n\t\tslicedNamesTwo[1] = \"XXX Nicholas XXX\"\n\t}\n\n\tfmt.Println(slicedNamesTwo)\n\tfmt.Println(names)\n\n\tfmt.Println(\"///////////////////////////////////////\")\n}", "func SliceMethodZero() {\n\tfmt.Println(\"Dilimler\")\n\n\t// Slices\n\tslicesScores := []int{1, 4, 293, 4, 9}\n\tfmt.Println(slicesScores)\n\n\t// Slices Make ile uzunluğu (dilmin boyutu) 10 olan dilim oluşturulur.\n\tslicesScoresMake := make([]int, 10)\n\tfmt.Println(slicesScoresMake)\n\n\t// Uzunluğu 0, Kapasitesi 10 olan bir dilim oluşturmu oluruz.\n\tslicesScoresMakeLength := make([]int, 0, 10)\n\tfmt.Println(slicesScoresMakeLength)\n\n\tslicesScoresMakeExOne := make([]int, 1, 10)\n\tslicesScoresMakeExOne[0] = 9033\n\tfmt.Println(slicesScoresMakeExOne)\n\n\tslicesScoresMakeExTwo := make([]int, 0, 10)\n\tslicesScoresMakeExTwo = append(slicesScoresMakeExTwo, 5)\n\tfmt.Println(slicesScoresMakeExTwo)\n\tslicesScoresMakeExTwo = slicesScoresMakeExTwo[0:8]\n\tslicesScoresMakeExTwo[7] = 9033\n\tfmt.Println(slicesScoresMakeExTwo)\n\n}", "func main() {\n\ts := []int{2, 3, 5, 7, 11, 13}\n\tprintSlice(s)\n\n\tb := s[:0]\n\tprintSlice(b)\n\n\tc := s[:4]\n\tprintSlice(c)\n\n\td := s[2:]\n\tprintSlice(d)\n}", "func (r *ARM64Registers) Slice(floatingPoint bool) ([]proc.Register, error) {\n\tout := make([]proc.Register, 0, len(r.Regs)+len(r.FloatRegisters)+2)\n\tfor i, v := range r.Regs {\n\t\tout = proc.AppendUint64Register(out, fmt.Sprintf(\"X%d\", i), v)\n\t}\n\tout = proc.AppendUint64Register(out, \"SP\", r.Sp)\n\tout = proc.AppendUint64Register(out, \"PC\", r.Pc)\n\tif floatingPoint {\n\t\tfor i := range r.FloatRegisters {\n\t\t\tvar buf bytes.Buffer\n\t\t\tbinary.Write(&buf, binary.LittleEndian, r.FloatRegisters[i].Low)\n\t\t\tbinary.Write(&buf, binary.LittleEndian, r.FloatRegisters[i].High)\n\t\t\tout = proc.AppendBytesRegister(out, fmt.Sprintf(\"V%d\", i), buf.Bytes())\n\t\t}\n\t\tout = proc.AppendUint64Register(out, \"Fpcr\", uint64(r.Fpcr))\n\t\tout = proc.AppendUint64Register(out, \"Fpsr\", uint64(r.Fpsr))\n\t}\n\treturn out, nil\n}", "func sliceInfo(name string, s interface{}) {\n\tswitch v := s.(type) {\n\tcase [][]int:\n\t\tfmt.Printf(\"[%s] %p len=%d cap=%d %v\\n\", name, v, len(v), cap(v), v)\n\tcase []int:\n\t\tfmt.Printf(\"[%s] %p len=%d cap=%d %v\\n\", name, v, len(v), cap(v), v)\n\t}\n}", "func Slice(d Dense, start, end int) (Dense, error) {\n\tif end-start > d.len {\n\t\treturn Dense{}, fmt.Errorf(\"slicing bitmap of len %d up to %d\", d.len, end-start)\n\t}\n\tif start < 0 {\n\t\treturn Dense{}, fmt.Errorf(\"slicing bitmap with negative start: %d\", start)\n\t}\n\tif end < start {\n\t\treturn Dense{}, fmt.Errorf(\"slicing bitmap to negative length: %d\", end-start)\n\t}\n\n\tr := Dense{}\n\tfor ; start%byteSize != 0; start++ {\n\t\tr.AppendBit(d.Get(start))\n\t}\n\tj := start / byteSize\n\ttmp := NewDense(d.bits[j:j+BytesFor(end-start)], end-start)\n\tr.Append(tmp)\n\treturn r, nil\n}", "func (s SamplesC64) Slice(start, end int) Samples {\n\treturn s[start:end]\n}", "func (bm ByteMap) Slice(includeKeys map[string]bool) ByteMap {\n\tresult, _ := bm.doSplit(false, includeKeys)\n\treturn result\n}", "func subSlice(out, a, b []float64)", "func (n NoOp) Slice(start, end int) PrimitiveOp {\n\treturn NoOp{}\n}", "func (seq *Sequence) Slice() (s []interface{}) {\n\ts = make([]interface{}, len(seq.Nodes))\n\tfor i, n := range seq.Nodes {\n\t\ts[i] = n.Data()\n\t}\n\treturn\n}", "func Slice(t *Tensor) interface{} {\n\tlength := int(DimProduct(t.Dims))\n\tsliceHeader := reflect.SliceHeader{\n\t\tData: uintptr(unsafe.Pointer(&t.Buffer[0])),\n\t\tCap: length,\n\t\tLen: length,\n\t}\n\tval := reflect.NewAt(DtypeToSliceType[t.Dtype], unsafe.Pointer(&sliceHeader)).Elem()\n\treturn val.Interface()\n}", "func (v *array) InterfaceSlice() []interface{} {\n\ts := v.slice\n\tis := make([]interface{}, len(s))\n\tfor i := range s {\n\t\tis[i] = s[i]\n\t}\n\treturn is\n}", "func PathArrayToFloat64Array2SliceSlice(val *[][][2]float64) sql.Scanner {\n\treturn pathArrayToFloat64Array2SliceSlice{val: val}\n}", "func programe02() {\n\tx := []int{42, 43, 44, 45, 46, 47, 48, 49, 50, 51}\n\tfmt.Println(x)\n\n\ty := append(x[:2], x[5:]...) // the same underlying array stores the value of the new slice\n\n\tfmt.Println(x)\n\tfmt.Println(y)\n}", "func (ps PlanSlice) Slice() []string {\n\ts := []string{}\n\tfor _, p := range ps {\n\t\ts = append(s, p.Name)\n\t}\n\treturn s\n}", "func (c StringArrayCollection) Slice(keys ...int) Collection {\n\tvar d = make([]string, len(c.value))\n\tcopy(d, c.value)\n\tif len(keys) == 1 {\n\t\treturn StringArrayCollection{\n\t\t\tvalue: d[keys[0]:],\n\t\t}\n\t} else {\n\t\treturn StringArrayCollection{\n\t\t\tvalue: d[keys[0] : keys[0]+keys[1]],\n\t\t}\n\t}\n}", "func Array(slice []interface{}, buf []byte) ([]byte, error) {\n\tvar comma bool\n\tbuf = append(buf, '[')\n\tvar err error\n\tfor i := 0; i < len(slice); i++ {\n\t\tif comma {\n\t\t\tbuf = append(buf, ',')\n\t\t}\n\t\tcomma = true\n\t\tbuf, err = Value(slice[i], buf)\n\t\tif err != nil {\n\t\t\treturn buf, err\n\t\t}\n\t}\n\treturn append(buf, ']'), nil\n}", "func divSlice(out, a, b []float64)", "func mulSlice(out, a, b []float64)", "func createSliceByShorthand() {\n\tprintln(\"----Shorthand----\")\n\tstudent := []string{}\n\tstudents := [][]string{}\n\n\t// Index out of range\n\t// student[0] = \"Yuta\"\n\t// Don't have space yet, need use append\n\tstudent = append(student, \"Yuta\")\n\tfmt.Println(student)\n\tfmt.Println(students)\n\tfmt.Println(student == nil)\n\tprintln(\"----Shorthand----\")\n}", "func decodeSlice() {\n\ttype NameDoc struct {\n\t\tName string `jpath:\"name\"`\n\t}\n\n\tdoc := []byte(decodeSliceDoc)\n\tvar sliceMap []map[string]interface{}\n\tjson.Unmarshal(doc, &sliceMap)\n\n\tvar byValue []NameDoc\n\tms.DecodeSlicePath(sliceMap, &byValue)\n\n\tfmt.Printf(\"DecodeSlicePath : ByValue : %+v\\n\", byValue)\n\n\tvar byAddr []*NameDoc\n\tms.DecodeSlicePath(sliceMap, &byAddr)\n\n\tfmt.Printf(\"DecodeSlicePath : ByAddr : %+v\\n\", byAddr)\n}", "func varSlicesTest() {\n\tvar s1 = make([]string, 10) //creates slice+array of length 10\n\tvar s2 = make([]string, 5, 15) //creates slice of length 10, capacity (length of array) of 15\n\ts1 = append(s1, \"new\") //append(slice,element) adds elements to slice and expand underlying array if necessary\n\tfmt.Println(s1)\n\tfmt.Println(s2)\n}", "func ExampleDense_Slice_oneDimension() {\n\tvar T Tensor\n\tT = New(WithBacking(Range(Float64, 0, 9)))\n\tfmt.Printf(\"T:\\n%v\\n\\n\", T)\n\n\tT, _ = T.Slice(makeRS(0, 5))\n\tfmt.Printf(\"T[0:5]:\\n%v\\n\", T)\n\n\t// Output:\n\t// T:\n\t// [0 1 2 3 ... 5 6 7 8]\n\t//\n\t// T[0:5]:\n\t// [0 1 2 3 4]\n\n}", "func slices() {\n\t// A slice can be declared in a very similar way to an array, we just don't\n\t// bother to set the length.\n\tstringSlice := []string{\"foo\", \"bar\", \"baz\"}\n\n\t// What do you think the contents and length of the slice will be?\n\tfmt.Printf(\"string slice: %v\\n\", stringSlice)\n\tfmt.Printf(\"string slice length: %d\\n\", len(stringSlice))\n}", "func main() {\n\tGoArray() // Array is rarely used in Go. Slices are used instead. Array is an underlying function for Slices.\n\tGoSlice()\n}", "func arraysAndSlices() {\n\tvar arr [5]int\n\t// For creating a slice of an array, the memory needs to be allocated beforehand, this is what the\n\t// `make` method does\n\tvar sliceOfArr []int = make([]int, 5 /*,10 --> the upper limit of what the slice can hold*/)\n\n\tarr[0] = 1\n\tsliceOfArr[0] = 1 // This would keeled over if not initialised with `make` is\n\n\tfmt.Println(len(sliceOfArr)) // will return 5\n\tfmt.Println(cap(sliceOfArr)) // will return 10 which is the max capacity\n}", "func appendSlices() {\n\tslice1 := []int{1,2,3}\n\tslice2 := append(slice1, 4, 5)\n\tfmt.Println(slice1, slice2)\n}", "func IsSliceOrArray(data interface{}) bool {\n\treturn IsSlice(data) || IsArray(data)\n}", "func tcUnsafeSlice(n *ir.BinaryExpr) *ir.BinaryExpr {\n\tif !types.AllowsGoVersion(curpkg(), 1, 17) {\n\t\tbase.ErrorfVers(\"go1.17\", \"unsafe.Slice\")\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\n\tn.X = Expr(n.X)\n\tn.Y = Expr(n.Y)\n\tif n.X.Type() == nil || n.Y.Type() == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tt := n.X.Type()\n\tif !t.IsPtr() {\n\t\tbase.Errorf(\"first argument to unsafe.Slice must be pointer; have %L\", t)\n\t} else if t.Elem().NotInHeap() {\n\t\t// TODO(mdempsky): This can be relaxed, but should only affect the\n\t\t// Go runtime itself. End users should only see //go:notinheap\n\t\t// types due to incomplete C structs in cgo, and those types don't\n\t\t// have a meaningful size anyway.\n\t\tbase.Errorf(\"unsafe.Slice of incomplete (or unallocatable) type not allowed\")\n\t}\n\n\tif !checkunsafeslice(&n.Y) {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tn.SetType(types.NewSlice(t.Elem()))\n\treturn n\n}", "func (w *Window) Slice() []float64 {\n\tw.mx.RLock()\n\t// 4 Times faster than \"defer Unlock\"\n\tret := w.base[w.start : w.start+w.Len]\n\tw.mx.RUnlock()\n\treturn ret\n}", "func ModifySlice(sliceptr interface{}, eq func(i, j int) bool) {\n\trvp := reflect.ValueOf(sliceptr)\n\tif rvp.Type().Kind() != reflect.Ptr {\n\t\tpanic(badTypeError{rvp.Type()})\n\t}\n\trv := rvp.Elem()\n\tif rv.Type().Kind() != reflect.Slice {\n\t\tpanic(badTypeError{rvp.Type()})\n\t}\n\n\tlength := rv.Len()\n\tdst := 0\n\tfor i := 1; i < length; i++ {\n\t\tif eq(dst, i) {\n\t\t\tcontinue\n\t\t}\n\t\tdst++\n\t\t// slice[dst] = slice[i]\n\t\trv.Index(dst).Set(rv.Index(i))\n\t}\n\n\tend := dst + 1\n\tvar zero reflect.Value\n\tif end < length {\n\t\tzero = reflect.Zero(rv.Type().Elem())\n\t}\n\n\t// for i := range slice[end:] {\n\t// size[i] = 0/nil/{}\n\t// }\n\tfor i := end; i < length; i++ {\n\t\t// slice[i] = 0/nil/{}\n\t\trv.Index(i).Set(zero)\n\t}\n\n\t// slice = slice[:end]\n\tif end < length {\n\t\trv.SetLen(end)\n\t}\n}", "func Slice(slicePtr interface{}, title, id, class string, min, max, step float64, valid Validator) (jquery.JQuery, error) {\n\tt, v := reflect.TypeOf(slicePtr), reflect.ValueOf(slicePtr)\n\tif t.Kind() != reflect.Ptr {\n\t\treturn jq(), fmt.Errorf(\"slicePtr should be a pointer, got %s instead\", t.Kind())\n\t}\n\tif t.Elem().Kind() != reflect.Slice {\n\t\treturn jq(), fmt.Errorf(\"slicePtr should be a pointer to slice, got pointer to %s instead\", t.Elem().Kind())\n\t}\n\tsliceType, sliceValue := t.Elem(), v.Elem()\n\tsliceElemType := sliceType.Elem()\n\n\tj := jq(\"<list>\").AddClass(ClassPrefix + \"-slice\").AddClass(class)\n\tj.SetAttr(\"title\", title).SetAttr(\"id\", id)\n\n\tvar populate func() error\n\tpopulate = func() error {\n\t\tnewLi := func(j, ji jquery.JQuery) jquery.JQuery {\n\t\t\tli := jq(\"<li>\").Append(ji)\n\t\t\tdelBtn := jq(\"<button>\").SetText(SliceDelText)\n\t\t\tdelBtn.Call(jquery.CLICK, func() {\n\t\t\t\ti := li.Call(\"index\").Get().Int()\n\t\t\t\tli.Remove()\n\t\t\t\tbegin := sliceValue.Slice(0, i)\n\t\t\t\tend := sliceValue.Slice(i+1, sliceValue.Len())\n\t\t\t\tsliceValue.Set(reflect.AppendSlice(begin, end))\n\t\t\t\t// Just delete and redo everything to work with non-pointers when the slice resizes\n\t\t\t\tj.Empty()\n\t\t\t\te := populate()\n\t\t\t\tif e != nil {\n\t\t\t\t\tpanic(e)\n\t\t\t\t}\n\t\t\t})\n\t\t\tli.Append(delBtn)\n\t\t\treturn li\n\t\t}\n\n\t\tfor i := 0; i < sliceValue.Len(); i++ {\n\t\t\telem := sliceValue.Index(i)\n\t\t\tji, e := convert(elem, \"\", \"\", \"\", \"\", min, max, step, valid)\n\t\t\tif e != nil {\n\t\t\t\treturn fmt.Errorf(\"converting slice element %d (%s): %s\", i, elem.Type().Kind(), e)\n\t\t\t}\n\t\t\tj.Append(newLi(j, ji))\n\t\t}\n\t\taddBtn := jq(\"<button>\").SetText(SliceAddText)\n\t\taddBtn.Call(jquery.CLICK, func() {\n\t\t\tif sliceElemType.Kind() == reflect.Ptr {\n\t\t\t\tnewElem := reflect.New(sliceElemType.Elem())\n\t\t\t\tsliceValue.Set(reflect.Append(sliceValue, newElem))\n\t\t\t} else {\n\t\t\t\tnewElem := reflect.New(sliceElemType)\n\t\t\t\tsliceValue.Set(reflect.Append(sliceValue, newElem.Elem()))\n\t\t\t}\n\t\t\t// Just delete and redo everything to work with non-pointers when the slice resizes\n\t\t\tj.Empty()\n\t\t\te := populate()\n\t\t\tif e != nil {\n\t\t\t\tpanic(e)\n\t\t\t}\n\t\t})\n\t\tj.Append(addBtn)\n\t\treturn nil\n\t}\n\n\te := populate()\n\tif e != nil {\n\t\treturn jq(), e\n\t}\n\n\treturn j, nil\n}", "func (b *Blob) Slice(start, end int, contenttype string) *Blob {\n\tnewBlobObject := b.Call(\"slice\", start, end, contenttype)\n\treturn &Blob{\n\t\tObject: newBlobObject,\n\t}\n}", "func main() {\n\n\tarray1 := [3]int{1, 2, 3}\n\tvar slice1 []int\n\n\t//o método append não é possível para array (já possui 3 posicoes definidas), pois o primeiro argumento precisa ser um slice (vazio)\n\t//exemplo: array1 = append(array1, 4, 5, 6)\n\n\tslice1 = append(slice1, 4, 5, 6) //cria um novo \"array\" e adiciona os elementos\n\tfmt.Println(array1, slice1, len(slice1), len(array1)) \n\n\tslice2 := make([]int, 2) //outro slice vazio, com duas posicoes\n\tcopy(slice2, slice1) //copia para o slice2, os elementos do slice 1 / não é possível passar um array, somente slice para ambos\n\tfmt.Println(slice2) //Porém como o tamanho do 2 é menor que o 1, ele copia somente os dois primeiros elementos\n\n}", "func (b BoardFeature) Slice() []string {\n\treturn _BoardFeature.slice(uint64(b))\n}", "func getSlice(p position) []byte {\n\ts, i := getChunkLocation(p.chunk)\n\tbufStart := int(i)*ChunkSize + p.chunkPos\n\tbufLen := ChunkSize - p.chunkPos\n\treturn slabs[s].memory[bufStart : bufStart+bufLen]\n}", "func Array(dest interface{}) interface {\n\tsql.Scanner\n\tdriver.Valuer\n} {\n\tswitch dest := dest.(type) {\n\tcase *[]GraphId:\n\t\treturn (*graphIdArray)(dest)\n\tcase []GraphId:\n\t\treturn (*graphIdArray)(&dest)\n\n\tcase *[]BasicVertex:\n\t\treturn (*basicVertexArray)(dest)\n\n\tcase *[]BasicEdge:\n\t\treturn (*basicEdgeArray)(dest)\n\t}\n\n\treturn elementArray{dest}\n}", "func sliceHandle(docs interface{}, opType operator.OpType) error {\n\t// []interface{}{UserType{}...}\n\tif h, ok := docs.([]interface{}); ok {\n\t\tfor _, v := range h {\n\t\t\tif err := do(v); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\t// []UserType{}\n\ts := reflect.ValueOf(docs)\n\tfor i := 0; i < s.Len(); i++ {\n\t\tif err := do(s.Index(i).Interface()); err != nil {\n\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func addSlice(out, a, b []float64)", "func slicePanic() {\n\tn := []int{1, 2, 3}\n\tfmt.Println(n[4])\n\tfmt.Println(\"Executia in slice s-a terminat cu succes\")\n}", "func makeSlice(offset dvid.Point3d, size dvid.Point2d) []byte {\n\tnumBytes := size[0] * size[1] * 8\n\tslice := make([]byte, numBytes, numBytes)\n\ti := 0\n\tmodz := offset[2] % int32(len(zdata))\n\tfor y := int32(0); y < size[1]; y++ {\n\t\tsy := y + offset[1]\n\t\tmody := sy % int32(len(ydata))\n\t\tsx := offset[0]\n\t\tfor x := int32(0); x < size[0]; x++ {\n\t\t\tmodx := sx % int32(len(xdata))\n\t\t\tbinary.BigEndian.PutUint64(slice[i:i+8], xdata[modx]+ydata[mody]+zdata[modz])\n\t\t\ti += 8\n\t\t\tsx++\n\t\t}\n\t}\n\treturn slice\n}", "func (r *QueryResult) Slice(ctx context.Context, slicePtr interface{}) error {\n\tif r.Rows == nil {\n\t\treturn errors.New(\"result rows is nil\")\n\t}\n\n\tdefer r.Close()\n\n\tslicePtrType := reflect.TypeOf(slicePtr)\n\n\t// make sure this is a pointer\n\tif err := verifyPtr(slicePtrType); err != nil {\n\t\treturn err\n\t}\n\n\tsliceType := slicePtrType.Elem()\n\n\t// make sure this is a slice\n\tif err := verifySlice(sliceType); err != nil {\n\t\treturn err\n\t}\n\n\tsliceElemType := sliceType.Elem()\n\toutSliceVal := reflect.ValueOf(slicePtr).Elem()\n\n\t// determine what type of elements the slice holds\n\tvar baseType reflect.Type\n\tif sliceElemType.Kind() == reflect.Ptr {\n\t\tbaseType = sliceElemType.Elem()\n\t} else {\n\t\tbaseType = sliceElemType\n\t}\n\n\tif scanAsStruct(sliceElemType) {\n\t\treturn scanStructs(r.Rows, baseType, sliceElemType, outSliceVal)\n\t}\n\n\treturn scanNatives(r.Rows, baseType, sliceElemType, outSliceVal)\n}", "func (hhm *HHM) Slice(start, end int) *HHM {\n\thmm := hhm.HMM.Slice(start, end)\n\n\tmeta := hhm.Meta\n\tmeta.Neff = 0\n\tfor _, node := range hmm.Nodes {\n\t\tmeta.Neff += node.NeffM\n\t}\n\tmeta.Neff /= seq.Prob(len(hmm.Nodes))\n\n\treturn &HHM{\n\t\tMeta: meta,\n\t\tSecondary: hhm.Secondary.Slice(start, end),\n\t\tMSA: hhm.MSA.Slice(start, end),\n\t\tHMM: hmm,\n\t}\n}", "func (c StringArrayCollection) Chunk(num int) MultiDimensionalArrayCollection {\n\tvar d MultiDimensionalArrayCollection\n\td.length = c.length/num + 1\n\td.value = make([][]interface{}, d.length)\n\n\tcount := 0\n\tfor i := 1; i <= c.length; i++ {\n\t\tswitch {\n\t\tcase i == c.length:\n\t\t\tif i%num == 0 {\n\t\t\t\td.value[count] = c.All()[i-num:]\n\t\t\t\td.value = d.value[:d.length-1]\n\t\t\t} else {\n\t\t\t\td.value[count] = c.All()[i-i%num:]\n\t\t\t}\n\t\tcase i%num != 0 || i < num:\n\t\t\tcontinue\n\t\tdefault:\n\t\t\td.value[count] = c.All()[i-num : i]\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn d\n}", "func WorkWithSlices() {\n\tvar team []structs.TeamMember\n\n\ttm1 := structs.TeamMember{\"Jack\", 23, \"200501\", 5.6}\n\n\ttm2 := structs.TeamMember{\n\t\tName: \"Jones\",\n\t\tAge: 24,\n\t\tEmpId: \"200502\",\n\t\tRating: 6.5,\n\t}\n\n\tvar tm3 structs.TeamMember\n\ttm3.Name = \"Mary\"\n\ttm3.Age = 25\n\ttm3.EmpId = \"20050\"\n\ttm3.Rating = 6.7\n\n\tteam = append(team, tm1, tm2, tm3)\n\n\tteam2 := team //MAKES A COPY OF THE REFERENCE AND ALL VALUES BY REFERENCE\n\n\t//team2 = append(team2, tm3)\n\n\t//MODIFY EXISTING VALUE AND SEE\n\tteam2[0].Age = 100\n\n\tfmt.Println(\"========SLICES============\")\n\tfmt.Println(\"team = \", team)\n\tfmt.Println(\"team2 = \", team2)\n\n\tfor i, v := range team2 {\n\t\tfmt.Println(i, \".\", v)\n\t}\n\tfor _, v := range team2 {\n\t\tfmt.Println(v)\n\t}\n}", "func IsSlice(v interface{}) bool {\n\treturn reflect.ValueOf(v).Kind() == reflect.Slice\n}", "func makeSlice(in interface{}) []interface{} {\n\treturn in.([]interface{})\n}", "func main() {\n\n\tdata := []string {\"a\", \"b\", \"c\", \"d\", \"e\"}\n\tfmt.Println(data[0])\n\tfmt.Println(data[0:3])\n\tfmt.Println(data[3:4])\n\tfmt.Println(data[:])\n\n\t/* will print\n\ta\n\t[a b c]\n\t[d]\n\t[a b c d e]\n\t */\n\t\n}", "func (ns Nodes) Slice(pos ...int) Nodes {\n\tplen := len(pos)\n\tl := len(ns)\n\tif plen == 1 && pos[0] < l-1 && pos[0] > 0 {\n\t\treturn ns[pos[0]:]\n\t} else if len(pos) == 2 && pos[0] < l-1 && pos[1] < l-1 && pos[0] > 0 && pos[1] > 0 {\n\t\treturn ns[pos[0]:pos[1]]\n\t}\n\treturn Nodes{}\n}", "func SliceEach(slice interface{}, iterFn IterationFunc, preserve ...reflect.Kind) error {\n\tif iterFn == nil {\n\t\treturn nil\n\t}\n\n\tslice = ResolveValue(slice)\n\n\tif inT := reflect.TypeOf(slice); inT != nil {\n\t\tswitch inT.Kind() {\n\t\tcase reflect.Slice, reflect.Array:\n\t\t\tsliceV := reflect.ValueOf(slice)\n\n\t\t\tfor i := 0; i < sliceV.Len(); i++ {\n\t\t\t\tif err := iterFn(i, sliceV.Index(i).Interface()); err != nil {\n\t\t\t\t\tif err == Stop {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Map:\n\t\t\tfor _, p := range preserve {\n\t\t\t\tif p == reflect.Map {\n\t\t\t\t\tif err := iterFn(0, slice); err != nil {\n\t\t\t\t\t\tif err == Stop {\n\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmapV := reflect.ValueOf(slice)\n\n\t\t\tfor i, key := range mapV.MapKeys() {\n\t\t\t\tif valueV := mapV.MapIndex(key); valueV.IsValid() && valueV.CanInterface() {\n\t\t\t\t\tif err := iterFn(i, valueV.Interface()); err != nil {\n\t\t\t\t\t\tif err == Stop {\n\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn err\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\tcase reflect.Struct:\n\t\t\tfor _, p := range preserve {\n\t\t\t\tif p == reflect.Struct {\n\t\t\t\t\tif err := iterFn(0, slice); err != nil {\n\t\t\t\t\t\tif err == Stop {\n\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tstructV := reflect.ValueOf(slice)\n\n\t\t\tfor i := 0; i < structV.Type().NumField(); i++ {\n\t\t\t\tfield := structV.Type().Field(i)\n\n\t\t\t\tif field.Name != `` {\n\t\t\t\t\tif valueV := structV.Field(i); valueV.IsValid() && valueV.CanInterface() {\n\t\t\t\t\t\tif err := iterFn(i, valueV.Interface()); err != nil {\n\t\t\t\t\t\t\tif err == Stop {\n\t\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn err\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\n\t\tcase reflect.Chan:\n\t\t\tsliceC := reflect.ValueOf(slice)\n\t\t\tvar i int\n\n\t\t\tfor {\n\t\t\t\tif item, ok := sliceC.Recv(); ok {\n\t\t\t\t\tif item.IsValid() && item.CanInterface() {\n\t\t\t\t\t\tif err := iterFn(i, item.Interface()); err != nil {\n\t\t\t\t\t\t\tif err == Stop {\n\t\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ti++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if i >= EachChanMaxItems {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\tdefault:\n\t\t\tif err := iterFn(0, slice); err != nil {\n\t\t\t\tif err == Stop {\n\t\t\t\t\treturn nil\n\t\t\t\t} else {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (iobuf *buf) slice(free, base, bound uint) *Slice {\n\tatomic.AddInt32(&iobuf.refcount, 1)\n\treturn &Slice{iobuf: iobuf, free: free, base: base, Contents: iobuf.Contents[base:bound]}\n}", "func main() {\n\t// method 1\n\tx := []int{1, 2, 3}\n\ty := append(x, 4, 5, 6)\n\n\tfmt.Println(x)\n\tfmt.Println(y)\n\n\t// method 2\n\tz := x[0:3]\n\tfmt.Println(z)\n\ta := append(z, 4, 5, 6)\n\tfmt.Println(a)\n\n\t//method 3\n\tb := make([]int, 5)\n\tc := append(b, 1, 2, 3)\n\tfmt.Println(c)\n\n\t// method 4\n\tslice1 := []int{1, 2, 3, 4}\n\tfmt.Println(slice1)\n\tslice2 := make([]int, 4)\n\tcopy(slice2, slice1)\n\tfmt.Println(slice2)\n\n}", "func (s *Int64) Slice() []int64 {\n\tres := make([]int64, 0, len(s.m))\n\n\tfor val := range s.m {\n\t\tres = append(res, val)\n\t}\n\treturn res\n}", "func (p *SliceOfMap) Slice(indices ...int) ISlice {\n\tif p == nil || len(*p) == 0 {\n\t\treturn NewSliceOfMapV()\n\t}\n\n\t// Handle index manipulation\n\ti, j, err := absIndices(len(*p), indices...)\n\tif err != nil {\n\t\treturn NewSliceOfMapV()\n\t}\n\n\tslice := SliceOfMap((*p)[i:j])\n\treturn &slice\n}", "func (r *AMD64Registers) Slice(floatingPoint bool) ([]proc.Register, error) {\n\tvar regs = []struct {\n\t\tk string\n\t\tv uint64\n\t}{\n\t\t{\"Rip\", r.Regs.Rip},\n\t\t{\"Rsp\", r.Regs.Rsp},\n\t\t{\"Rax\", r.Regs.Rax},\n\t\t{\"Rbx\", r.Regs.Rbx},\n\t\t{\"Rcx\", r.Regs.Rcx},\n\t\t{\"Rdx\", r.Regs.Rdx},\n\t\t{\"Rdi\", r.Regs.Rdi},\n\t\t{\"Rsi\", r.Regs.Rsi},\n\t\t{\"Rbp\", r.Regs.Rbp},\n\t\t{\"R8\", r.Regs.R8},\n\t\t{\"R9\", r.Regs.R9},\n\t\t{\"R10\", r.Regs.R10},\n\t\t{\"R11\", r.Regs.R11},\n\t\t{\"R12\", r.Regs.R12},\n\t\t{\"R13\", r.Regs.R13},\n\t\t{\"R14\", r.Regs.R14},\n\t\t{\"R15\", r.Regs.R15},\n\t\t{\"Orig_rax\", r.Regs.Orig_rax},\n\t\t{\"Cs\", r.Regs.Cs},\n\t\t{\"Rflags\", r.Regs.Eflags},\n\t\t{\"Ss\", r.Regs.Ss},\n\t\t{\"Fs_base\", r.Regs.Fs_base},\n\t\t{\"Gs_base\", r.Regs.Gs_base},\n\t\t{\"Ds\", r.Regs.Ds},\n\t\t{\"Es\", r.Regs.Es},\n\t\t{\"Fs\", r.Regs.Fs},\n\t\t{\"Gs\", r.Regs.Gs},\n\t}\n\tout := make([]proc.Register, 0, len(regs)+len(r.Fpregs))\n\tfor _, reg := range regs {\n\t\tout = proc.AppendUint64Register(out, reg.k, reg.v)\n\t}\n\tvar floatLoadError error\n\tif floatingPoint {\n\t\tif r.loadFpRegs != nil {\n\t\t\tfloatLoadError = r.loadFpRegs(r)\n\t\t\tr.loadFpRegs = nil\n\t\t}\n\t\tout = append(out, r.Fpregs...)\n\t}\n\treturn out, floatLoadError\n}", "func checkSlice(name string, attr string, data interface{}) {\n\tif reflect.ValueOf(data).Kind() != reflect.Slice {\n\t\tpanic(fmt.Errorf(\"MakeMesh error: Mesh '%s' '%s' data is not a slice\", name, attr))\n\t}\n}", "func main() {\n\n\tvar numbers = make([]int, 3, 5)\n\tprintSlice(numbers)\n\t// Before initial the slice, it is nil\n\tvar nums []int\n\tif nums == nil {\n\t\tfmt.Println(\"切片是空的\")\n\t}\n\tprintSlice(nums)\n\tnums = make([]int, 3, 10)\n\tif nums == nil {\n\t\tfmt.Println(\"切片是空的\")\n\t}\n\n\t//cut the slice with [lower-bound:upper-bound]\n\tnumbers2 := []int{0, 1, 2, 3, 4, 5, 6, 7, 8}\n\tprintSlice(numbers2)\n\tfmt.Println(\"numbers2 ==\", numbers2)\n\tfmt.Println(\"numbers2[1:4] ==\", numbers2[1:4]) //print m to n (not include n)\n\tfmt.Println(\"numbers2[:3] ==\", numbers2[:3]) // print form 0 to n (not include n)\n\tfmt.Println(\"numbers2[4:] ==\", numbers2[4:]) // print form n to end (not include n)\n\n\t//add new element to slice with append\n\tnumbers2 = append(numbers2, 9, 10, 11)\n\tprintSlice(numbers2)\n\n\t//copy the slice\n\tnumbersCopy := make([]int, len(numbers2), (cap(numbers2))*2)\n\tcopy(numbersCopy, numbers2)\n\tprintSlice(numbers2)\n\tprintSlice(numbersCopy)\n\n}", "func Slice(scope *Scope, input tf.Output, begin tf.Output, size tf.Output) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Slice\",\n\t\tInput: []tf.Input{\n\t\t\tinput, begin, size,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func IsSlice(v interface{}) bool {\n\tif reflect.ValueOf(v).Kind() == reflect.Slice {\n\t\treturn true\n\t}\n\treturn false\n}", "func (s *Uint64) Slice() []uint64 {\n\tres := make([]uint64, 0, len(s.m))\n\n\tfor val := range s.m {\n\t\tres = append(res, val)\n\t}\n\treturn res\n}", "func (s *ArraySchema) Generic(datum interface{}) (interface{}, error) {\n\tif a, ok := datum.([]interface{}); ok {\n\t\tif s.Items.Type() == String {\n\t\t\tslice := make([]string, len(a))\n\t\t\tfor i, v := range a {\n\t\t\t\tif val, err := s.Items.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tslice[i] = val.(string)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn slice, nil\n\t\t} else if s.Items.Type() == Double {\n\t\t\tslice := make([]float64, len(a))\n\t\t\tfor i, v := range a {\n\t\t\t\tif val, err := s.Items.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tslice[i] = val.(float64)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn slice, nil\n\t\t} else if s.Items.Type() == Float {\n\t\t\tslice := make([]float32, len(a))\n\t\t\tfor i, v := range a {\n\t\t\t\tif val, err := s.Items.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tslice[i] = val.(float32)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn slice, nil\n\t\t} else if s.Items.Type() == Long {\n\t\t\tslice := make([]int64, len(a))\n\t\t\tfor i, v := range a {\n\t\t\t\tif val, err := s.Items.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tslice[i] = val.(int64)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn slice, nil\n\t\t} else if s.Items.Type() == Int {\n\t\t\tslice := make([]int32, len(a))\n\t\t\tfor i, v := range a {\n\t\t\t\tif val, err := s.Items.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tslice[i] = val.(int32)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn slice, nil\n\t\t} else if s.Items.Type() == Boolean {\n\t\t\tslice := make([]bool, len(a))\n\t\t\tfor i, v := range a {\n\t\t\t\tif val, err := s.Items.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tslice[i] = val.(bool)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn slice, nil\n\t\t} else if s.Items.Type() == Bytes || s.Items.Type() == Fixed {\n\t\t\tslice := make([][]byte, len(a))\n\t\t\tfor i, v := range a {\n\t\t\t\tif val, err := s.Items.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tslice[i] = val.([]byte)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn slice, nil\n\t\t} else {\n\t\t\tslice := make([]interface{}, len(a))\n\t\t\tfor i, v := range a {\n\t\t\t\tif val, err := s.Items.Generic(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t} else {\n\t\t\t\t\tslice[i] = val\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn slice, nil\n\t\t}\n\n\t} else {\n\t\treturn nil, fmt.Errorf(\"don't know how to convert datum to an array value: %v\", datum)\n\t}\n}", "func walkSlice(n *ir.SliceExpr, init *ir.Nodes) ir.Node {\n\tn.X = walkExpr(n.X, init)\n\tn.Low = walkExpr(n.Low, init)\n\tif n.Low != nil && ir.IsZero(n.Low) {\n\t\t// Reduce x[0:j] to x[:j] and x[0:j:k] to x[:j:k].\n\t\tn.Low = nil\n\t}\n\tn.High = walkExpr(n.High, init)\n\tn.Max = walkExpr(n.Max, init)\n\n\tif n.Op().IsSlice3() {\n\t\tif n.Max != nil && n.Max.Op() == ir.OCAP && ir.SameSafeExpr(n.X, n.Max.(*ir.UnaryExpr).X) {\n\t\t\t// Reduce x[i:j:cap(x)] to x[i:j].\n\t\t\tif n.Op() == ir.OSLICE3 {\n\t\t\t\tn.SetOp(ir.OSLICE)\n\t\t\t} else {\n\t\t\t\tn.SetOp(ir.OSLICEARR)\n\t\t\t}\n\t\t\treturn reduceSlice(n)\n\t\t}\n\t\treturn n\n\t}\n\treturn reduceSlice(n)\n}", "func (n Nodes) Slice() []*Node", "func SliceAny(i interface{}) []interface{} {\n\treturn Interfaces(i)\n}", "func transformSlice(n *ir.SliceExpr) {\n\tassert(n.Type() != nil && n.Typecheck() == 1)\n\tl := n.X\n\tif l.Type().IsArray() {\n\t\taddr := typecheck.NodAddr(n.X)\n\t\taddr.SetImplicit(true)\n\t\ttyped(types.NewPtr(n.X.Type()), addr)\n\t\tn.X = addr\n\t\tl = addr\n\t}\n\tt := l.Type()\n\tif t.IsString() {\n\t\tn.SetOp(ir.OSLICESTR)\n\t} else if t.IsPtr() && t.Elem().IsArray() {\n\t\tif n.Op().IsSlice3() {\n\t\t\tn.SetOp(ir.OSLICE3ARR)\n\t\t} else {\n\t\t\tn.SetOp(ir.OSLICEARR)\n\t\t}\n\t}\n}", "func breadSliceCreator() {\n\n\t// one way to create slice\n\tslice1 := make([]int, 2)\n\n\tslice1[0] = 1\n\n\tslice1[1] = 2\n\n\tfmt.Println(\"lenght and capacity of the slice1...\", len(slice1), cap(slice1))\n\n\tslice1 = append(slice1, 3)\n\n\tfmt.Println(\"lenght and capacity of the slice1...\", len(slice1), cap(slice1))\n\n\tslice1 = append(slice1, 4)\n\n\tfmt.Println(\"lenght and capacity of the slice1...\", len(slice1), cap(slice1))\n\n\tslice1 = append(slice1, 55)\n\n\tfmt.Println(\"lenght and capacity of the slice1...\", len(slice1), cap(slice1))\n\n\tfmt.Println(slice1)\n\n\t// adding above slice1 to slice of slice2\n\n\tslice2 := make([][]int, 10)\n\n\tslice2[0] = slice1\n\n\tfmt.Println(\"Putting slice into slice\", slice2)\n\n}", "func (l *list) Slice(first int, last int) interface{} {\n\ttypeOf := reflect.TypeOf(l.t)\n\tsliceOf := reflect.SliceOf(typeOf)\n\tvar result = reflect.ValueOf(reflect.New(sliceOf).Interface()).Elem()\n\n\tfor _, v := range l.elements[first:last] {\n\t\tresult.Set(reflect.Append(result, reflect.ValueOf(v)))\n\t}\n\n\treturn result.Interface()\n}", "func flattenImageDeprecatedSlice(c *Client, i interface{}) []ImageDeprecated {\n\ta, ok := i.([]interface{})\n\tif !ok {\n\t\treturn []ImageDeprecated{}\n\t}\n\n\tif len(a) == 0 {\n\t\treturn []ImageDeprecated{}\n\t}\n\n\titems := make([]ImageDeprecated, 0, len(a))\n\tfor _, item := range a {\n\t\titems = append(items, *flattenImageDeprecated(c, item.(map[string]interface{})))\n\t}\n\n\treturn items\n}", "func addScaledSlice(y, x []float64, a float64)", "func flattenPrivateCloudHcxSlice(c *Client, i interface{}, res *PrivateCloud) []PrivateCloudHcx {\n\ta, ok := i.([]interface{})\n\tif !ok {\n\t\treturn []PrivateCloudHcx{}\n\t}\n\n\tif len(a) == 0 {\n\t\treturn []PrivateCloudHcx{}\n\t}\n\n\titems := make([]PrivateCloudHcx, 0, len(a))\n\tfor _, item := range a {\n\t\titems = append(items, *flattenPrivateCloudHcx(c, item.(map[string]interface{}), res))\n\t}\n\n\treturn items\n}", "func IsSlice(value interface{}) bool {\n\treturn kindOf(value) == reflect.Slice\n}", "func (s *VectorImplSlice) Slice(start, stop int) *VectorImplSlice {\n\tassertSliceOk(start, stop, s.stop-s.start)\n\treturn &VectorImplSlice{vector: s.vector, start: s.start + start, stop: s.start + stop}\n}" ]
[ "0.67055786", "0.66364324", "0.62440515", "0.61460614", "0.61310977", "0.6121645", "0.6115807", "0.6086621", "0.60235363", "0.5970817", "0.5903322", "0.5894619", "0.5876776", "0.58745736", "0.58611864", "0.58575004", "0.57885885", "0.57874656", "0.57834643", "0.57588685", "0.5738563", "0.57205355", "0.570593", "0.5703108", "0.5685934", "0.56731504", "0.566306", "0.5647746", "0.564088", "0.5625115", "0.5616244", "0.5616067", "0.56103694", "0.5606084", "0.5590836", "0.5569837", "0.5555539", "0.5548803", "0.5548763", "0.55402553", "0.55389565", "0.5527181", "0.5521711", "0.5521259", "0.5510828", "0.5494417", "0.5483402", "0.5482606", "0.5480927", "0.5443491", "0.5436849", "0.54358274", "0.5428377", "0.54082626", "0.5397719", "0.5392636", "0.5371865", "0.5370024", "0.53588885", "0.53328305", "0.53313994", "0.53294444", "0.5329361", "0.532701", "0.5326903", "0.53264105", "0.5323631", "0.5321433", "0.5314586", "0.5311988", "0.53058445", "0.529922", "0.5278414", "0.5277047", "0.5276067", "0.5270306", "0.5255373", "0.5255299", "0.5253347", "0.5252548", "0.5249439", "0.5243848", "0.52410734", "0.5240732", "0.523292", "0.522433", "0.5221724", "0.5220151", "0.5218518", "0.51999134", "0.5197751", "0.5197349", "0.51892465", "0.5188922", "0.5185664", "0.51842254", "0.5183301", "0.5180496", "0.51766384", "0.51731944" ]
0.6770064
0
NewMockProviders creates a new mock instance
func NewMockProviders(ctrl *gomock.Controller) *MockProviders { mock := &MockProviders{ctrl: ctrl} mock.recorder = &MockProvidersMockRecorder{mock} return mock }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewMock(middleware []Middleware) OrganizationService {\n\tvar svc OrganizationService = NewBasicOrganizationServiceServiceMock()\n\tfor _, m := range middleware {\n\t\tsvc = m(svc)\n\t}\n\treturn svc\n}", "func NewProviders() *Providers {\n\treturn &Providers{\n\t\tinternal: provider.Unknown,\n\t\tproviders: map[string]Provider{},\n\t}\n}", "func NewEventProviderMock(t NewEventProviderMockT) *EventProviderMock {\n\tmock := &EventProviderMock{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "func NewMockInterfaceProvider(managedInterfacesRegexp string, autoRefresh bool) (nt.InterfaceProvider,\n\tchan time.Time, error) {\n\tch := make(chan time.Time)\n\tip, err := nt.NewChanInterfaceProvider(ch, &MockInterfaceLister{}, managedInterfacesRegexp,\n\t\tautoRefresh)\n\treturn ip, ch, err\n}", "func NewMock(t *testing.T) *MockT { return &MockT{t: t} }", "func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}", "func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}", "func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}", "func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}", "func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}", "func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}", "func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}", "func NewMockProvider(ctrl *gomock.Controller) *MockProvider {\n\tmock := &MockProvider{ctrl: ctrl}\n\tmock.recorder = &MockProviderMockRecorder{mock}\n\treturn mock\n}", "func ProviderTest(initial Initial, observer invoker.Observer, settings Settings) (Configurator, func(), error) {\n\tc, e := NewMockConfigurator(initial, observer, settings)\n\treturn c, func() {}, e\n}", "func NewFakeProvider(t *testing.T) *FakeProvider {\n\tbuilder := chain.NewBuilder(t, address.Address{})\n\treturn &FakeProvider{\n\t\tBuilder: builder,\n\t\tt: t,\n\t\tactors: make(map[address.Address]*types.Actor)}\n}", "func GetProviders(w http.ResponseWriter, r *http.Request) {\n\tencoder := json.NewEncoder(w)\n\n\tencoder.Encode(mock.Providers)\n}", "func newTestFabricProviderSet(providers ...string) *FabricProviderSet {\n\tset := new(FabricProviderSet)\n\tfor i, p := range providers {\n\t\tset.Add(&FabricProvider{\n\t\t\tName: p,\n\t\t\tPriority: i,\n\t\t})\n\t}\n\n\treturn set\n}", "func New() *Mock {\n\treturn &Mock{\n\t\tm: mockMap{},\n\t\toldTransport: http.DefaultTransport,\n\t}\n}", "func New(cfg *Config,\n\tapiManager apimanager.Provider,\n\tlogger logger.Logger, registerer prometheus.Registerer) (Provider, error) {\n\tservice := &MockServer{\n\t\tcfg: cfg,\n\t\tregisterer: registerer,\n\t\tapiManager: apiManager,\n\t\tLogger: logger.NewLogger(\"httpMockServer\"),\n\t}\n\treturn service, nil\n}", "func (m *MockProviderManager) GetProviders(arg0 string) ([]*resource.ResourceProvider, error) {\n\tret := m.ctrl.Call(m, \"GetProviders\", arg0)\n\tret0, _ := ret[0].([]*resource.ResourceProvider)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func New() (*mock, error) {\n\treturn &mock{\n\t\tConfigService: ConfigService{},\n\t\tContainerService: ContainerService{},\n\t\tDistributionService: DistributionService{},\n\t\tImageService: ImageService{},\n\t\tNetworkService: NetworkService{},\n\t\tNodeService: NodeService{},\n\t\tPluginService: PluginService{},\n\t\tSecretService: SecretService{},\n\t\tServiceService: ServiceService{},\n\t\tSystemService: SystemService{},\n\t\tSwarmService: SwarmService{},\n\t\tVolumeService: VolumeService{},\n\t\tVersion: Version,\n\t}, nil\n}", "func MockedProvider(t *testing.T, c *config.Config, callback string) (*config.Config, goth.Provider) {\n\tconst (\n\t\ttestClientKey = \"provider-test-client-key\"\n\t\ttestSecret = \"provider-test-secret\"\n\t\ttestCallback = \"http://auth.exmaple.com/test/callback\"\n\t)\n\tmp := newMockProvider(t, callback)\n\tp := provider.Name(mp.Name())\n\tprovider.AddExternal(p)\n\tt.Cleanup(func() {\n\t\tdelete(provider.External, p)\n\t})\n\tif callback == \"\" {\n\t\tcallback = testCallback\n\t}\n\tc.Authorization.Providers[p] = config.Provider{\n\t\tClientKey: testClientKey,\n\t\tSecret: testSecret,\n\t\tCallbackURL: callback,\n\t}\n\treturn c, mp\n}", "func newInMemoryProviders(c *StreamingV1alpha1Client, namespace string) *inMemoryProviders {\n\treturn &inMemoryProviders{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "func (bil *baseInstanceList) newMockCloud() cloud.Cloud {\n\tc := cloud.NewMockGCE(nil)\n\n\t// insert hooks to lazy create a instance when needed\n\tc.MockInstances.GetHook = bil.newGAGetHook()\n\tc.MockBetaInstances.GetHook = bil.newBetaGetHook()\n\n\treturn c\n}", "func newFakeTracerProviderStore() *fakeTracerProviderStore {\n\texps := []sdktrace.SpanExporter{}\n\treturn &fakeTracerProviderStore{exps, nil, nil}\n}", "func NewMock(now time.Time) *Mock {\n\treturn &Mock{\n\t\tnow: now,\n\t\tmockTimers: &timerHeap{},\n\t}\n}", "func newMockSubscriber() mockSubscriber {\n\treturn mockSubscriber{}\n}", "func New() provider.Provider {\n\tp := newProvider()\n\n\treturn p\n}", "func initProviders(ko *koanf.Koanf, lo *logrus.Logger, metrics *metrics.Manager) []prvs.Provider {\n\tprovs := make([]prvs.Provider, 0)\n\n\t// Loop over all providers listed in config.\n\tfor _, name := range ko.MapKeys(\"providers\") {\n\t\tcfgKey := fmt.Sprintf(\"providers.%s\", name)\n\t\tprovType := ko.String(fmt.Sprintf(\"%s.type\", cfgKey))\n\n\t\tswitch provType {\n\t\tcase \"google_chat\":\n\t\t\tgchat, err := google_chat.NewGoogleChat(\n\t\t\t\tgoogle_chat.GoogleChatOpts{\n\t\t\t\t\tLog: lo,\n\t\t\t\t\tTimeout: ko.MustDuration(fmt.Sprintf(\"%s.timeout\", cfgKey)),\n\t\t\t\t\tMaxIdleConn: ko.MustInt(fmt.Sprintf(\"%s.max_idle_conns\", cfgKey)),\n\t\t\t\t\tProxyURL: ko.String(fmt.Sprintf(\"%s.proxy_url\", cfgKey)),\n\t\t\t\t\tEndpoint: ko.MustString(fmt.Sprintf(\"%s.endpoint\", cfgKey)),\n\t\t\t\t\tRoom: name,\n\t\t\t\t\tTemplate: ko.MustString(fmt.Sprintf(\"%s.template\", cfgKey)),\n\t\t\t\t\tThreadTTL: ko.MustDuration(fmt.Sprintf(\"%s.thread_ttl\", cfgKey)),\n\t\t\t\t\tMetrics: metrics,\n\t\t\t\t\tDryRun: ko.Bool(fmt.Sprintf(\"%s.dry_run\", cfgKey)),\n\t\t\t\t},\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\tlo.WithError(err).Fatal(\"error initialising google chat provider\")\n\t\t\t}\n\n\t\t\tlo.WithField(\"room\", gchat.Room()).Info(\"initialised provider\")\n\t\t\tprovs = append(provs, gchat)\n\t\t}\n\t}\n\n\tif len(provs) == 0 {\n\t\tlo.Fatal(\"no providers listed in config\")\n\t}\n\n\treturn provs\n}", "func NewMock() *Mock {\n\treturn &Mock{VolumesMock: &VolumesServiceMock{}}\n}", "func NewProvider() *ProviderConfig {\n\tproviderConfig := &ProviderConfig{\n\t\tAlibaba: make(map[string]*models.AlibabaCloudSpec),\n\t\tAnexia: make(map[string]*models.AnexiaCloudSpec),\n\t\tAws: make(map[string]*models.AWSCloudSpec),\n\t\tAzure: make(map[string]*models.AzureCloudSpec),\n\t\tDigitalocean: make(map[string]*models.DigitaloceanCloudSpec),\n\t\tFake: make(map[string]*models.FakeCloudSpec),\n\t\tGcp: make(map[string]*models.GCPCloudSpec),\n\t\tHetzner: make(map[string]*models.HetznerCloudSpec),\n\t\tKubevirt: make(map[string]*models.KubevirtCloudSpec),\n\t\tOpenstack: make(map[string]*models.OpenstackCloudSpec),\n\t\tPacket: make(map[string]*models.PacketCloudSpec),\n\t\tVsphere: make(map[string]*models.VSphereCloudSpec),\n\t}\n\n\tproviderConfig.Alibaba[\"Alibaba\"] = newAlibabaCloudSpec()\n\tproviderConfig.Anexia[\"Anexia\"] = newAnexiaCloudSpec()\n\tproviderConfig.Aws[\"Aws\"] = newAWSCloudSpec()\n\tproviderConfig.Azure[\"Azure\"] = newAzureCloudSpec()\n\tproviderConfig.Digitalocean[\"Digitalocean\"] = newDigitaloceanCloudSpec()\n\tproviderConfig.Fake[\"Fake\"] = newFakeCloudSpec()\n\tproviderConfig.Gcp[\"Gcp\"] = newGCPCloudSpec()\n\tproviderConfig.Hetzner[\"Hetzner\"] = newHetznerCloudSpec()\n\tproviderConfig.Kubevirt[\"Kubevirt\"] = newKubevirtCloudSpec()\n\tproviderConfig.Openstack[\"Openstack\"] = newOpenstackCloudSpec()\n\tproviderConfig.Packet[\"Packet\"] = newPacketCloudSpec()\n\tproviderConfig.Vsphere[\"Vsphere\"] = newVSphereCloudSpec()\n\n\treturn providerConfig\n}", "func New() confmap.Provider {\n\treturn &provider{}\n}", "func newMockNetworks() (*MockNetwork, *MockNetwork) {\n\tc := mockCon.NewConn()\n\treturn &MockNetwork{c.Client}, &MockNetwork{c.Server}\n}", "func NewMock() *Mock {\n\tc := &Mock{\n\t\tFakeIncoming: func() chan []byte {\n\t\t\treturn make(chan []byte, 2)\n\t\t},\n\t\tFakeName: func() string {\n\t\t\treturn \"TestClient\"\n\t\t},\n\t\tFakeGame: func() string {\n\t\t\treturn \"test\"\n\t\t},\n\t\tFakeClose: func() {\n\t\t\t// Do nothing\n\t\t},\n\t\tFakeStopTimer: func() {\n\t\t\t// Do nothing\n\t\t},\n\t\tFakeRoom: func() interfaces.Room {\n\t\t\treturn nil\n\t\t},\n\t\tFakeSetRoom: func(interfaces.Room) {\n\n\t\t},\n\t}\n\n\tc.FakeWritePump = func() {\n\t\tfor range c.Incoming() {\n\t\t\t// Do nothing\n\t\t}\n\t}\n\n\tc.FakeSetName = func(string) interfaces.Client {\n\t\treturn c\n\t}\n\treturn c\n}", "func NewProvider(t *testing.T) *Provider {\n\treturn &Provider{\n\t\tt: t,\n\t\tcounters: make(map[string]*Counter),\n\t\thistograms: make(map[string]*Histogram),\n\t\tgauges: make(map[string]*Gauge),\n\t\tcardCounters: make(map[string]*xmetrics.HLLCounter),\n\t}\n}", "func New() *Provider {\n\treturn &Provider{clients: make(map[string]ClientVersionProvider)}\n}", "func NewMockSupport() *MockSupport {\n\treturn &MockSupport{\n\t\tPublisher: NewBlockPublisher(),\n\t}\n}", "func NewMockHTTPProvider(ctrl *gomock.Controller) *MockHTTPProvider {\n\tmock := &MockHTTPProvider{ctrl: ctrl}\n\tmock.recorder = &MockHTTPProviderMockRecorder{mock}\n\treturn mock\n}", "func NewForge(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *Forge {\n\tmock := &Forge{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "func New(v interface{}) (provider.Provider, error) {\n\ts := Spec{}\n\treturn &s, ioutil.Intermarshal(v, &s)\n}", "func (m *MockNotifierProvider) New(arg0 upgraded.State, arg1 *cert.Info, arg2 config.Schema) upgraded.Notifier {\n\tret := m.ctrl.Call(m, \"New\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(upgraded.Notifier)\n\treturn ret0\n}", "func NewProvider(log logging.Logger) *Provider {\n\treturn &Provider{\n\t\tapi: &api{},\n\t\tlog: log,\n\t}\n}", "func NewProvider(params ...SDKContextParams) *Provider {\n\tctxProvider := Provider{}\n\tfor _, param := range params {\n\t\tparam(&ctxProvider)\n\t}\n\treturn &ctxProvider\n}", "func (m *MockWatcherConstructor) New(arg0 Machine, arg1 string, arg2 []string, arg3, arg4, arg5 string, arg6 time.Duration, arg7 map[string]interface{}) (interface{}, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"New\", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\n\tret0, _ := ret[0].(interface{})\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func NewSQLMockProvider() (*SQLMockProvider, sqlmock.Sqlmock) {\n\tprovider := SQLMockProvider{\n\t\tSQLProvider{\n\t\t\tname: \"sqlmock\",\n\n\t\t\tsqlUpgradesCreateTableStatements: sqlUpgradeCreateTableStatements,\n\t\t\tsqlUpgradesCreateTableIndexesStatements: sqlUpgradesCreateTableIndexesStatements,\n\n\t\t\tsqlGetPreferencesByUsername: fmt.Sprintf(\"SELECT second_factor_method FROM %s WHERE username=?\", userPreferencesTableName),\n\t\t\tsqlUpsertSecondFactorPreference: fmt.Sprintf(\"REPLACE INTO %s (username, second_factor_method) VALUES (?, ?)\", userPreferencesTableName),\n\n\t\t\tsqlTestIdentityVerificationTokenExistence: fmt.Sprintf(\"SELECT EXISTS (SELECT * FROM %s WHERE token=?)\", identityVerificationTokensTableName),\n\t\t\tsqlInsertIdentityVerificationToken: fmt.Sprintf(\"INSERT INTO %s (token) VALUES (?)\", identityVerificationTokensTableName),\n\t\t\tsqlDeleteIdentityVerificationToken: fmt.Sprintf(\"DELETE FROM %s WHERE token=?\", identityVerificationTokensTableName),\n\n\t\t\tsqlGetTOTPSecretByUsername: fmt.Sprintf(\"SELECT secret FROM %s WHERE username=?\", totpSecretsTableName),\n\t\t\tsqlUpsertTOTPSecret: fmt.Sprintf(\"REPLACE INTO %s (username, secret) VALUES (?, ?)\", totpSecretsTableName),\n\t\t\tsqlDeleteTOTPSecret: fmt.Sprintf(\"DELETE FROM %s WHERE username=?\", totpSecretsTableName),\n\n\t\t\tsqlGetU2FDeviceHandleByUsername: fmt.Sprintf(\"SELECT keyHandle, publicKey FROM %s WHERE username=?\", u2fDeviceHandlesTableName),\n\t\t\tsqlUpsertU2FDeviceHandle: fmt.Sprintf(\"REPLACE INTO %s (username, keyHandle, publicKey) VALUES (?, ?, ?)\", u2fDeviceHandlesTableName),\n\n\t\t\tsqlInsertAuthenticationLog: fmt.Sprintf(\"INSERT INTO %s (username, successful, time) VALUES (?, ?, ?)\", authenticationLogsTableName),\n\t\t\tsqlGetLatestAuthenticationLogs: fmt.Sprintf(\"SELECT successful, time FROM %s WHERE time>? AND username=? ORDER BY time DESC\", authenticationLogsTableName),\n\n\t\t\tsqlGetExistingTables: \"SELECT name FROM sqlite_master WHERE type='table'\",\n\n\t\t\tsqlConfigSetValue: fmt.Sprintf(\"REPLACE INTO %s (category, key_name, value) VALUES (?, ?, ?)\", configTableName),\n\t\t\tsqlConfigGetValue: fmt.Sprintf(\"SELECT value FROM %s WHERE category=? AND key_name=?\", configTableName),\n\t\t},\n\t}\n\n\tdb, mock, err := sqlmock.New()\n\n\tif err != nil {\n\t\tprovider.log.Fatalf(\"Unable to create SQL database: %s\", err)\n\t}\n\n\tprovider.db = db\n\n\t/*\n\t\tWe do initialize in the tests rather than in the new up.\n\t*/\n\n\treturn &provider, mock\n}", "func NewTestProvider() *TestProvider {\n\treturn &TestProvider{make(map[string]Client)}\n}", "func NewMockDefault() *Mock {\n\tmgr := new(Mock)\n\tvar pluginsMap = make(map[string]managerContracts.Plugin)\n\tvar cwPlugin = managerContracts.Plugin{\n\t\tHandler: cloudwatch.NewMockDefault(),\n\t}\n\tpluginsMap[CloudWatchId] = cwPlugin\n\n\tmgr.On(\"GetRegisteredPlugins\").Return(pluginsMap)\n\tmgr.On(\"Name\").Return(CloudWatchId)\n\tmgr.On(\"Execute\", mock.AnythingOfType(\"context.T\")).Return(nil)\n\tmgr.On(\"RequestStop\", mock.AnythingOfType(\"string\")).Return(nil)\n\tmgr.On(\"StopPlugin\", mock.AnythingOfType(\"string\"), mock.Anything).Return(nil)\n\tmgr.On(\"StartPlugin\", mock.AnythingOfType(\"string\"), mock.AnythingOfType(\"string\"), mock.AnythingOfType(\"string\"), mock.AnythingOfType(\"task.CancelFlag\")).Return(nil)\n\treturn mgr\n}", "func NewMockProviderContext() *MockProviderContext {\n\tcontext := MockProviderContext{\n\t\tconfig: NewMockConfig(),\n\t\tsigningManager: NewMockSigningManager(),\n\t\tcryptoSuite: &MockCryptoSuite{},\n\t}\n\treturn &context\n}", "func NewMockChannelProvider(ctx fab.Context) (*MockChannelProvider, error) {\n\tchannels := make(map[string]fab.Channel)\n\n\t// Create a mock client with the mock channel\n\tcp := MockChannelProvider{\n\t\tctx,\n\t\tchannels,\n\t}\n\treturn &cp, nil\n}", "func New(clientset *clusterinfo.OpenShift) (*Provider, error) {\n\treturn &Provider{\n\t\toc: clientset,\n\t}, nil\n}", "func NewForTesting() buckets.Provider {\n\treturn newWithOptions(option.WithoutAuthentication())\n}", "func newMockKvCapabilityVerifier(t mockConstructorTestingTnewMockKvCapabilityVerifier) *mockKvCapabilityVerifier {\n\tmock := &mockKvCapabilityVerifier{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "func newStatsProvider(\n\tcadvisor cadvisor.Interface,\n\tpodManager PodManager,\n\truntimeCache kubecontainer.RuntimeCache,\n\tcontainerStatsProvider containerStatsProvider,\n) *Provider {\n\treturn &Provider{\n\t\tcadvisor: cadvisor,\n\t\tpodManager: podManager,\n\t\truntimeCache: runtimeCache,\n\t\tcontainerStatsProvider: containerStatsProvider,\n\t}\n}", "func NewProvider(api *API, vin string, cache time.Duration) *Provider {\n\timpl := &Provider{\n\t\tstatusG: provider.Cached(func() (RechargeStatus, error) {\n\t\t\treturn api.RechargeStatus(vin)\n\t\t}, cache),\n\t}\n\treturn impl\n}", "func NewProvider(respG func() (Response, error), cache time.Duration) *Provider {\n\treturn &Provider{\n\t\tapiG: provider.NewCached(func() (interface{}, error) {\n\t\t\treturn respG()\n\t\t}, cache).InterfaceGetter(),\n\t}\n}", "func NewProvider(api *API, vin string, cache time.Duration) *Provider {\n\timpl := &Provider{\n\t\tchargerG: provider.Cached(func() (ChargerResponse, error) {\n\t\t\treturn api.Charger(vin)\n\t\t}, cache),\n\t\tstatusG: provider.Cached(func() (StatusResponse, error) {\n\t\t\treturn api.Status(vin)\n\t\t}, cache),\n\t\tclimateG: provider.Cached(func() (ClimaterResponse, error) {\n\t\t\treturn api.Climater(vin)\n\t\t}, cache),\n\t\tpositionG: provider.Cached(func() (PositionResponse, error) {\n\t\t\treturn api.Position(vin)\n\t\t}, cache),\n\t\taction: func(action, value string) error {\n\t\t\treturn api.Action(vin, action, value)\n\t\t},\n\t\trr: func() (RolesRights, error) {\n\t\t\treturn api.RolesRights(vin)\n\t\t},\n\t}\n\treturn impl\n}", "func NewProvider(typeName string, crypto domain.Crypto) *Provider {\n\treturn &Provider{\n\t\ttypeName: typeName,\n\t\tbqClients: map[string]*bigQueryClient{},\n\t\tiamClients: map[string]*iamClient{},\n\t\tcrypto: crypto,\n\t}\n}", "func New(cfg *config.Config) *HsmProvidersService {\n\n\treturn &HsmProvidersService{Client: client.New(\n\t\t*cfg,\n\t\tmetadata.ClientInfo{\n\t\t\tServiceName: ServiceName,\n\t\t\tEndpoint: *cfg.Endpoint,\n\t\t\tAPIVersion: pingaccess.SDKVersion,\n\t\t},\n\t)}\n}", "func newAuthorizationMocks(t *testing.T, resource, action string) (\n\tauthn.AuthenticationServiceClient, authz.AuthorizationServiceClient) {\n\tvar (\n\t\tctrl = gomock.NewController(t)\n\t\tmockAuthClient = authn.NewMockAuthenticationServiceClient(ctrl)\n\t\tmockAuthzClient = authz.NewMockAuthorizationServiceClient(ctrl)\n\t)\n\n\t// Mocking AuthN Calls\n\tmockAuthClient.EXPECT().Authenticate(gomock.Any(), gomock.Any()).DoAndReturn(\n\t\tfunc(_ context.Context, _ *authn.AuthenticateRequest) (*authn.AuthenticateResponse, error) {\n\t\t\treturn &authn.AuthenticateResponse{Subject: \"mock\", Teams: []string{}}, nil\n\t\t})\n\n\t// Mocking AuthZ Calls\n\tmockAuthzClient.EXPECT().ProjectsAuthorized(\n\t\tgomock.Any(),\n\t\t&authz.ProjectsAuthorizedReq{\n\t\t\tSubjects: []string{\"mock\"},\n\t\t\tResource: resource,\n\t\t\tAction: action,\n\t\t\tProjectsFilter: []string{},\n\t\t},\n\t).DoAndReturn(\n\t\tfunc(_ context.Context, _ *authz.ProjectsAuthorizedReq) (*authz.ProjectsAuthorizedResp, error) {\n\t\t\treturn &authz.ProjectsAuthorizedResp{Projects: []string{\"any\"}}, nil\n\t\t},\n\t)\n\n\treturn mockAuthClient, mockAuthzClient\n}", "func NewProvider() *Provider {\n\treturn &Provider{}\n}", "func (m *MockAddonProvidersService) AddonProvidersList(arg0 context.Context) ([]*scalingo.AddonProvider, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddonProvidersList\", arg0)\n\tret0, _ := ret[0].([]*scalingo.AddonProvider)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func Providers() []Provider {\n\tif MockProviders != nil {\n\t\treturn MockProviders\n\t}\n\tallProvidersMu.Lock()\n\tdefer allProvidersMu.Unlock()\n\treturn allProviders\n}", "func NewMock() Cache {\n\treturn &mock{}\n}", "func RegisterProviders(providerFuncs ...ProviderFunc) {\n\t_setupMux.Lock()\n\tdefer _setupMux.Unlock()\n\t_staticProviderFuncs = append(_staticProviderFuncs, providerFuncs...)\n}", "func NewProvider(expires time.Duration) *Provider {\n\treturn &Provider{list: list.New(), sessions: make(map[string]*list.Element, 0), databases: make([]Database, 0), Expires: expires}\n}", "func (m *MockProviderManager) CalculateNewProvider(arg0 string) (*resource.ResourceProvider, error) {\n\tret := m.ctrl.Call(m, \"CalculateNewProvider\", arg0)\n\tret0, _ := ret[0].(*resource.ResourceProvider)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func NewMockBootstrapperProvider(ctrl *gomock.Controller) *MockBootstrapperProvider {\n\tmock := &MockBootstrapperProvider{ctrl: ctrl}\n\tmock.recorder = &MockBootstrapperProviderMockRecorder{mock}\n\treturn mock\n}", "func NewMockReplacer(\n\tctx context.Context,\n\tregion string,\n\tprofile string) *Replacer {\n\n\tasgroup := newAsg(region, profile)\n\tdeploy := fsm.NewDeploy(\"start\")\n\tasgroup.Ec2Api = &mockEC2iface{}\n\tasgroup.AsgAPI = &mockASGiface{}\n\tasgroup.EcsAPI = &mockECSiface{}\n\treturn &Replacer{\n\t\tctx: ctx,\n\t\tasg: asgroup,\n\t\tdeploy: deploy,\n\t}\n}", "func New(config *Config) (*Provider, error) {\n\tif config.URL == \"\" {\n\t\tconfig.URL = fmt.Sprintf(\"http://%s\", config.ListenAddr)\n\t}\n\n\tif config.TOTP == \"\" {\n\t\tkey, err := totp.Generate(totp.GenerateOpts{\n\t\t\tIssuer: \"karmabot\",\n\t\t\tAccountName: \"slack\",\n\t\t})\n\n\t\tif err != nil {\n\t\t\tconfig.Log.Err(err).Fatal(\"an error occurred while generating a TOTP key\")\n\t\t} else {\n\t\t\tconfig.Log.KV(\"totpKey\", key.Secret()).Fatal(\"please use the following TOTP key\")\n\t\t}\n\t}\n\n\tprovider := &Provider{\n\t\tConfig: config,\n\t\tui: newUI(config),\n\t}\n\n\treturn provider, nil\n}", "func NewProvider() *Provider {\n\treturn &Provider{\n\t\tconfig: new(Config),\n\t\tmemoryDB: new(session.Dict),\n\t\texpiration: 0,\n\n\t\tstorePool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn new(Store)\n\t\t\t},\n\t\t},\n\t}\n}", "func NewMock() *Mock {\n\treturn &Mock{now: time.Unix(0, 0)}\n}", "func newProviderImpl(name string) (Provider, error) {\n\tif name == LOCAL {\n\t\treturn &LocalProvider{}, nil\n\t}\n\n\tif name == AWS {\n\t\treturn &AwsProvider{}, nil\n\t}\n\n\treturn nil, errors.New(fmt.Sprintf(\"Provider '%s' doesn't exist\", name))\n}", "func NewMockChoriaProvider(ctrl *gomock.Controller) *MockChoriaProvider {\n\tmock := &MockChoriaProvider{ctrl: ctrl}\n\tmock.recorder = &MockChoriaProviderMockRecorder{mock}\n\treturn mock\n}", "func NewProvider(logger *zap.Logger) Provider {\n\treturn newProvider(logger)\n}", "func New(provider string, p *ProviderData) Provider {\n\tswitch provider {\n\tcase \"myusa\":\n\t\treturn NewMyUsaProvider(p)\n\tcase \"linkedin\":\n\t\treturn NewLinkedInProvider(p)\n\tcase \"facebook\":\n\t\treturn NewFacebookProvider(p)\n\tcase \"github\":\n\t\treturn NewGitHubProvider(p)\n\tcase \"azure\":\n\t\treturn NewAzureProvider(p)\n\tcase \"gitlab\":\n\t\treturn NewGitLabProvider(p)\n\tdefault:\n\t\treturn NewGoogleProvider(p)\n\t}\n}", "func NewValidatorProvider(t mockConstructorTestingTNewValidatorProvider) *ValidatorProvider {\n\tmock := &ValidatorProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "func (m *MockBootstrapperProvider) Provide() (Bootstrapper, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Provide\")\n\tret0, _ := ret[0].(Bootstrapper)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func New(clientset *clusterinfo.OpenShift, infraStatus *config.InfrastructureStatus) *Provider {\n\treturn &Provider{\n\t\toc: clientset,\n\t\tInfrastructureStatus: infraStatus,\n\t}\n}", "func ToMockProvider(p goth.Provider) *MockProvider {\n\treturn p.(*MockProvider)\n}", "func newMockTransport() *mockTransport {\n\treturn &mockTransport{\n\t\turlToResponseAndError: make(map[string]mockTransportResponse),\n\t\trequestURLsReceived: make([]string, 0),\n\t}\n}", "func NewProvider(log *zap.Logger, url, clusterID, clientID string) mq.Provider {\n\tif len(clusterID) == 0 || len(clientID) == 0 {\n\t\treturn nil\n\t}\n\n\tcfg := newConfig(url, clusterID, clientID)\n\n\tif log == nil {\n\t\tlog = zap.NewNop()\n\t}\n\n\treturn &provider{\n\t\tconfig: cfg,\n\t\tconsumer: newConsumer(log, url, clusterID, clientID),\n\t\tlog: log,\n\t}\n}", "func NewMockMiddlewares(ctrl *gomock.Controller) *MockMiddlewares {\n\tmock := &MockMiddlewares{ctrl: ctrl}\n\tmock.recorder = &MockMiddlewaresMockRecorder{mock}\n\treturn mock\n}", "func NewMockDiscoveryProvider(err error, peers []fab.Peer) (*MockStaticDiscoveryProvider, error) {\n\treturn &MockStaticDiscoveryProvider{Error: err, Peers: peers}, nil\n}", "func NewMockObject(uid, name, ns string, res api.Resource) api.Object {\n\treturn NewObject(uuid.NewFromString(uid), name, ns, res)\n}", "func (t TestFactoryT) NewMockMemStore() *memStoreImpl {\n\tmetaStore := new(metaMocks.MetaStore)\n\tdiskStore := new(diskMocks.DiskStore)\n\tredoLogManagerMaster, _ := redolog.NewRedoLogManagerMaster(&common.RedoLogConfig{}, diskStore, metaStore)\n\tbootstrapToken := new(memComMocks.BootStrapToken)\n\tbootstrapToken.On(\"AcquireToken\", mock.Anything, mock.Anything).Return(true)\n\tbootstrapToken.On(\"ReleaseToken\", mock.Anything, mock.Anything).Return()\n\n\treturn NewMemStore(metaStore, diskStore, NewOptions(bootstrapToken, redoLogManagerMaster)).(*memStoreImpl)\n}", "func NewMock() *MockMetrics {\n\treturn &MockMetrics{}\n}", "func NewProvider(logger *zap.Logger, options ...ProviderOption) Provider {\n\treturn newProvider(logger, options...)\n}", "func New(t *testing.T, requests []ExpectedRequest) *httptest.Server {\n\th := mockHandler(t, requests)\n\treturn httptest.NewServer(h)\n}", "func New(t *testing.T, requests []ExpectedRequest) *httptest.Server {\n\th := mockHandler(t, requests)\n\treturn httptest.NewServer(h)\n}", "func New(c *Config) *Provider {\n\treturn &Provider{\n\t\tConfig: c,\n\t}\n}", "func createProviders(tmpFiles *tmpCredsFiles) (certprovider.Provider, certprovider.Provider, certprovider.Provider, certprovider.Provider, error) {\n\tclientIdentityOptions := pemfile.Options{\n\t\tCertFile: tmpFiles.clientCertTmp.Name(),\n\t\tKeyFile: tmpFiles.clientKeyTmp.Name(),\n\t\tRefreshDuration: credRefreshingInterval,\n\t}\n\tclientIdentityProvider, err := pemfile.NewProvider(clientIdentityOptions)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, err\n\t}\n\tclientRootOptions := pemfile.Options{\n\t\tRootFile: tmpFiles.clientTrustTmp.Name(),\n\t\tRefreshDuration: credRefreshingInterval,\n\t}\n\tclientRootProvider, err := pemfile.NewProvider(clientRootOptions)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, err\n\t}\n\tserverIdentityOptions := pemfile.Options{\n\t\tCertFile: tmpFiles.serverCertTmp.Name(),\n\t\tKeyFile: tmpFiles.serverKeyTmp.Name(),\n\t\tRefreshDuration: credRefreshingInterval,\n\t}\n\tserverIdentityProvider, err := pemfile.NewProvider(serverIdentityOptions)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, err\n\t}\n\tserverRootOptions := pemfile.Options{\n\t\tRootFile: tmpFiles.serverTrustTmp.Name(),\n\t\tRefreshDuration: credRefreshingInterval,\n\t}\n\tserverRootProvider, err := pemfile.NewProvider(serverRootOptions)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, err\n\t}\n\treturn clientIdentityProvider, clientRootProvider, serverIdentityProvider, serverRootProvider, nil\n}", "func (t TestFactoryT) NewMockMemStore() *memStoreImpl {\n\tmetaStore := new(metaMocks.MetaStore)\n\tdiskStore := new(diskMocks.DiskStore)\n\tredoLogManagerMaster, _ := redolog.NewRedoLogManagerMaster(\"\", &common.RedoLogConfig{}, diskStore, metaStore)\n\tbootstrapToken := new(memComMocks.BootStrapToken)\n\tbootstrapToken.On(\"AcquireToken\", mock.Anything, mock.Anything).Return(true)\n\tbootstrapToken.On(\"ReleaseToken\", mock.Anything, mock.Anything).Return()\n\n\treturn NewMemStore(metaStore, diskStore, NewOptions(bootstrapToken, redoLogManagerMaster)).(*memStoreImpl)\n}", "func New() buckets.Provider {\n\treturn newWithOptions()\n}", "func Mock(objects ...runtime.Object) KubernetesClientLambda {\n\tfakePool, fakeClient := NewFakes(objects...)\n\treturn &kubernetesClientLambdaImpl{\n\t\tclientPool: fakePool,\n\t\tinformerFactory: informers.NewSharedInformerFactory(fakeClient, 0),\n\t}\n}", "func providerFactory(meta *providercache.CachedProvider) providers.Factory {\n\treturn func() (providers.Interface, error) {\n\t\texecFile, err := meta.ExecutableFile()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tconfig := &plugin.ClientConfig{\n\t\t\tHandshakeConfig: tfplugin.Handshake,\n\t\t\tLogger: logging.NewProviderLogger(\"\"),\n\t\t\tAllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},\n\t\t\tManaged: true,\n\t\t\tCmd: exec.Command(execFile),\n\t\t\tAutoMTLS: enableProviderAutoMTLS,\n\t\t\tVersionedPlugins: tfplugin.VersionedPlugins,\n\t\t\tSyncStdout: logging.PluginOutputMonitor(fmt.Sprintf(\"%s:stdout\", meta.Provider)),\n\t\t\tSyncStderr: logging.PluginOutputMonitor(fmt.Sprintf(\"%s:stderr\", meta.Provider)),\n\t\t}\n\n\t\tclient := plugin.NewClient(config)\n\t\trpcClient, err := client.Client()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\traw, err := rpcClient.Dispense(tfplugin.ProviderPluginName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// store the client so that the plugin can kill the child process\n\t\tprotoVer := client.NegotiatedVersion()\n\t\tswitch protoVer {\n\t\tcase 5:\n\t\t\tp := raw.(*tfplugin.GRPCProvider)\n\t\t\tp.PluginClient = client\n\t\t\treturn p, nil\n\t\tcase 6:\n\t\t\tp := raw.(*tfplugin6.GRPCProvider)\n\t\t\tp.PluginClient = client\n\t\t\treturn p, nil\n\t\tdefault:\n\t\t\tpanic(\"unsupported protocol version\")\n\t\t}\n\t}\n}", "func init() {\n\tglobalContext = TestContext()\n\tfor name, descriptor := range providers {\n\t\tglobalContext.RegisterProvider(name, descriptor)\n\t}\n}", "func newPluginProvider(pluginBinDir string, provider kubeletconfig.CredentialProvider) (*pluginProvider, error) {\n\tmediaType := \"application/json\"\n\tinfo, ok := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), mediaType)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unsupported media type %q\", mediaType)\n\t}\n\n\tgv, ok := apiVersions[provider.APIVersion]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid apiVersion: %q\", provider.APIVersion)\n\t}\n\n\tclock := clock.RealClock{}\n\n\treturn &pluginProvider{\n\t\tclock: clock,\n\t\tmatchImages: provider.MatchImages,\n\t\tcache: cache.NewExpirationStore(cacheKeyFunc, &cacheExpirationPolicy{clock: clock}),\n\t\tdefaultCacheDuration: provider.DefaultCacheDuration.Duration,\n\t\tlastCachePurge: clock.Now(),\n\t\tplugin: &execPlugin{\n\t\t\tname: provider.Name,\n\t\t\tapiVersion: provider.APIVersion,\n\t\t\tencoder: codecs.EncoderForVersion(info.Serializer, gv),\n\t\t\tpluginBinDir: pluginBinDir,\n\t\t\targs: provider.Args,\n\t\t\tenvVars: provider.Env,\n\t\t\tenviron: os.Environ,\n\t\t},\n\t}, nil\n}", "func newMock(deps mockDependencies, t testing.TB) (Component, error) {\n\tbackupConfig := config.NewConfig(\"\", \"\", strings.NewReplacer())\n\tbackupConfig.CopyConfig(config.Datadog)\n\n\tconfig.Datadog.CopyConfig(config.NewConfig(\"mock\", \"XXXX\", strings.NewReplacer()))\n\n\tconfig.SetFeatures(t, deps.Params.Features...)\n\n\t// call InitConfig to set defaults.\n\tconfig.InitConfig(config.Datadog)\n\tc := &cfg{\n\t\tConfig: config.Datadog,\n\t}\n\n\tif !deps.Params.SetupConfig {\n\n\t\tif deps.Params.ConfFilePath != \"\" {\n\t\t\tconfig.Datadog.SetConfigType(\"yaml\")\n\t\t\terr := config.Datadog.ReadConfig(strings.NewReader(deps.Params.ConfFilePath))\n\t\t\tif err != nil {\n\t\t\t\t// The YAML was invalid, fail initialization of the mock config.\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\twarnings, _ := setupConfig(deps)\n\t\tc.warnings = warnings\n\t}\n\n\t// Overrides are explicit and will take precedence over any other\n\t// setting\n\tfor k, v := range deps.Params.Overrides {\n\t\tconfig.Datadog.Set(k, v)\n\t}\n\n\t// swap the existing config back at the end of the test.\n\tt.Cleanup(func() { config.Datadog.CopyConfig(backupConfig) })\n\n\treturn c, nil\n}", "func NewBaseProvider(no *Options) Provider {\n\treturn &BaseProvider{\n\t\tNewActions(no),\n\t\tNewDuelLinks(no),\n\t\tNewMisc(no),\n\t}\n}", "func New(t T) *Tester {\n\ttt := &Tester{\n\t\tt: t,\n\n\t\tclients: make(map[string]*client),\n\n\t\tcodecs: make(map[string]goka.Codec),\n\t\ttopicQueues: make(map[string]*queue),\n\t\tstorages: make(map[string]storage.Storage),\n\t}\n\ttt.tmgr = NewMockTopicManager(tt, 1, 1)\n\ttt.producer = newProducerMock(tt.handleEmit)\n\n\treturn tt\n}" ]
[ "0.6564672", "0.6390504", "0.63529956", "0.62278885", "0.61835265", "0.6167602", "0.6167602", "0.6167602", "0.6167602", "0.6167602", "0.6167602", "0.6167602", "0.6167602", "0.61669147", "0.6132294", "0.60496056", "0.5984718", "0.59554595", "0.59195", "0.59074426", "0.5889402", "0.587887", "0.5849598", "0.58472836", "0.5837561", "0.5832616", "0.5830016", "0.5820673", "0.5814565", "0.5805349", "0.57693017", "0.57537246", "0.57181144", "0.5709279", "0.5707897", "0.57027274", "0.5699361", "0.5677092", "0.5671614", "0.5654188", "0.5652066", "0.56485367", "0.5638125", "0.56343234", "0.5610135", "0.5605013", "0.56035286", "0.56015146", "0.55960894", "0.55893457", "0.55811256", "0.5563473", "0.5552943", "0.55477726", "0.5545581", "0.553752", "0.5532278", "0.553115", "0.5525606", "0.5525533", "0.55136824", "0.55109805", "0.55041796", "0.54930353", "0.5488427", "0.5482902", "0.54763305", "0.54746425", "0.54716176", "0.54572594", "0.54546005", "0.5449581", "0.54125273", "0.541115", "0.5405129", "0.54048425", "0.5403262", "0.54017735", "0.5400563", "0.5398795", "0.5383267", "0.53816384", "0.5380488", "0.5378469", "0.5377692", "0.53686434", "0.5365781", "0.53642213", "0.53642213", "0.5352168", "0.5337998", "0.5336663", "0.53365695", "0.53327274", "0.53267187", "0.5319543", "0.52884823", "0.5282567", "0.52784127", "0.52742845" ]
0.7244181
0
EXPECT returns an object that allows the caller to indicate expected use
func (m *MockProviders) EXPECT() *MockProvidersMockRecorder { return m.recorder }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (mmGetObject *mClientMockGetObject) Expect(ctx context.Context, head insolar.Reference) *mClientMockGetObject {\n\tif mmGetObject.mock.funcGetObject != nil {\n\t\tmmGetObject.mock.t.Fatalf(\"ClientMock.GetObject mock is already set by Set\")\n\t}\n\n\tif mmGetObject.defaultExpectation == nil {\n\t\tmmGetObject.defaultExpectation = &ClientMockGetObjectExpectation{}\n\t}\n\n\tmmGetObject.defaultExpectation.params = &ClientMockGetObjectParams{ctx, head}\n\tfor _, e := range mmGetObject.expectations {\n\t\tif minimock.Equal(e.params, mmGetObject.defaultExpectation.params) {\n\t\t\tmmGetObject.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmGetObject.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmGetObject\n}", "func (r Requester) Assert(actual, expected interface{}) Requester {\n\t//r.actualResponse = actual\n\t//r.expectedResponse = expected\n\treturn r\n}", "func (r *Request) Expect(t *testing.T) *Response {\n\tr.apiTest.t = t\n\treturn r.apiTest.response\n}", "func (m *MockNotary) Notarize(arg0 string) (map[string]interface{}, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Notarize\", arg0)\n\tret0, _ := ret[0].(map[string]interface{})\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (tc TestCases) expect() {\n\tfmt.Println(cnt)\n\tcnt++\n\tif !reflect.DeepEqual(tc.resp, tc.respExp) {\n\t\ttc.t.Error(fmt.Sprintf(\"\\nRequested: \", tc.req, \"\\nExpected: \", tc.respExp, \"\\nFound: \", tc.resp))\n\t}\n}", "func (r *Request) Expect(t TestingT) *Response {\n\tr.apiTest.t = t\n\treturn r.apiTest.response\n}", "func Expect(t cbtest.T, actual interface{}, matcher matcher.Matcher, labelAndArgs ...interface{}) {\n\tt.Helper()\n\tres := ExpectE(t, actual, matcher, labelAndArgs...)\n\tif !res {\n\t\tt.FailNow()\n\t}\n}", "func (m *MockisObject_Obj) EXPECT() *MockisObject_ObjMockRecorder {\n\treturn m.recorder\n}", "func Expect(t *testing.T, v, m interface{}) {\n\tvt, vok := v.(Equaler)\n\tmt, mok := m.(Equaler)\n\n\tvar state bool\n\tif vok && mok {\n\t\tstate = vt.Equal(mt)\n\t} else {\n\t\tstate = reflect.DeepEqual(v, m)\n\t}\n\n\tif state {\n\t\tflux.FatalFailed(t, \"Value %+v and %+v are not a match\", v, m)\n\t\treturn\n\t}\n\tflux.LogPassed(t, \"Value %+v and %+v are a match\", v, m)\n}", "func (mmState *mClientMockState) Expect() *mClientMockState {\n\tif mmState.mock.funcState != nil {\n\t\tmmState.mock.t.Fatalf(\"ClientMock.State mock is already set by Set\")\n\t}\n\n\tif mmState.defaultExpectation == nil {\n\t\tmmState.defaultExpectation = &ClientMockStateExpectation{}\n\t}\n\n\treturn mmState\n}", "func (mmProvide *mContainerMockProvide) Expect(constructor interface{}) *mContainerMockProvide {\n\tif mmProvide.mock.funcProvide != nil {\n\t\tmmProvide.mock.t.Fatalf(\"ContainerMock.Provide mock is already set by Set\")\n\t}\n\n\tif mmProvide.defaultExpectation == nil {\n\t\tmmProvide.defaultExpectation = &ContainerMockProvideExpectation{}\n\t}\n\n\tmmProvide.defaultExpectation.params = &ContainerMockProvideParams{constructor}\n\tfor _, e := range mmProvide.expectations {\n\t\tif minimock.Equal(e.params, mmProvide.defaultExpectation.params) {\n\t\t\tmmProvide.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmProvide.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmProvide\n}", "func Mock() Env {\n\treturn mock.New()\n}", "func (mmGetCode *mClientMockGetCode) Expect(ctx context.Context, ref insolar.Reference) *mClientMockGetCode {\n\tif mmGetCode.mock.funcGetCode != nil {\n\t\tmmGetCode.mock.t.Fatalf(\"ClientMock.GetCode mock is already set by Set\")\n\t}\n\n\tif mmGetCode.defaultExpectation == nil {\n\t\tmmGetCode.defaultExpectation = &ClientMockGetCodeExpectation{}\n\t}\n\n\tmmGetCode.defaultExpectation.params = &ClientMockGetCodeParams{ctx, ref}\n\tfor _, e := range mmGetCode.expectations {\n\t\tif minimock.Equal(e.params, mmGetCode.defaultExpectation.params) {\n\t\t\tmmGetCode.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmGetCode.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmGetCode\n}", "func (_m *MockOStream) EXPECT() *MockOStreamMockRecorder {\n\treturn _m.recorder\n}", "func expect(t *testing.T, method, url string, testieOptions ...func(*http.Request)) *testie {\n\treq, err := http.NewRequest(method, url, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfor _, opt := range testieOptions {\n\t\topt(req)\n\t}\n\n\treturn testReq(t, req)\n}", "func (mmGetUser *mStorageMockGetUser) Expect(ctx context.Context, userID int64) *mStorageMockGetUser {\n\tif mmGetUser.mock.funcGetUser != nil {\n\t\tmmGetUser.mock.t.Fatalf(\"StorageMock.GetUser mock is already set by Set\")\n\t}\n\n\tif mmGetUser.defaultExpectation == nil {\n\t\tmmGetUser.defaultExpectation = &StorageMockGetUserExpectation{}\n\t}\n\n\tmmGetUser.defaultExpectation.params = &StorageMockGetUserParams{ctx, userID}\n\tfor _, e := range mmGetUser.expectations {\n\t\tif minimock.Equal(e.params, mmGetUser.defaultExpectation.params) {\n\t\t\tmmGetUser.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmGetUser.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmGetUser\n}", "func (mmGetObject *mClientMockGetObject) Return(o1 ObjectDescriptor, err error) *ClientMock {\n\tif mmGetObject.mock.funcGetObject != nil {\n\t\tmmGetObject.mock.t.Fatalf(\"ClientMock.GetObject mock is already set by Set\")\n\t}\n\n\tif mmGetObject.defaultExpectation == nil {\n\t\tmmGetObject.defaultExpectation = &ClientMockGetObjectExpectation{mock: mmGetObject.mock}\n\t}\n\tmmGetObject.defaultExpectation.results = &ClientMockGetObjectResults{o1, err}\n\treturn mmGetObject.mock\n}", "func (mmGather *mGathererMockGather) Expect() *mGathererMockGather {\n\tif mmGather.mock.funcGather != nil {\n\t\tmmGather.mock.t.Fatalf(\"GathererMock.Gather mock is already set by Set\")\n\t}\n\n\tif mmGather.defaultExpectation == nil {\n\t\tmmGather.defaultExpectation = &GathererMockGatherExpectation{}\n\t}\n\n\treturn mmGather\n}", "func (m *MockParser) EXPECT() *MockParserMockRecorder {\n\treturn m.recorder\n}", "func (m *MockParser) EXPECT() *MockParserMockRecorder {\n\treturn m.recorder\n}", "func (mmWriteTo *mDigestHolderMockWriteTo) Expect(w io.Writer) *mDigestHolderMockWriteTo {\n\tif mmWriteTo.mock.funcWriteTo != nil {\n\t\tmmWriteTo.mock.t.Fatalf(\"DigestHolderMock.WriteTo mock is already set by Set\")\n\t}\n\n\tif mmWriteTo.defaultExpectation == nil {\n\t\tmmWriteTo.defaultExpectation = &DigestHolderMockWriteToExpectation{}\n\t}\n\n\tmmWriteTo.defaultExpectation.params = &DigestHolderMockWriteToParams{w}\n\tfor _, e := range mmWriteTo.expectations {\n\t\tif minimock.Equal(e.params, mmWriteTo.defaultExpectation.params) {\n\t\t\tmmWriteTo.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmWriteTo.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmWriteTo\n}", "func (rb *RequestBuilder) EXPECT() *ResponseAsserter {\n\treq := httptest.NewRequest(rb.method, rb.path, rb.body)\n\tfor k, v := range rb.hdr {\n\t\treq.Header[k] = v\n\t}\n\n\trec := httptest.NewRecorder()\n\trb.cas.h.ServeHTTP(rec, req)\n\n\treturn &ResponseAsserter{\n\t\trec: rec,\n\t\treq: req,\n\t\tb: rb,\n\t\tfail: rb.fail.\n\t\t\tCopy().\n\t\t\tWithRequest(req).\n\t\t\tWithResponse(rec),\n\t}\n}", "func (mmGetState *mGatewayMockGetState) Expect() *mGatewayMockGetState {\n\tif mmGetState.mock.funcGetState != nil {\n\t\tmmGetState.mock.t.Fatalf(\"GatewayMock.GetState mock is already set by Set\")\n\t}\n\n\tif mmGetState.defaultExpectation == nil {\n\t\tmmGetState.defaultExpectation = &GatewayMockGetStateExpectation{}\n\t}\n\n\treturn mmGetState\n}", "func (m *mParcelMockGetSign) Expect() *mParcelMockGetSign {\n\tm.mock.GetSignFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ParcelMockGetSignExpectation{}\n\t}\n\n\treturn m\n}", "func (mmCreateTag *mTagCreatorMockCreateTag) Expect(t1 semantic.Tag) *mTagCreatorMockCreateTag {\n\tif mmCreateTag.mock.funcCreateTag != nil {\n\t\tmmCreateTag.mock.t.Fatalf(\"TagCreatorMock.CreateTag mock is already set by Set\")\n\t}\n\n\tif mmCreateTag.defaultExpectation == nil {\n\t\tmmCreateTag.defaultExpectation = &TagCreatorMockCreateTagExpectation{}\n\t}\n\n\tmmCreateTag.defaultExpectation.params = &TagCreatorMockCreateTagParams{t1}\n\tfor _, e := range mmCreateTag.expectations {\n\t\tif minimock.Equal(e.params, mmCreateTag.defaultExpectation.params) {\n\t\t\tmmCreateTag.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmCreateTag.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmCreateTag\n}", "func (m *MockActorUsecase) EXPECT() *MockActorUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *mParcelMockGetCaller) Expect() *mParcelMockGetCaller {\n\tm.mock.GetCallerFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ParcelMockGetCallerExpectation{}\n\t}\n\n\treturn m\n}", "func mockAlwaysRun() bool { return true }", "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *MockUsecase) EXPECT() *MockUsecaseMockRecorder {\n\treturn m.recorder\n}", "func (m *MockArg) EXPECT() *MockArgMockRecorder {\n\treturn m.recorder\n}", "func (st *SDKTester) Test(resp interface{}) {\n\tif resp == nil || st.respWant == nil {\n\t\tst.t.Logf(\"response want/got is nil, abort\\n\")\n\t\treturn\n\t}\n\n\trespMap := st.getFieldMap(resp)\n\tfor i, v := range st.respWant {\n\t\tif reflect.DeepEqual(v, respMap[i]) {\n\t\t\tcontinue\n\t\t}\n\t\tswitch x := respMap[i].(type) {\n\t\tcase Stringer:\n\t\t\tif !assert.Equal(st.t, v, x.String()) {\n\t\t\t\tst.t.Errorf(\"%s want %v, got %v\", i, v, respMap[i])\n\t\t\t}\n\t\tcase map[string]interface{}:\n\t\t\tif value, ok := x[\"Value\"]; ok {\n\t\t\t\tif !assert.Equal(st.t, v, value) {\n\t\t\t\t\tst.t.Errorf(\"%s want %v, got %v\", i, v, respMap[i])\n\t\t\t\t}\n\t\t\t}\n\t\tcase Inter:\n\t\t\tif !assert.Equal(st.t, v, x.Int()) {\n\t\t\t\tst.t.Errorf(\"%s want %v, got %v\", i, v, respMap[i])\n\t\t\t}\n\t\tdefault:\n\t\t\tif !assert.Equal(st.t, v, respMap[i]) {\n\t\t\t\tst.t.Errorf(\"%s want %v, got %v\", i, v, respMap[i])\n\t\t\t}\n\t\t}\n\t}\n}", "func (m *MockCreator) EXPECT() *MockCreatorMockRecorder {\n\treturn m.recorder\n}", "func (m *MockCreator) EXPECT() *MockCreatorMockRecorder {\n\treturn m.recorder\n}", "func TestCallFunc_arguments(t *testing.T) {\n\n}", "func TestGetNone4A(t *testing.T) {\n}", "func (m *mParcelMockGetSender) Expect() *mParcelMockGetSender {\n\tm.mock.GetSenderFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ParcelMockGetSenderExpectation{}\n\t}\n\n\treturn m\n}", "func expectEqual(value, expected interface{}) {\n\tif value != expected {\n\t\tfmt.Printf(\"Fehler: %v bekommen, erwartet war aber %v.\\n\", value, expected)\n\t} else {\n\t\tfmt.Printf(\"OK: %v bekommen, erwartet war aber %v.\\n\", value, expected)\n\t}\n}", "func (mmGetPacketSignature *mPacketParserMockGetPacketSignature) Expect() *mPacketParserMockGetPacketSignature {\n\tif mmGetPacketSignature.mock.funcGetPacketSignature != nil {\n\t\tmmGetPacketSignature.mock.t.Fatalf(\"PacketParserMock.GetPacketSignature mock is already set by Set\")\n\t}\n\n\tif mmGetPacketSignature.defaultExpectation == nil {\n\t\tmmGetPacketSignature.defaultExpectation = &PacketParserMockGetPacketSignatureExpectation{}\n\t}\n\n\treturn mmGetPacketSignature\n}", "func (mmHasPendings *mClientMockHasPendings) Expect(ctx context.Context, object insolar.Reference) *mClientMockHasPendings {\n\tif mmHasPendings.mock.funcHasPendings != nil {\n\t\tmmHasPendings.mock.t.Fatalf(\"ClientMock.HasPendings mock is already set by Set\")\n\t}\n\n\tif mmHasPendings.defaultExpectation == nil {\n\t\tmmHasPendings.defaultExpectation = &ClientMockHasPendingsExpectation{}\n\t}\n\n\tmmHasPendings.defaultExpectation.params = &ClientMockHasPendingsParams{ctx, object}\n\tfor _, e := range mmHasPendings.expectations {\n\t\tif minimock.Equal(e.params, mmHasPendings.defaultExpectation.params) {\n\t\t\tmmHasPendings.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmHasPendings.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmHasPendings\n}", "func Run(t testing.TB, cloud cloud.Client, src string, opts ...RunOption) {\n\n\tif cloud == nil {\n\t\tcloud = mockcloud.Client(nil)\n\t}\n\n\tvm := otto.New()\n\n\tpkg, err := godotto.Apply(context.Background(), vm, cloud)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tvm.Set(\"cloud\", pkg)\n\tvm.Set(\"equals\", func(call otto.FunctionCall) otto.Value {\n\t\tvm := call.Otto\n\t\tgot, err := call.Argument(0).Export()\n\t\tif err != nil {\n\t\t\tottoutil.Throw(vm, err.Error())\n\t\t}\n\t\twant, err := call.Argument(1).Export()\n\t\tif err != nil {\n\t\t\tottoutil.Throw(vm, err.Error())\n\t\t}\n\t\tok, cause := deepEqual(got, want)\n\t\tif ok {\n\t\t\treturn otto.UndefinedValue()\n\t\t}\n\t\tmsg := \"assertion failed!\\n\" + cause\n\n\t\tif len(call.ArgumentList) > 2 {\n\t\t\tformat, err := call.ArgumentList[2].ToString()\n\t\t\tif err != nil {\n\t\t\t\tottoutil.Throw(vm, err.Error())\n\t\t\t}\n\t\t\tmsg += \"\\n\" + format\n\t\t}\n\t\tottoutil.Throw(vm, msg)\n\t\treturn otto.UndefinedValue()\n\t})\n\tvm.Set(\"assert\", func(call otto.FunctionCall) otto.Value {\n\t\tvm := call.Otto\n\t\tv, err := call.Argument(0).ToBoolean()\n\t\tif err != nil {\n\t\t\tottoutil.Throw(vm, err.Error())\n\t\t}\n\t\tif v {\n\t\t\treturn otto.UndefinedValue()\n\t\t}\n\t\tmsg := \"assertion failed!\"\n\t\tif len(call.ArgumentList) > 1 {\n\t\t\tformat, err := call.ArgumentList[1].ToString()\n\t\t\tif err != nil {\n\t\t\t\tottoutil.Throw(vm, err.Error())\n\t\t\t}\n\t\t\tmsg += \"\\n\" + format\n\t\t}\n\t\tottoutil.Throw(vm, msg)\n\t\treturn otto.UndefinedValue()\n\t})\n\tscript, err := vm.Compile(\"\", src)\n\tif err != nil {\n\t\tt.Fatalf(\"invalid code: %v\", err)\n\t}\n\n\tfor _, opt := range opts {\n\t\tif err := opt(vm); err != nil {\n\t\t\tt.Fatalf(\"can't apply option: %v\", err)\n\t\t}\n\t}\n\n\tif _, err := vm.Run(script); err != nil {\n\t\tif oe, ok := err.(*otto.Error); ok {\n\t\t\tt.Fatal(oe.String())\n\t\t} else {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n}", "func TestSetGoodArgs(t *testing.T) {\n\tfmt.Println(\"Entering the test method for SetGoodArgs\")\n\tprovcc := new(SimpleAsset)\n\tstub := shim.NewMockStub(\"ANY_PARAM\", provcc)\n\n\t// Testing the init. It always return true. No parameters in init. \n\t\n\tcheckInit(t, stub, [][]byte{[]byte(\"init\")})\n\n\tres := stub.MockInvoke(\"1\", [][]byte{[]byte(\"set\"), []byte(\"S52fkpF2rCEArSuwqyDA9tVjawUdrkGzbNQLaa7xJfA=\"),\n\t[]byte(\"agentInfo.atype\"),[]byte(\"1.2.3.4\"),\n\t[]byte(\"agentInfo.id\"),[]byte(\"agentidentifier\"),\n\t[]byte(\"agentinfo.name\"),[]byte(\"7.8.9\"),\n\t[]byte(\"agentinfo.idp\"),[]byte(\"urn:tiani-spirit:sts\"),\n\t[]byte(\"locationInfo.id\"),[]byte(\"urn:oid:1.2.3\"),\n\t[]byte(\"locationInfo.name\"),[]byte(\"General Hospital\"),\n\t[]byte(\"locationInfo.locality\"),[]byte(\"Nashville, TN\"),\n\t[]byte(\"locationInfo.docid\"),[]byte(\"1.2.3\"),\n\t[]byte(\"action\"),[]byte(\"ex:CREATE\"),\n\t[]byte(\"date\"),[]byte(\"2018-11-10T12:15:55.028Z\")})\n\n\tif res.Status != shim.OK {\n\t\tfmt.Println(\"Invoke failed\", string(res.Message))\n\t\tt.FailNow()\n\t}\n\t\n}", "func Mock() Cluster { return mockCluster{} }", "func (mmRegisterResult *mClientMockRegisterResult) Expect(ctx context.Context, request insolar.Reference, result RequestResult) *mClientMockRegisterResult {\n\tif mmRegisterResult.mock.funcRegisterResult != nil {\n\t\tmmRegisterResult.mock.t.Fatalf(\"ClientMock.RegisterResult mock is already set by Set\")\n\t}\n\n\tif mmRegisterResult.defaultExpectation == nil {\n\t\tmmRegisterResult.defaultExpectation = &ClientMockRegisterResultExpectation{}\n\t}\n\n\tmmRegisterResult.defaultExpectation.params = &ClientMockRegisterResultParams{ctx, request, result}\n\tfor _, e := range mmRegisterResult.expectations {\n\t\tif minimock.Equal(e.params, mmRegisterResult.defaultExpectation.params) {\n\t\t\tmmRegisterResult.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmRegisterResult.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmRegisterResult\n}", "func (m *MockS3API) EXPECT() *MockS3APIMockRecorder {\n\treturn m.recorder\n}", "func mockedGranter(kubeutil *kube.Kube, app *v1.RadixRegistration, namespace string, serviceAccount *corev1.ServiceAccount) error {\n\treturn nil\n}", "func (m *MockOrg) EXPECT() *MockOrgMockRecorder {\n\treturn m.recorder\n}", "func (mmGetPendings *mClientMockGetPendings) Expect(ctx context.Context, objectRef insolar.Reference) *mClientMockGetPendings {\n\tif mmGetPendings.mock.funcGetPendings != nil {\n\t\tmmGetPendings.mock.t.Fatalf(\"ClientMock.GetPendings mock is already set by Set\")\n\t}\n\n\tif mmGetPendings.defaultExpectation == nil {\n\t\tmmGetPendings.defaultExpectation = &ClientMockGetPendingsExpectation{}\n\t}\n\n\tmmGetPendings.defaultExpectation.params = &ClientMockGetPendingsParams{ctx, objectRef}\n\tfor _, e := range mmGetPendings.expectations {\n\t\tif minimock.Equal(e.params, mmGetPendings.defaultExpectation.params) {\n\t\t\tmmGetPendings.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmGetPendings.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmGetPendings\n}", "func (mmGetUserLocation *mStorageMockGetUserLocation) Expect(ctx context.Context, userID int64) *mStorageMockGetUserLocation {\n\tif mmGetUserLocation.mock.funcGetUserLocation != nil {\n\t\tmmGetUserLocation.mock.t.Fatalf(\"StorageMock.GetUserLocation mock is already set by Set\")\n\t}\n\n\tif mmGetUserLocation.defaultExpectation == nil {\n\t\tmmGetUserLocation.defaultExpectation = &StorageMockGetUserLocationExpectation{}\n\t}\n\n\tmmGetUserLocation.defaultExpectation.params = &StorageMockGetUserLocationParams{ctx, userID}\n\tfor _, e := range mmGetUserLocation.expectations {\n\t\tif minimock.Equal(e.params, mmGetUserLocation.defaultExpectation.params) {\n\t\t\tmmGetUserLocation.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmGetUserLocation.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmGetUserLocation\n}", "func (mmAuther *mGatewayMockAuther) Expect() *mGatewayMockAuther {\n\tif mmAuther.mock.funcAuther != nil {\n\t\tmmAuther.mock.t.Fatalf(\"GatewayMock.Auther mock is already set by Set\")\n\t}\n\n\tif mmAuther.defaultExpectation == nil {\n\t\tmmAuther.defaultExpectation = &GatewayMockAutherExpectation{}\n\t}\n\n\treturn mmAuther\n}", "func (mmCreate *mPaymentRepositoryMockCreate) Expect(ctx context.Context, from int64, to int64, amount int64) *mPaymentRepositoryMockCreate {\n\tif mmCreate.mock.funcCreate != nil {\n\t\tmmCreate.mock.t.Fatalf(\"PaymentRepositoryMock.Create mock is already set by Set\")\n\t}\n\n\tif mmCreate.defaultExpectation == nil {\n\t\tmmCreate.defaultExpectation = &PaymentRepositoryMockCreateExpectation{}\n\t}\n\n\tmmCreate.defaultExpectation.params = &PaymentRepositoryMockCreateParams{ctx, from, to, amount}\n\tfor _, e := range mmCreate.expectations {\n\t\tif minimock.Equal(e.params, mmCreate.defaultExpectation.params) {\n\t\t\tmmCreate.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmCreate.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmCreate\n}", "func (mmInvoke *mContainerMockInvoke) Expect(function interface{}) *mContainerMockInvoke {\n\tif mmInvoke.mock.funcInvoke != nil {\n\t\tmmInvoke.mock.t.Fatalf(\"ContainerMock.Invoke mock is already set by Set\")\n\t}\n\n\tif mmInvoke.defaultExpectation == nil {\n\t\tmmInvoke.defaultExpectation = &ContainerMockInvokeExpectation{}\n\t}\n\n\tmmInvoke.defaultExpectation.params = &ContainerMockInvokeParams{function}\n\tfor _, e := range mmInvoke.expectations {\n\t\tif minimock.Equal(e.params, mmInvoke.defaultExpectation.params) {\n\t\t\tmmInvoke.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmInvoke.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmInvoke\n}", "func TestObjectsMeetReq(t *testing.T) {\n\tvar kr verifiable.StorageReader\n\tvar kw verifiable.StorageWriter\n\n\tvar m verifiable.MutatorService\n\n\tvar o verifiable.AuthorizationOracle\n\n\tkr = &memory.TransientStorage{}\n\tkw = &memory.TransientStorage{}\n\n\tkr = &bolt.Storage{}\n\tkw = &bolt.Storage{}\n\n\tkr = &badger.Storage{}\n\tkw = &badger.Storage{}\n\n\tm = &instant.Mutator{}\n\tm = (&batch.Mutator{}).MustCreate()\n\n\to = policy.Open\n\to = &policy.Static{}\n\n\tlog.Println(kr, kw, m, o) // \"use\" these so that go compiler will be quiet\n}", "func (mmGetPosition *mStoreMockGetPosition) Expect(account string, contractID string) *mStoreMockGetPosition {\n\tif mmGetPosition.mock.funcGetPosition != nil {\n\t\tmmGetPosition.mock.t.Fatalf(\"StoreMock.GetPosition mock is already set by Set\")\n\t}\n\n\tif mmGetPosition.defaultExpectation == nil {\n\t\tmmGetPosition.defaultExpectation = &StoreMockGetPositionExpectation{}\n\t}\n\n\tmmGetPosition.defaultExpectation.params = &StoreMockGetPositionParams{account, contractID}\n\tfor _, e := range mmGetPosition.expectations {\n\t\tif minimock.Equal(e.params, mmGetPosition.defaultExpectation.params) {\n\t\t\tmmGetPosition.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmGetPosition.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmGetPosition\n}", "func (mmGetAbandonedRequest *mClientMockGetAbandonedRequest) Expect(ctx context.Context, objectRef insolar.Reference, reqRef insolar.Reference) *mClientMockGetAbandonedRequest {\n\tif mmGetAbandonedRequest.mock.funcGetAbandonedRequest != nil {\n\t\tmmGetAbandonedRequest.mock.t.Fatalf(\"ClientMock.GetAbandonedRequest mock is already set by Set\")\n\t}\n\n\tif mmGetAbandonedRequest.defaultExpectation == nil {\n\t\tmmGetAbandonedRequest.defaultExpectation = &ClientMockGetAbandonedRequestExpectation{}\n\t}\n\n\tmmGetAbandonedRequest.defaultExpectation.params = &ClientMockGetAbandonedRequestParams{ctx, objectRef, reqRef}\n\tfor _, e := range mmGetAbandonedRequest.expectations {\n\t\tif minimock.Equal(e.params, mmGetAbandonedRequest.defaultExpectation.params) {\n\t\t\tmmGetAbandonedRequest.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmGetAbandonedRequest.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmGetAbandonedRequest\n}", "func (mmSend *mSenderMockSend) Expect(ctx context.Context, email Email) *mSenderMockSend {\n\tif mmSend.mock.funcSend != nil {\n\t\tmmSend.mock.t.Fatalf(\"SenderMock.Send mock is already set by Set\")\n\t}\n\n\tif mmSend.defaultExpectation == nil {\n\t\tmmSend.defaultExpectation = &SenderMockSendExpectation{}\n\t}\n\n\tmmSend.defaultExpectation.params = &SenderMockSendParams{ctx, email}\n\tfor _, e := range mmSend.expectations {\n\t\tif minimock.Equal(e.params, mmSend.defaultExpectation.params) {\n\t\t\tmmSend.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmSend.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmSend\n}", "func (m *Mockrequester) EXPECT() *MockrequesterMockRecorder {\n\treturn m.recorder\n}", "func callAndVerify(msg string, client pb.GreeterClient, shouldFail bool) error {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second)\n\tdefer cancel()\n\t_, err := client.SayHello(ctx, &pb.HelloRequest{Name: msg})\n\tif want, got := shouldFail == true, err != nil; got != want {\n\t\treturn fmt.Errorf(\"want and got mismatch, want shouldFail=%v, got fail=%v, rpc error: %v\", want, got, err)\n\t}\n\treturn nil\n}", "func expectEqual(actual interface{}, extra interface{}, explain ...interface{}) {\n\tgomega.ExpectWithOffset(1, actual).To(gomega.Equal(extra), explain...)\n}", "func (m *MockstackDescriber) EXPECT() *MockstackDescriberMockRecorder {\n\treturn m.recorder\n}", "func (req *outgoingRequest) Assert(t *testing.T, fixture *fixture) {\n\tassert.Equal(t, req.path, fixture.calledPath, \"called path not as expected\")\n\tassert.Equal(t, req.method, fixture.calledMethod, \"called path not as expected\")\n\tassert.Equal(t, req.body, fixture.requestBody, \"call body no as expected\")\n}", "func (mmVerify *mDelegationTokenFactoryMockVerify) Expect(parcel mm_insolar.Parcel) *mDelegationTokenFactoryMockVerify {\n\tif mmVerify.mock.funcVerify != nil {\n\t\tmmVerify.mock.t.Fatalf(\"DelegationTokenFactoryMock.Verify mock is already set by Set\")\n\t}\n\n\tif mmVerify.defaultExpectation == nil {\n\t\tmmVerify.defaultExpectation = &DelegationTokenFactoryMockVerifyExpectation{}\n\t}\n\n\tmmVerify.defaultExpectation.params = &DelegationTokenFactoryMockVerifyParams{parcel}\n\tfor _, e := range mmVerify.expectations {\n\t\tif minimock.Equal(e.params, mmVerify.defaultExpectation.params) {\n\t\t\tmmVerify.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmVerify.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmVerify\n}", "func (mmRead *mDigestHolderMockRead) Expect(p []byte) *mDigestHolderMockRead {\n\tif mmRead.mock.funcRead != nil {\n\t\tmmRead.mock.t.Fatalf(\"DigestHolderMock.Read mock is already set by Set\")\n\t}\n\n\tif mmRead.defaultExpectation == nil {\n\t\tmmRead.defaultExpectation = &DigestHolderMockReadExpectation{}\n\t}\n\n\tmmRead.defaultExpectation.params = &DigestHolderMockReadParams{p}\n\tfor _, e := range mmRead.expectations {\n\t\tif minimock.Equal(e.params, mmRead.defaultExpectation.params) {\n\t\t\tmmRead.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmRead.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmRead\n}", "func (mmSend *mClientMockSend) Expect(ctx context.Context, n *Notification) *mClientMockSend {\n\tif mmSend.mock.funcSend != nil {\n\t\tmmSend.mock.t.Fatalf(\"ClientMock.Send mock is already set by Set\")\n\t}\n\n\tif mmSend.defaultExpectation == nil {\n\t\tmmSend.defaultExpectation = &ClientMockSendExpectation{}\n\t}\n\n\tmmSend.defaultExpectation.params = &ClientMockSendParams{ctx, n}\n\tfor _, e := range mmSend.expectations {\n\t\tif minimock.Equal(e.params, mmSend.defaultExpectation.params) {\n\t\t\tmmSend.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmSend.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmSend\n}", "func (mmAsByteString *mDigestHolderMockAsByteString) Expect() *mDigestHolderMockAsByteString {\n\tif mmAsByteString.mock.funcAsByteString != nil {\n\t\tmmAsByteString.mock.t.Fatalf(\"DigestHolderMock.AsByteString mock is already set by Set\")\n\t}\n\n\tif mmAsByteString.defaultExpectation == nil {\n\t\tmmAsByteString.defaultExpectation = &DigestHolderMockAsByteStringExpectation{}\n\t}\n\n\treturn mmAsByteString\n}", "func Expect(msg string) error {\n\tif msg != \"\" {\n\t\treturn errors.New(msg)\n\t} else {\n\t\treturn nil\n\t}\n}", "func (mmEncrypt *mRingMockEncrypt) Expect(t1 secrets.Text) *mRingMockEncrypt {\n\tif mmEncrypt.mock.funcEncrypt != nil {\n\t\tmmEncrypt.mock.t.Fatalf(\"RingMock.Encrypt mock is already set by Set\")\n\t}\n\n\tif mmEncrypt.defaultExpectation == nil {\n\t\tmmEncrypt.defaultExpectation = &RingMockEncryptExpectation{}\n\t}\n\n\tmmEncrypt.defaultExpectation.params = &RingMockEncryptParams{t1}\n\tfor _, e := range mmEncrypt.expectations {\n\t\tif minimock.Equal(e.params, mmEncrypt.defaultExpectation.params) {\n\t\t\tmmEncrypt.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmEncrypt.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmEncrypt\n}", "func (mmBootstrapper *mGatewayMockBootstrapper) Expect() *mGatewayMockBootstrapper {\n\tif mmBootstrapper.mock.funcBootstrapper != nil {\n\t\tmmBootstrapper.mock.t.Fatalf(\"GatewayMock.Bootstrapper mock is already set by Set\")\n\t}\n\n\tif mmBootstrapper.defaultExpectation == nil {\n\t\tmmBootstrapper.defaultExpectation = &GatewayMockBootstrapperExpectation{}\n\t}\n\n\treturn mmBootstrapper\n}", "func (m *MockNotary) EXPECT() *MockNotaryMockRecorder {\n\treturn m.recorder\n}", "func (m *mParcelMockSetSender) Expect(p insolar.Reference) *mParcelMockSetSender {\n\tm.mock.SetSenderFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ParcelMockSetSenderExpectation{}\n\t}\n\tm.mainExpectation.input = &ParcelMockSetSenderInput{p}\n\treturn m\n}", "func (mmGetPacketType *mPacketParserMockGetPacketType) Expect() *mPacketParserMockGetPacketType {\n\tif mmGetPacketType.mock.funcGetPacketType != nil {\n\t\tmmGetPacketType.mock.t.Fatalf(\"PacketParserMock.GetPacketType mock is already set by Set\")\n\t}\n\n\tif mmGetPacketType.defaultExpectation == nil {\n\t\tmmGetPacketType.defaultExpectation = &PacketParserMockGetPacketTypeExpectation{}\n\t}\n\n\treturn mmGetPacketType\n}", "func (mmParsePacketBody *mPacketParserMockParsePacketBody) Expect() *mPacketParserMockParsePacketBody {\n\tif mmParsePacketBody.mock.funcParsePacketBody != nil {\n\t\tmmParsePacketBody.mock.t.Fatalf(\"PacketParserMock.ParsePacketBody mock is already set by Set\")\n\t}\n\n\tif mmParsePacketBody.defaultExpectation == nil {\n\t\tmmParsePacketBody.defaultExpectation = &PacketParserMockParsePacketBodyExpectation{}\n\t}\n\n\treturn mmParsePacketBody\n}", "func (mmAsBytes *mDigestHolderMockAsBytes) Expect() *mDigestHolderMockAsBytes {\n\tif mmAsBytes.mock.funcAsBytes != nil {\n\t\tmmAsBytes.mock.t.Fatalf(\"DigestHolderMock.AsBytes mock is already set by Set\")\n\t}\n\n\tif mmAsBytes.defaultExpectation == nil {\n\t\tmmAsBytes.defaultExpectation = &DigestHolderMockAsBytesExpectation{}\n\t}\n\n\treturn mmAsBytes\n}", "func (m *MockArticleLogic) EXPECT() *MockArticleLogicMockRecorder {\n\treturn m.recorder\n}", "func (mmKey *mIteratorMockKey) Expect() *mIteratorMockKey {\n\tif mmKey.mock.funcKey != nil {\n\t\tmmKey.mock.t.Fatalf(\"IteratorMock.Key mock is already set by Set\")\n\t}\n\n\tif mmKey.defaultExpectation == nil {\n\t\tmmKey.defaultExpectation = &IteratorMockKeyExpectation{}\n\t}\n\n\treturn mmKey\n}", "func (m *MockLoaderFactory) EXPECT() *MockLoaderFactoryMockRecorder {\n\treturn m.recorder\n}", "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "func (m *MockFactory) EXPECT() *MockFactoryMockRecorder {\n\treturn m.recorder\n}", "func (m *mOutboundMockCanAccept) Expect(p Inbound) *mOutboundMockCanAccept {\n\tm.mock.CanAcceptFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &OutboundMockCanAcceptExpectation{}\n\t}\n\tm.mainExpectation.input = &OutboundMockCanAcceptInput{p}\n\treturn m\n}", "func (m *MockPKG) EXPECT() *MockPKGMockRecorder {\n\treturn m.recorder\n}", "func (m *MockKeystore) EXPECT() *MockKeystoreMockRecorder {\n\treturn m.recorder\n}", "func (m *MockKeystore) EXPECT() *MockKeystoreMockRecorder {\n\treturn m.recorder\n}", "func (m *MockbucketDescriber) EXPECT() *MockbucketDescriberMockRecorder {\n\treturn m.recorder\n}", "func (m *mParcelMockType) Expect() *mParcelMockType {\n\tm.mock.TypeFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &ParcelMockTypeExpectation{}\n\t}\n\n\treturn m\n}", "func (m *MockStream) EXPECT() *MockStreamMockRecorder {\n\treturn m.recorder\n}", "func (mmExchange *mMDNSClientMockExchange) Expect(msg *mdns.Msg, address string) *mMDNSClientMockExchange {\n\tif mmExchange.mock.funcExchange != nil {\n\t\tmmExchange.mock.t.Fatalf(\"MDNSClientMock.Exchange mock is already set by Set\")\n\t}\n\n\tif mmExchange.defaultExpectation == nil {\n\t\tmmExchange.defaultExpectation = &MDNSClientMockExchangeExpectation{}\n\t}\n\n\tmmExchange.defaultExpectation.params = &MDNSClientMockExchangeParams{msg, address}\n\tfor _, e := range mmExchange.expectations {\n\t\tif minimock.Equal(e.params, mmExchange.defaultExpectation.params) {\n\t\t\tmmExchange.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmExchange.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmExchange\n}", "func (c Chkr) Expect(v validator, args ...interface{}) {\n\tif c.runTest(v, args...) {\n\t\tc.Fail()\n\t}\n}", "func (mmClone *mStorageMockClone) Expect(ctx context.Context, from insolar.PulseNumber, to insolar.PulseNumber, keepActual bool) *mStorageMockClone {\n\tif mmClone.mock.funcClone != nil {\n\t\tmmClone.mock.t.Fatalf(\"StorageMock.Clone mock is already set by Set\")\n\t}\n\n\tif mmClone.defaultExpectation == nil {\n\t\tmmClone.defaultExpectation = &StorageMockCloneExpectation{}\n\t}\n\n\tmmClone.defaultExpectation.params = &StorageMockCloneParams{ctx, from, to, keepActual}\n\tfor _, e := range mmClone.expectations {\n\t\tif minimock.Equal(e.params, mmClone.defaultExpectation.params) {\n\t\t\tmmClone.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmClone.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmClone\n}", "func (m *MockCodeGenerator) EXPECT() *MockCodeGeneratorMockRecorder {\n\treturn m.recorder\n}", "func (m *MockNodeAttestor) EXPECT() *MockNodeAttestorMockRecorder {\n\treturn m.recorder\n}", "func (m *MockNodeAttestor) EXPECT() *MockNodeAttestorMockRecorder {\n\treturn m.recorder\n}", "func (_m *MockIStream) EXPECT() *MockIStreamMockRecorder {\n\treturn _m.recorder\n}", "func (m *mOutboundMockGetEndpointType) Expect() *mOutboundMockGetEndpointType {\n\tm.mock.GetEndpointTypeFunc = nil\n\tm.expectationSeries = nil\n\n\tif m.mainExpectation == nil {\n\t\tm.mainExpectation = &OutboundMockGetEndpointTypeExpectation{}\n\t}\n\n\treturn m\n}", "func (m *MockAZInfoProvider) EXPECT() *MockAZInfoProviderMockRecorder {\n\treturn m.recorder\n}" ]
[ "0.5815729", "0.5713649", "0.56725484", "0.5639139", "0.5627882", "0.55727607", "0.5567769", "0.55297476", "0.55062264", "0.54872644", "0.5472953", "0.54643434", "0.54606736", "0.54418445", "0.5441045", "0.5406193", "0.5402902", "0.5389263", "0.53836423", "0.53836423", "0.5369924", "0.5367895", "0.53589964", "0.53413063", "0.53376186", "0.53287446", "0.53231686", "0.5314742", "0.5308035", "0.5308035", "0.5308035", "0.5308035", "0.5308035", "0.5308035", "0.5308035", "0.5308035", "0.53072083", "0.5302838", "0.5295401", "0.5295401", "0.529126", "0.5283626", "0.5282329", "0.52766293", "0.52737147", "0.5272989", "0.52669954", "0.52596724", "0.5257104", "0.525663", "0.5255936", "0.5249541", "0.52418935", "0.5241423", "0.5238754", "0.5235482", "0.5235266", "0.52273446", "0.5227298", "0.52224886", "0.5213678", "0.52124214", "0.521231", "0.521215", "0.5211707", "0.52087235", "0.5194519", "0.51902735", "0.5188351", "0.5187254", "0.518683", "0.5184083", "0.5182369", "0.51759773", "0.5173679", "0.51688933", "0.51669115", "0.5162592", "0.5160944", "0.5160924", "0.5160382", "0.514442", "0.5144323", "0.5144323", "0.5144323", "0.5144307", "0.5140136", "0.5134978", "0.5134978", "0.51349175", "0.51343846", "0.51304704", "0.51302874", "0.51297045", "0.5124025", "0.5122756", "0.5117379", "0.5117379", "0.51160645", "0.51149875", "0.5109187" ]
0.0
-1
ChannelProvider mocks base method
func (m *MockProviders) ChannelProvider() fab.ChannelProvider { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ChannelProvider") ret0, _ := ret[0].(fab.ChannelProvider) return ret0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MockClient) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}", "func (m *MockRConnectionInterface) Channel() (*amqp.Channel, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channel\")\n\tret0, _ := ret[0].(*amqp.Channel)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func NewMockChannelProvider(ctx fab.Context) (*MockChannelProvider, error) {\n\tchannels := make(map[string]fab.Channel)\n\n\t// Create a mock client with the mock channel\n\tcp := MockChannelProvider{\n\t\tctx,\n\t\tchannels,\n\t}\n\treturn &cp, nil\n}", "func (suite *KeeperTestSuite) TestChanCloseInit() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tchannelCap *capabilitytypes.Capability\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {\n\t\t\t// any non-nil values work for connections\n\t\t\tpath.EndpointA.ConnectionID = ibctesting.FirstConnectionID\n\t\t\tpath.EndpointB.ConnectionID = ibctesting.FirstConnectionID\n\n\t\t\tpath.EndpointA.ChannelID = ibctesting.FirstChannelID\n\t\t\tpath.EndpointB.ChannelID = ibctesting.FirstChannelID\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel state is CLOSED\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// close channel\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointA.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointA.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// create channel in init\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr = path.EndpointA.ChanOpenInit()\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\terr := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanCloseInit(\n\t\t\t\tsuite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, ibctesting.FirstChannelID, channelCap,\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func TestChannelStore(t *testing.T) {\n\t// mock Insert function\n\tfn := func(_ context.Context, v are_hub.Archetype) error {\n\t\treturn nil\n\t}\n\n\t// create mock repo and controller\n\trepo := &mock.ChannelRepo{InsertFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// create and embed a new channel\n\tmsport := are_hub.Channel{Name: \"Bentley Team M-Sport\", Password: \"abc123\"}\n\n\t// create a mock request\n\treq, e := http.NewRequest(http.MethodPost, \"/channel\", nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// update the request's context with the channel\n\treq = req.WithContext(msport.ToCtx(req.Context()))\n\n\t// create a response recorder and run the controller method\n\tw := httptest.NewRecorder()\n\te = controller.Store(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// check if the repo was hit\n\tif !repo.InsertCalled {\n\t\tt.Error(\"Did not call repo.Insert\")\n\t}\n\n\t// get the response\n\tres := w.Result()\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the returned channel\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\t// unmarshal the response body\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 msport.Name != received.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v\", msport, received)\n\t}\n}", "func (_m *KenContext) Channel() (*discordgo.Channel, error) {\n\tret := _m.Called()\n\n\tvar r0 *discordgo.Channel\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func() (*discordgo.Channel, error)); ok {\n\t\treturn rf()\n\t}\n\tif rf, ok := ret.Get(0).(func() *discordgo.Channel); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*discordgo.Channel)\n\t\t}\n\t}\n\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 TestConsumerChannel(t *testing.T) {\n\tconsumerTestWithCommits(t, \"Channel Consumer\", 0, true, eventTestChannelConsumer, nil)\n}", "func testChannel(t *testing.T, src, dst *Chain) {\n\tchans, err := src.QueryChannels(1, 1000)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 1, len(chans))\n\trequire.Equal(t, chans[0].GetOrdering().String(), \"ORDERED\")\n\trequire.Equal(t, chans[0].GetState().String(), \"OPEN\")\n\trequire.Equal(t, chans[0].GetCounterparty().GetChannelID(), dst.PathEnd.ChannelID)\n\trequire.Equal(t, chans[0].GetCounterparty().GetPortID(), dst.PathEnd.PortID)\n\n\th, err := src.Client.Status()\n\trequire.NoError(t, err)\n\n\tch, err := src.QueryChannel(h.SyncInfo.LatestBlockHeight)\n\trequire.NoError(t, err)\n\trequire.Equal(t, ch.Channel.GetOrdering().String(), \"ORDERED\")\n\trequire.Equal(t, ch.Channel.GetState().String(), \"OPEN\")\n\trequire.Equal(t, ch.Channel.GetCounterparty().GetChannelID(), dst.PathEnd.ChannelID)\n\trequire.Equal(t, ch.Channel.GetCounterparty().GetPortID(), dst.PathEnd.PortID)\n}", "func (suite *KeeperTestSuite) TestSetChannel() {\n\t// create client and connections on both chains\n\tpath := ibctesting.NewPath(suite.chainA, suite.chainB)\n\tsuite.coordinator.SetupConnections(path)\n\n\t// check for channel to be created on chainA\n\t_, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\tsuite.False(found)\n\n\tpath.SetChannelOrdered()\n\n\t// init channel\n\terr := path.EndpointA.ChanOpenInit()\n\tsuite.NoError(err)\n\n\tstoredChannel, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t// counterparty channel id is empty after open init\n\texpectedCounterparty := types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, \"\")\n\n\tsuite.True(found)\n\tsuite.Equal(types.INIT, storedChannel.State)\n\tsuite.Equal(types.ORDERED, storedChannel.Ordering)\n\tsuite.Equal(expectedCounterparty, storedChannel.Counterparty)\n}", "func (c *Provider) ChannelProvider() fab.ChannelProvider {\n\treturn c.channelProvider\n}", "func (_m *Knapsack) UpdateChannel() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}", "func newMockListener(endpoint net.Conn) *mockListener {\n \n c := make(chan net.Conn, 1)\n c <- endpoint\n listener := &mockListener{\n connChannel: c,\n serverEndpoint: endpoint,\n }\n return listener\n}", "func (m *MockCallResult) Channel() <-chan *Result {\n\targs := m.MethodCalled(\"Channel\")\n\n\tif resultChan := args.Get(0); resultChan != nil {\n\t\treturn resultChan.(<-chan *Result)\n\t}\n\n\treturn nil\n}", "func NewMockInterfaceProvider(managedInterfacesRegexp string, autoRefresh bool) (nt.InterfaceProvider,\n\tchan time.Time, error) {\n\tch := make(chan time.Time)\n\tip, err := nt.NewChanInterfaceProvider(ch, &MockInterfaceLister{}, managedInterfacesRegexp,\n\t\tautoRefresh)\n\treturn ip, ch, err\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 TestChannelIndex(t *testing.T) {\n\t// mock All function\n\tfn := func(_ context.Context) ([]are_hub.Channel, error) {\n\t\treturn channels, nil\n\t}\n\n\t// create the mock repo and controller\n\trepo := &mock.ChannelRepo{AllFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// create a mock request\n\treq, e := http.NewRequest(http.MethodGet, \"/channel\", nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// create a response recorder and run the controller method\n\tw := httptest.NewRecorder()\n\te = controller.Index(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// get the response\n\tres := w.Result()\n\n\t// check if the repo was hit\n\tif !repo.AllCalled {\n\t\tt.Error(\"Did not call repo.All\")\n\t}\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the body and confirm all data 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\tvar received []are_hub.Channel\n\te = json.Unmarshal(body, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tlr := len(received)\n\tlc := len(channels)\n\n\t// check that all channels were returned\n\tif lr != lc {\n\t\tt.Fatalf(\"Expected: %d channels. Actual: %d.\", lc, lr)\n\t}\n\n\t// loop and ensure the data is correct\n\tfor i := 0; i < lr; i++ {\n\t\tif received[i].Name != channels[i].Name {\n\t\t\tt.Fatalf(\"Expected: %s. Actual: %s.\", channels[i].Name, received[i].Name)\n\t\t}\n\t}\n}", "func (m *MockFullNode) PaychGet(arg0 context.Context, arg1, arg2 address.Address, arg3 big.Int) (*types0.ChannelInfo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PaychGet\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(*types0.ChannelInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestChannelFactoryPattern(t *testing.T) {\n\tsuck(pump(5))\n\ttime.Sleep(1e9)\n}", "func (m *MockAMQPChannel) NotifyCancel(arg0 chan string) chan string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NotifyCancel\", arg0)\n\tret0, _ := ret[0].(chan string)\n\treturn ret0\n}", "func (m *MockKubeCoreCache) Subscribe() <-chan struct{} {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subscribe\")\n\tret0, _ := ret[0].(<-chan struct{})\n\treturn ret0\n}", "func (suite *KeeperTestSuite) TestChanOpenInit() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tfeatures []string\n\t\tportCap *capabilitytypes.Capability\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tfeatures = []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"}\n\t\t\tsuite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainA.GetPortCapability(ibctesting.MockPort)\n\t\t}, true},\n\t\t{\"channel already exists\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t}, false},\n\t\t{\"connection doesn't exist\", func() {\n\t\t\t// any non-empty values\n\t\t\tpath.EndpointA.ConnectionID = \"connection-0\"\n\t\t\tpath.EndpointB.ConnectionID = \"connection-0\"\n\t\t}, false},\n\t\t{\"capability is incorrect\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tfeatures = []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"}\n\t\t\tportCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t\t{\"connection version not negotiated\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\n\t\t\t// modify connA versions\n\t\t\tconn := path.EndpointA.GetConnection()\n\n\t\t\tversion := connectiontypes.NewVersion(\"2\", []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"})\n\t\t\tconn.Versions = append(conn.Versions, version)\n\n\t\t\tsuite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(\n\t\t\t\tsuite.chainA.GetContext(),\n\t\t\t\tpath.EndpointA.ConnectionID, conn,\n\t\t\t)\n\t\t\tfeatures = []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"}\n\t\t\tsuite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainA.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t\t{\"connection does not support ORDERED channels\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\n\t\t\t// modify connA versions to only support UNORDERED channels\n\t\t\tconn := path.EndpointA.GetConnection()\n\n\t\t\tversion := connectiontypes.NewVersion(\"1\", []string{\"ORDER_UNORDERED\"})\n\t\t\tconn.Versions = []*connectiontypes.Version{version}\n\n\t\t\tsuite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(\n\t\t\t\tsuite.chainA.GetContext(),\n\t\t\t\tpath.EndpointA.ConnectionID, conn,\n\t\t\t)\n\t\t\t// NOTE: Opening UNORDERED channels is still expected to pass but ORDERED channels should fail\n\t\t\tfeatures = []string{\"ORDER_UNORDERED\"}\n\t\t\tsuite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainA.GetPortCapability(ibctesting.MockPort)\n\t\t}, true},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\t// run test for all types of ordering\n\t\t\tfor _, order := range []types.Order{types.UNORDERED, types.ORDERED} {\n\t\t\t\tsuite.SetupTest() // reset\n\t\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\t\t\t\tpath.EndpointA.ChannelConfig.Order = order\n\t\t\t\tpath.EndpointB.ChannelConfig.Order = order\n\n\t\t\t\ttc.malleate()\n\n\t\t\t\tcounterparty := types.NewCounterparty(ibctesting.MockPort, ibctesting.FirstChannelID)\n\n\t\t\t\tchannelID, cap, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanOpenInit(\n\t\t\t\t\tsuite.chainA.GetContext(), path.EndpointA.ChannelConfig.Order, []string{path.EndpointA.ConnectionID},\n\t\t\t\t\tpath.EndpointA.ChannelConfig.PortID, portCap, counterparty, path.EndpointA.ChannelConfig.Version,\n\t\t\t\t)\n\n\t\t\t\t// check if order is supported by channel to determine expected behaviour\n\t\t\t\torderSupported := false\n\t\t\t\tfor _, f := range features {\n\t\t\t\t\tif f == order.String() {\n\t\t\t\t\t\torderSupported = true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Testcase must have expectedPass = true AND channel order supported before\n\t\t\t\t// asserting the channel handshake initiation succeeded\n\t\t\t\tif tc.expPass && orderSupported {\n\t\t\t\t\tsuite.Require().NoError(err)\n\t\t\t\t\tsuite.Require().NotNil(cap)\n\t\t\t\t\tsuite.Require().Equal(types.FormatChannelIdentifier(0), channelID)\n\n\t\t\t\t\tchanCap, ok := suite.chainA.App.GetScopedIBCKeeper().GetCapability(\n\t\t\t\t\t\tsuite.chainA.GetContext(),\n\t\t\t\t\t\thost.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, channelID),\n\t\t\t\t\t)\n\t\t\t\t\tsuite.Require().True(ok, \"could not retrieve channel capability after successful ChanOpenInit\")\n\t\t\t\t\tsuite.Require().Equal(chanCap.String(), cap.String(), \"channel capability is not correct\")\n\t\t\t\t} else {\n\t\t\t\t\tsuite.Require().Error(err)\n\t\t\t\t\tsuite.Require().Nil(cap)\n\t\t\t\t\tsuite.Require().Equal(\"\", channelID)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func New(fabricProvider api.FabricProvider) (*ChannelProvider, error) {\n\tcp := ChannelProvider{fabricProvider: fabricProvider}\n\treturn &cp, nil\n}", "func (m *MockProvider) Run(arg0 <-chan struct{}) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Run\", arg0)\n}", "func (m *MockWebsocketClientStore) Channels(clientID wspubsub.UUID) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channels\", clientID)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (a *MockAction) ChannelClient() (*channel.Client, error) {\n\tpanic(\"not implemented\")\n}", "func (m *MockProvider) Provide(arg0 string) blobclient.Client {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Provide\", arg0)\n\tret0, _ := ret[0].(blobclient.Client)\n\treturn ret0\n}", "func (suite KeeperTestSuite) TestGetAllChannels() {\n\tpath := ibctesting.NewPath(suite.chainA, suite.chainB)\n\tsuite.coordinator.Setup(path)\n\t// channel0 on first connection on chainA\n\tcounterparty0 := types.Counterparty{\n\t\tPortId: path.EndpointB.ChannelConfig.PortID,\n\t\tChannelId: path.EndpointB.ChannelID,\n\t}\n\n\t// path1 creates a second channel on first connection on chainA\n\tpath1 := ibctesting.NewPath(suite.chainA, suite.chainB)\n\tpath1.SetChannelOrdered()\n\tpath1.EndpointA.ClientID = path.EndpointA.ClientID\n\tpath1.EndpointB.ClientID = path.EndpointB.ClientID\n\tpath1.EndpointA.ConnectionID = path.EndpointA.ConnectionID\n\tpath1.EndpointB.ConnectionID = path.EndpointB.ConnectionID\n\n\tsuite.coordinator.CreateMockChannels(path1)\n\tcounterparty1 := types.Counterparty{\n\t\tPortId: path1.EndpointB.ChannelConfig.PortID,\n\t\tChannelId: path1.EndpointB.ChannelID,\n\t}\n\n\tpath2 := ibctesting.NewPath(suite.chainA, suite.chainB)\n\tsuite.coordinator.SetupConnections(path2)\n\n\t// path2 creates a second channel on chainA\n\terr := path2.EndpointA.ChanOpenInit()\n\tsuite.Require().NoError(err)\n\n\t// counterparty channel id is empty after open init\n\tcounterparty2 := types.Counterparty{\n\t\tPortId: path2.EndpointB.ChannelConfig.PortID,\n\t\tChannelId: \"\",\n\t}\n\n\tchannel0 := types.NewChannel(\n\t\ttypes.OPEN, types.UNORDERED,\n\t\tcounterparty0, []string{path.EndpointA.ConnectionID}, path.EndpointA.ChannelConfig.Version,\n\t)\n\tchannel1 := types.NewChannel(\n\t\ttypes.OPEN, types.ORDERED,\n\t\tcounterparty1, []string{path1.EndpointA.ConnectionID}, path1.EndpointA.ChannelConfig.Version,\n\t)\n\tchannel2 := types.NewChannel(\n\t\ttypes.INIT, types.UNORDERED,\n\t\tcounterparty2, []string{path2.EndpointA.ConnectionID}, path2.EndpointA.ChannelConfig.Version,\n\t)\n\n\texpChannels := []types.IdentifiedChannel{\n\t\ttypes.NewIdentifiedChannel(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel0),\n\t\ttypes.NewIdentifiedChannel(path1.EndpointA.ChannelConfig.PortID, path1.EndpointA.ChannelID, channel1),\n\t\ttypes.NewIdentifiedChannel(path2.EndpointA.ChannelConfig.PortID, path2.EndpointA.ChannelID, channel2),\n\t}\n\n\tctxA := suite.chainA.GetContext()\n\n\tchannels := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetAllChannels(ctxA)\n\tsuite.Require().Len(channels, len(expChannels))\n\tsuite.Require().Equal(expChannels, channels)\n}", "func (m *MockFullNode) MpoolSub(arg0 context.Context) (<-chan types0.MpoolUpdate, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MpoolSub\", arg0)\n\tret0, _ := ret[0].(<-chan types0.MpoolUpdate)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockAcceptor) GetConnChan() chan net.Conn {\n\tret := m.ctrl.Call(m, \"GetConnChan\")\n\tret0, _ := ret[0].(chan net.Conn)\n\treturn ret0\n}", "func TestChannelClientBasic(t *testing.T) {\n\tc := make(chan *http.Response, 10)\n\tclient := cloudtest.NewChannelClient(c)\n\n\tresp := &http.Response{}\n\tresp.StatusCode = http.StatusOK\n\tresp.Status = \"OK\"\n\tc <- resp\n\tresp, err := client.Get(\"http://foobar\")\n\tlog.Printf(\"%v\\n\", resp)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tt.Error(\"Response should be OK: \", resp.Status)\n\t}\n}", "func TestChannels(t *testing.T) {\n\ttc := testutil.SystemTest(t)\n\tbuf := &bytes.Buffer{}\n\n\t// Test setup\n\n\t// Stop and delete the default channel if it exists\n\tif err := getChannel(buf, tc.ProjectID, location, channelID); err == nil {\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := stopChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\t\t// Ignore the error when the channel is already stopped\n\t\t\t}\n\t\t})\n\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := deleteChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\t\tr.Errorf(\"deleteChannel got err: %v\", err)\n\t\t\t}\n\t\t})\n\t}\n\n\t// Delete the default input if it exists\n\tif err := getInput(buf, tc.ProjectID, location, inputID); err == nil {\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := deleteInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\t\tr.Errorf(\"deleteInput got err: %v\", err)\n\t\t\t}\n\t\t})\n\t}\n\tbuf.Reset()\n\n\t// Create a new input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tinputName := fmt.Sprintf(\"projects/%s/locations/%s/inputs/%s\", tc.ProjectID, location, inputID)\n\t\tif err := createInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\tr.Errorf(\"createInput got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, inputName) {\n\t\t\tr.Errorf(\"createInput got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, inputName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Tests\n\n\t// Create a new channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tchannelName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s\", tc.ProjectID, location, channelID)\n\t\tif err := createChannel(buf, tc.ProjectID, location, channelID, inputID, outputURI); err != nil {\n\t\t\tr.Errorf(\"createChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, channelName) {\n\t\t\tr.Errorf(\"createChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, channelName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// List the channels for a given location.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tchannelName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s\", tc.ProjectID, location, channelID)\n\t\tif err := listChannels(buf, tc.ProjectID, location); err != nil {\n\t\t\tr.Errorf(\"listChannels got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, channelName) {\n\t\t\tr.Errorf(\"listChannels got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, channelName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Update an existing channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tchannelName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s\", tc.ProjectID, location, channelID)\n\t\tif err := updateChannel(buf, tc.ProjectID, location, channelID, inputID); err != nil {\n\t\t\tr.Errorf(\"updateChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, channelName) {\n\t\t\tr.Errorf(\"updateChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, channelName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Get the updated channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tchannelName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s\", tc.ProjectID, location, channelID)\n\t\tif err := getChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"getChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, channelName) {\n\t\t\tr.Errorf(\"getChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, channelName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Start the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := startChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"startChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, startChannelResponse) {\n\t\t\tr.Errorf(\"startChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, startChannelResponse)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Stop the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := stopChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"stopChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, stopChannelResponse) {\n\t\t\tr.Errorf(\"stopChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, stopChannelResponse)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Delete the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"deleteChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteChannelResponse) {\n\t\t\tr.Errorf(\"deleteChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteChannelResponse)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Create a new channel with backup input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tchannelName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s\", tc.ProjectID, location, channelID)\n\t\tif err := createChannelWithBackupInput(buf, tc.ProjectID, location, channelID, inputID, backupInputID, outputURI); err != nil {\n\t\t\tr.Errorf(\"createChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, channelName) {\n\t\t\tr.Errorf(\"createChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, channelName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Clean up\n\n\t// Delete the channel with backup input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"deleteChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteChannelResponse) {\n\t\t\tr.Errorf(\"deleteChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteChannelResponse)\n\t\t}\n\t})\n\n\t// Delete the input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\tr.Errorf(\"deleteInput got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteInputResponse) {\n\t\t\tr.Errorf(\"deleteInput got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteInputResponse)\n\t\t}\n\t})\n\n\t// Delete the backup input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteInput(buf, tc.ProjectID, location, backupInputID); err != nil {\n\t\t\tr.Errorf(\"deleteInput got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteInputResponse) {\n\t\t\tr.Errorf(\"deleteInput got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteInputResponse)\n\t\t}\n\t})\n\tt.Logf(\"\\nTestChannels() completed\\n\")\n}", "func (suite *KeeperTestSuite) TestChanOpenAck() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tcounterpartyChannelID string\n\t\tchannelCap *capabilitytypes.Capability\n\t\theightDiff uint64\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, true},\n\t\t{\"success with empty stored counterparty channel ID\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// set the channel's counterparty channel identifier to empty string\n\t\t\tchannel := path.EndpointA.GetChannel()\n\t\t\tchannel.Counterparty.ChannelId = \"\"\n\n\t\t\t// use a different channel identifier\n\t\t\tcounterpartyChannelID = path.EndpointB.ChannelID\n\n\t\t\tsuite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {}, false},\n\t\t{\"channel state is not INIT or TRYOPEN\", func() {\n\t\t\t// create fully open channels on both chains\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointA.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointA.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// create channel in init\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr = path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"consensus state not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\theightDiff = 3 // consensus state doesn't exist at this height\n\t\t}, false},\n\t\t{\"invalid counterparty channel identifier\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tcounterpartyChannelID = \"otheridentifier\"\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel verification failed\", func() {\n\t\t\t// chainB is INIT, chainA in TRYOPEN\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointB.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tpath.EndpointB.ChanOpenTry()\n\n\t\t\tchannelCap = capabilitytypes.NewCapability(6)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\tcounterpartyChannelID = \"\" // must be explicitly changed in malleate\n\t\t\theightDiff = 0 // must be explicitly changed\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\tif counterpartyChannelID == \"\" {\n\t\t\t\tcounterpartyChannelID = ibctesting.FirstChannelID\n\t\t\t}\n\n\t\t\tif path.EndpointA.ClientID != \"\" {\n\t\t\t\t// ensure client is up to date\n\t\t\t\terr := path.EndpointA.UpdateClient()\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t}\n\n\t\t\tchannelKey := host.ChannelKey(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tproof, proofHeight := suite.chainB.QueryProof(channelKey)\n\n\t\t\terr := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanOpenAck(\n\t\t\t\tsuite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channelCap, path.EndpointB.ChannelConfig.Version, counterpartyChannelID,\n\t\t\t\tproof, malleateHeight(proofHeight, heightDiff),\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func (_m *ISession) Channel(channelID string, options ...discordgo.RequestOption) (*discordgo.Channel, error) {\n\t_va := make([]interface{}, len(options))\n\tfor _i := range options {\n\t\t_va[_i] = options[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, channelID)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *discordgo.Channel\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(string, ...discordgo.RequestOption) (*discordgo.Channel, error)); ok {\n\t\treturn rf(channelID, options...)\n\t}\n\tif rf, ok := ret.Get(0).(func(string, ...discordgo.RequestOption) *discordgo.Channel); ok {\n\t\tr0 = rf(channelID, options...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*discordgo.Channel)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(string, ...discordgo.RequestOption) error); ok {\n\t\tr1 = rf(channelID, options...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func TestBasicMethodChannelStringCodecHandle(t *testing.T) {\n\tcodec := StringCodec{}\n\tmessenger := NewTestingBinaryMessenger()\n\tchannel := NewBasicMessageChannel(messenger, \"ch\", codec)\n\tchannel.HandleFunc(func(message interface{}) (reply interface{}, err error) {\n\t\tmessageString, ok := message.(string)\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"message is invalid type, expected string\")\n\t\t}\n\t\treply = messageString + \" world\"\n\t\treturn reply, nil\n\t})\n\tencodedMessage, err := codec.EncodeMessage(\"hello\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to encode message: %v\", err)\n\t}\n\tencodedReply, err := messenger.MockSend(\"ch\", encodedMessage)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treply, err := codec.DecodeMessage(encodedReply)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to decode reply: %v\", err)\n\t}\n\tt.Log(spew.Sdump(reply))\n\treplyString, ok := reply.(string)\n\tif !ok {\n\t\tt.Fatal(\"reply is invalid type, expected string\")\n\t}\n\tEqual(t, \"hello world\", replyString)\n}", "func (m *MockSource) TcpSessionChan() chan *types.TcpSession {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TcpSessionChan\")\n\tret0, _ := ret[0].(chan *types.TcpSession)\n\treturn ret0\n}", "func (_m *MockMessageProducer) ProduceChannel() chan *kafka.Message {\n\tret := _m.Called()\n\n\tvar r0 chan *kafka.Message\n\tif rf, ok := ret.Get(0).(func() chan *kafka.Message); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(chan *kafka.Message)\n\t\t}\n\t}\n\n\treturn r0\n}", "func TestBasicMethodChannelStringCodecSend(t *testing.T) {\n\tcodec := StringCodec{}\n\tmessenger := NewTestingBinaryMessenger()\n\tmessenger.MockSetChannelHandler(\"ch\", func(encodedMessage []byte, r ResponseSender) error {\n\t\tmessage, err := codec.DecodeMessage(encodedMessage)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to decode message\")\n\t\t}\n\t\tmessageString, ok := message.(string)\n\t\tif !ok {\n\t\t\treturn errors.New(\"message is invalid type, expected string\")\n\t\t}\n\t\treply := messageString + \" world\"\n\t\tencodedReply, err := codec.EncodeMessage(reply)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to encode message\")\n\t\t}\n\t\tr.Send(encodedReply)\n\t\treturn nil\n\t})\n\tchannel := NewBasicMessageChannel(messenger, \"ch\", codec)\n\treply, err := channel.SendWithReply(\"hello\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Log(spew.Sdump(reply))\n\treplyString, ok := reply.(string)\n\tif !ok {\n\t\tt.Fatal(\"reply is invalid type, expected string\")\n\t}\n\tEqual(t, \"hello world\", replyString)\n}", "func (_m *Socket) ReadChannel() <-chan *packet.Packet {\n\tret := _m.Called()\n\n\tvar r0 <-chan *packet.Packet\n\tif rf, ok := ret.Get(0).(func() <-chan *packet.Packet); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(<-chan *packet.Packet)\n\t\t}\n\t}\n\n\treturn r0\n}", "func (m *mockedChannel) GetRequestChannel() chan<- *govppapi.VppRequest {\n\treturn m.channel.GetRequestChannel()\n}", "func (m *MockChoriaProvider) Connector() inter.Connector {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Connector\")\n\tret0, _ := ret[0].(inter.Connector)\n\treturn ret0\n}", "func (_m *Knapsack) SetUpdateChannel(channel string) error {\n\tret := _m.Called(channel)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(channel)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "func (_m *Socket) WriteChannel() chan<- *packet.Packet {\n\tret := _m.Called()\n\n\tvar r0 chan<- *packet.Packet\n\tif rf, ok := ret.Get(0).(func() chan<- *packet.Packet); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(chan<- *packet.Packet)\n\t\t}\n\t}\n\n\treturn r0\n}", "func (m *MockWebsocketClientStore) Count(channels ...string) int {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range channels {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Count\", varargs...)\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}", "func (_m *ChannelRepository) UpdateChannel(channel *model.Channel) error {\n\tret := _m.Called(channel)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*model.Channel) error); ok {\n\t\tr0 = rf(channel)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "func TestGetChannel(t *testing.T) {\n\tclearTable()\n\taddChannel(1)\n\t// Generate JWT for authorization.\n\tvalidToken, err := auth.GenerateJWT()\n\tif err != nil {\n\t\tt.Error(\"Failed to generate token\")\n\t}\n\n\treq, _ := http.NewRequest(\"GET\", \"/api/channel/\"+channelTestID.String(), nil)\n\t// Add \"Token\" header to request with generated token.\n\treq.Header.Add(\"Token\", validToken)\n\tresponse := executeRequest(req)\n\n\tcheckResponseCode(t, http.StatusOK, response.Code)\n}", "func (suite *KeeperTestSuite) TestChanOpenTry() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tpreviousChannelID string\n\t\tportCap *capabilitytypes.Capability\n\t\theightDiff uint64\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, true},\n\t\t{\"success with crossing hello\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr := suite.coordinator.ChanOpenInitOnBothChains(path)\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tpreviousChannelID = path.EndpointB.ChannelID\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, true},\n\t\t{\"previous channel with invalid state\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\n\t\t\t// make previous channel have wrong ordering\n\t\t\tpath.EndpointA.ChanOpenInit()\n\t\t}, false},\n\t\t{\"connection doesn't exist\", func() {\n\t\t\tpath.EndpointA.ConnectionID = ibctesting.FirstConnectionID\n\t\t\tpath.EndpointB.ConnectionID = ibctesting.FirstConnectionID\n\n\t\t\t// pass capability check\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\t\t\t// pass capability check\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\n\t\t\terr := path.EndpointB.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, false},\n\t\t{\"consensus state not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\n\t\t\theightDiff = 3 // consensus state doesn't exist at this height\n\t\t}, false},\n\t\t{\"channel verification failed\", func() {\n\t\t\t// not creating a channel on chainA will result in an invalid proof of existence\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t\t{\"port capability not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\tportCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t\t{\"connection version not negotiated\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\t// modify connB versions\n\t\t\tconn := path.EndpointB.GetConnection()\n\n\t\t\tversion := connectiontypes.NewVersion(\"2\", []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"})\n\t\t\tconn.Versions = append(conn.Versions, version)\n\n\t\t\tsuite.chainB.App.GetIBCKeeper().ConnectionKeeper.SetConnection(\n\t\t\t\tsuite.chainB.GetContext(),\n\t\t\t\tpath.EndpointB.ConnectionID, conn,\n\t\t\t)\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t\t{\"connection does not support ORDERED channels\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\t// modify connA versions to only support UNORDERED channels\n\t\t\tconn := path.EndpointA.GetConnection()\n\n\t\t\tversion := connectiontypes.NewVersion(\"1\", []string{\"ORDER_UNORDERED\"})\n\t\t\tconn.Versions = []*connectiontypes.Version{version}\n\n\t\t\tsuite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(\n\t\t\t\tsuite.chainA.GetContext(),\n\t\t\t\tpath.EndpointA.ConnectionID, conn,\n\t\t\t)\n\t\t\tsuite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainA.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\theightDiff = 0 // must be explicitly changed in malleate\n\t\t\tpreviousChannelID = \"\"\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\tif path.EndpointB.ClientID != \"\" {\n\t\t\t\t// ensure client is up to date\n\t\t\t\terr := path.EndpointB.UpdateClient()\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t}\n\n\t\t\tcounterparty := types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\n\t\t\tchannelKey := host.ChannelKey(counterparty.PortId, counterparty.ChannelId)\n\t\t\tproof, proofHeight := suite.chainA.QueryProof(channelKey)\n\n\t\t\tchannelID, cap, err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanOpenTry(\n\t\t\t\tsuite.chainB.GetContext(), types.ORDERED, []string{path.EndpointB.ConnectionID},\n\t\t\t\tpath.EndpointB.ChannelConfig.PortID, previousChannelID, portCap, counterparty, path.EndpointB.ChannelConfig.Version, path.EndpointA.ChannelConfig.Version,\n\t\t\t\tproof, malleateHeight(proofHeight, heightDiff),\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t\tsuite.Require().NotNil(cap)\n\n\t\t\t\tchanCap, ok := suite.chainB.App.GetScopedIBCKeeper().GetCapability(\n\t\t\t\t\tsuite.chainB.GetContext(),\n\t\t\t\t\thost.ChannelCapabilityPath(path.EndpointB.ChannelConfig.PortID, channelID),\n\t\t\t\t)\n\t\t\t\tsuite.Require().True(ok, \"could not retrieve channel capapbility after successful ChanOpenTry\")\n\t\t\t\tsuite.Require().Equal(chanCap.String(), cap.String(), \"channel capability is not correct\")\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func TestChannelEvents(t *testing.T) {\n\ttc := testutil.SystemTest(t)\n\tbuf := &bytes.Buffer{}\n\n\t// Test setup\n\n\t// Stop and delete the default channel if it exists\n\tif err := getChannel(buf, tc.ProjectID, location, channelID); err == nil {\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := stopChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\t\t// Ignore the error when the channel is already stopped.\n\t\t\t}\n\t\t})\n\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := deleteChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\t\tr.Errorf(\"deleteChannel got err: %v\", err)\n\t\t\t}\n\t\t})\n\t}\n\n\t// Delete the default input if it exists\n\tif err := getInput(buf, tc.ProjectID, location, inputID); err == nil {\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := deleteInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\t\tr.Errorf(\"deleteInput got err: %v\", err)\n\t\t\t}\n\t\t})\n\t}\n\n\t// Create a new input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tinputName := fmt.Sprintf(\"projects/%s/locations/%s/inputs/%s\", tc.ProjectID, location, inputID)\n\t\tif err := createInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\tr.Errorf(\"createInput got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, inputName) {\n\t\t\tr.Errorf(\"createInput got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, inputName)\n\t\t}\n\t})\n\n\t// Create a new channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tchannelName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s\", tc.ProjectID, location, channelID)\n\t\tif err := createChannel(buf, tc.ProjectID, location, channelID, inputID, outputURI); err != nil {\n\t\t\tr.Errorf(\"createChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, channelName) {\n\t\t\tr.Errorf(\"createChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, channelName)\n\t\t}\n\t})\n\n\t// Start the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := startChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"startChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, startChannelResponse) {\n\t\t\tr.Errorf(\"startChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, startChannelResponse)\n\t\t}\n\t})\n\n\tbuf.Reset()\n\n\t// Tests\n\n\t// Create a new channel event.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\teventName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s/events/%s\", tc.ProjectID, location, channelID, eventID)\n\t\tif err := createChannelEvent(buf, tc.ProjectID, location, channelID, eventID); err != nil {\n\t\t\tr.Errorf(\"createChannelEvent got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, eventName) {\n\t\t\tr.Errorf(\"createChannelEvent got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, eventName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// List the channel events for a given channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\teventName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s/events/%s\", tc.ProjectID, location, channelID, eventID)\n\t\tif err := listChannelEvents(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"listChannelEvents got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, eventName) {\n\t\t\tr.Errorf(\"listChannelEvents got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, eventName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Get the channel event.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\teventName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s/events/%s\", tc.ProjectID, location, channelID, eventID)\n\t\tif err := getChannelEvent(buf, tc.ProjectID, location, channelID, eventID); err != nil {\n\t\t\tr.Errorf(\"getChannelEvent got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, eventName) {\n\t\t\tr.Errorf(\"getChannelEvent got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, eventName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Delete the channel event.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteChannelEvent(buf, tc.ProjectID, location, channelID, eventID); err != nil {\n\t\t\tr.Errorf(\"deleteChannelEvent got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteChannelEventResponse) {\n\t\t\tr.Errorf(\"deleteChannelEvent got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteChannelEventResponse)\n\t\t}\n\t})\n\n\t// Clean up\n\n\t// Stop the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := stopChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"stopChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, stopChannelResponse) {\n\t\t\tr.Errorf(\"stopChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, stopChannelResponse)\n\t\t}\n\t})\n\n\t// Delete the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"deleteChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteChannelResponse) {\n\t\t\tr.Errorf(\"deleteChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteChannelResponse)\n\t\t}\n\t})\n\n\t// Delete the input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\tr.Errorf(\"deleteInput got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteInputResponse) {\n\t\t\tr.Errorf(\"deleteInput got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteInputResponse)\n\t\t}\n\t})\n\tt.Logf(\"\\nTestChannelEvents() completed\\n\")\n}", "func (m *MockCall) ResultChan() chan hrpc.RPCResult {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ResultChan\")\n\tret0, _ := ret[0].(chan hrpc.RPCResult)\n\treturn ret0\n}", "func (_m *WebSocketServer) GetChannels(topic string) (chan<- interface{}, chan<- interface{}, <-chan error, <-chan struct{}) {\n\tret := _m.Called(topic)\n\n\tvar r0 chan<- interface{}\n\tif rf, ok := ret.Get(0).(func(string) chan<- interface{}); ok {\n\t\tr0 = rf(topic)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(chan<- interface{})\n\t\t}\n\t}\n\n\tvar r1 chan<- interface{}\n\tif rf, ok := ret.Get(1).(func(string) chan<- interface{}); ok {\n\t\tr1 = rf(topic)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(chan<- interface{})\n\t\t}\n\t}\n\n\tvar r2 <-chan error\n\tif rf, ok := ret.Get(2).(func(string) <-chan error); ok {\n\t\tr2 = rf(topic)\n\t} else {\n\t\tif ret.Get(2) != nil {\n\t\t\tr2 = ret.Get(2).(<-chan error)\n\t\t}\n\t}\n\n\tvar r3 <-chan struct{}\n\tif rf, ok := ret.Get(3).(func(string) <-chan struct{}); ok {\n\t\tr3 = rf(topic)\n\t} else {\n\t\tif ret.Get(3) != nil {\n\t\t\tr3 = ret.Get(3).(<-chan struct{})\n\t\t}\n\t}\n\n\treturn r0, r1, r2, r3\n}", "func (_m *ChannelStore) Update(channel *model.Channel) (*model.Channel, error) {\n\tret := _m.Called(channel)\n\n\tvar r0 *model.Channel\n\tif rf, ok := ret.Get(0).(func(*model.Channel) *model.Channel); ok {\n\t\tr0 = rf(channel)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*model.Channel)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*model.Channel) error); ok {\n\t\tr1 = rf(channel)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\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 (m *MockCache) Watch(ch chan<- stream.Event, replay bool) (stream.Context, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Watch\", ch, replay)\n\tret0, _ := ret[0].(stream.Context)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestChannelShow(t *testing.T) {\n\t// expecting this channel\n\twrt := channels[0]\n\n\t// create the mock repo and controller\n\trepo := &mock.ChannelRepo{FindIDFunc: 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.MethodGet, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed the channel ID in the request's\n\t// context (necessary for controller.Show to function)\n\tuf.EmbedParams(req, httprouter.Param{Key: \"id\", Value: \"1\"})\n\n\t// create a response recorder and call the show method\n\tw := httptest.NewRecorder()\n\te = controller.Show(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// check the repo was hit\n\tif !repo.FindIDCalled {\n\t\tt.Error(\"Did not call repo.FindID\")\n\t}\n\n\tres := w.Result()\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// read and unmarshal the body\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\t// compare the expected and received channels\n\tif received.Name != wrt.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v.\", wrt, received)\n\t}\n\n\t// check show returns 404 for an invalid ID\n\tp = httprouter.Param{Key: \"id\", Value: \"-1\"}\n\ttest404(t, http.MethodGet, \"/channel/\"+p.Value, nil, controller.Show, p)\n}", "func (m *MockClientStreamConnection) Dispatch(buffer buffer.IoBuffer) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Dispatch\", buffer)\n}", "func (m *MockAMQPChan) Close() {\n\tm.ctrl.Call(m, \"Close\")\n}", "func (m *MockWebsocketClientStore) Find(fn wspubsub.IterateFunc, channels ...string) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{fn}\n\tfor _, a := range channels {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Find\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (res channelBase) Channel() *types.Channel {\n\treturn res.channel\n}", "func (m *mockedChannel) GetReplyChannel() <-chan *govppapi.VppReply {\n\treturn m.channel.GetReplyChannel()\n}", "func (m *MockStreamConnection) Dispatch(buffer buffer.IoBuffer) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Dispatch\", buffer)\n}", "func TestCollateralizedChannels(t *testing.T) {\n\trequire := require.New(t)\n\n\t// Accounts\n\taccountFunding := []struct {\n\t\tPrivateKey string\n\t\tBalanceEth uint\n\t}{\n\t\t{\"0x50b4713b4ba55b6fbcb826ae04e66c03a12fc62886a90ca57ab541959337e897\", 10}, // Contract Deployer\n\t\t{\"0x1af2e950272dd403de7a5760d41c6e44d92b6d02797e51810795ff03cc2cda4f\", 100}, // Client1\n\t\t{\"0xf63d7d8e930bccd74e93cf5662fde2c28fd8be95edb70c73f1bdd863d07f412e\", 200}, // Client2\n\t}\n\n\t// Ganache config\n\tganacheCmd := os.Getenv(\"GANACHE_CMD\")\n\tif len(ganacheCmd) == 0 {\n\t\tganacheCmd = \"ganache-cli\"\n\t}\n\tganacheCfg := ganache.GanacheConfig{\n\t\tCmd: ganacheCmd,\n\t\tHost: \"127.0.0.1\",\n\t\tPort: 8545,\n\t\tBlockTime: 1 * time.Second,\n\t\tFunding: accountFunding,\n\t\tStartupTime: 3 * time.Second,\n\t}\n\n\t// More test parameters\n\tvar (\n\t\tdefaultContextTimeout = 30 * time.Second\n\t\tcollateralWithdrawalDelay = 10 * ganacheCfg.BlockTime\n\t\thostClient1 = \"127.0.0.1:8546\"\n\t\thostClient2 = \"127.0.0.1:8547\"\n\t\tcollateralClient1 = eth.EthToWei(big.NewFloat(50))\n\t\tpayment1Client1ToClient2 = eth.EthToWei(big.NewFloat(5))\n\t\tchannelFundingClient1 = eth.EthToWei(big.NewFloat(25))\n\t\tpayment2Client1ToClient2 = eth.EthToWei(big.NewFloat(10))\n\t)\n\n\t// Start ganache blockchain with prefunded accounts\n\tlog.Print(\"Starting local blockchain...\")\n\tganache, err := ganache.StartGanacheWithPrefundedAccounts(ganacheCfg)\n\trequire.NoError(err, \"starting ganache\")\n\tdefer ganache.Shutdown()\n\n\t// Deploy contracts\n\tlog.Print(\"Deploying contracts...\")\n\tnodeURL := fmt.Sprintf(\"ws://%s:%d\", ganacheCfg.Host, ganacheCfg.Port)\n\tdeploymentKey := ganache.Accounts[0].PrivateKey\n\tcontracts, err := deployContracts(nodeURL, deploymentKey, defaultContextTimeout, collateralWithdrawalDelay)\n\trequire.NoError(err, \"deploying contracts\")\n\n\t// Helper function for client setup\n\tgenClientDef := func(privateKey *ecdsa.PrivateKey, host string, peerAddress common.Address, peerHost string) client.ClientConfig {\n\t\treturn client.ClientConfig{\n\t\t\tClientConfig: perun.ClientConfig{\n\t\t\t\tPrivateKey: privateKey,\n\t\t\t\tHost: host,\n\t\t\t\tETHNodeURL: nodeURL,\n\t\t\t\tAdjudicatorAddr: contracts.AdjudicatorAddr,\n\t\t\t\tAssetHolderAddr: contracts.AssetHolderAddr,\n\t\t\t\tDialerTimeout: 1 * time.Second,\n\t\t\t\tPeerAddresses: []perun.PeerWithAddress{\n\t\t\t\t\t{\n\t\t\t\t\t\tPeer: wallet.AsWalletAddr(peerAddress),\n\t\t\t\t\t\tAddress: peerHost,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tChallengeDuration: collateralWithdrawalDelay / 2,\n\t\t\tAppAddress: contracts.AppAddr,\n\t\t\tContextTimeout: defaultContextTimeout,\n\t\t}\n\t}\n\n\tlog.Print(\"Setting up clients...\")\n\t// Setup Client1\n\tclientDef1 := genClientDef(\n\t\tganache.Accounts[1].PrivateKey, hostClient1,\n\t\tganache.Accounts[2].Address(), hostClient2,\n\t)\n\tpaymentAcceptancePolicy1 := func(\n\t\tamount, collateral, funding, balance *big.Int,\n\t\thasOverdrawn bool,\n\t) (ok bool) {\n\t\treturn true\n\t}\n\tc1, err := client.SetupClient(\n\t\tclientDef1,\n\t\tpaymentAcceptancePolicy1,\n\t)\n\trequire.NoError(err, \"Client1 setup\")\n\n\t// Setup Client2\n\tclientDef2 := genClientDef(ganache.\n\t\tAccounts[2].PrivateKey, hostClient2,\n\t\tganache.Accounts[1].Address(), hostClient1,\n\t)\n\tpaymentAcceptancePolicy2 := func(\n\t\tamount, collateral, funding, balance *big.Int,\n\t\thasOverdrawn bool,\n\t) (ok bool) {\n\t\t// We reject unfunded payments if they exceed 10% of the collateral.\n\t\tbalanceFundingDiff := new(big.Int).Sub(funding, balance)\n\t\tcollateral10percent := new(big.Int).Div(collateral, big.NewInt(10))\n\t\tif balanceFundingDiff.Sign() < 0 && balanceFundingDiff.Cmp(collateral10percent) < 0 {\n\t\t\treturn false\n\t\t}\n\n\t\t// We accept all other payments.\n\t\treturn true\n\t}\n\tc2, err := client.SetupClient(\n\t\tclientDef2,\n\t\tpaymentAcceptancePolicy2,\n\t)\n\trequire.NoError(err, \"Client2 setup\")\n\n\te := &Environment{map[common.Address]string{\n\t\tc1.Address(): \"Client1\",\n\t\tc2.Address(): \"Client2\",\n\t}}\n\te.logAccountBalance(c1, c2)\n\tlog.Print(\"Setup done.\")\n\n\t// Deposit Client1 collateral\n\tlog.Printf(\"Client1: Depositing %v as collateral...\", toEth(collateralClient1))\n\terr = c1.IncreaseCollateral(collateralClient1)\n\trequire.NoError(err, \"increasing Client1 collateral\")\n\te.logAccountBalance(c1)\n\n\t// Send payment from Client1 to Client2\n\tlog.Printf(\"Client1: Sending %v to Client2...\", toEth(payment1Client1ToClient2))\n\terr = c1.SendPayment(c2.Address(), payment1Client1ToClient2) // open unfunded channel, handle channel proposal, transfer amount, handle update\n\trequire.NoError(err, \"Client1 sending payment to Client2\")\n\te.logChannelBalances(c1, c2)\n\n\t// Client1 deposits channel funding\n\tlog.Printf(\"Client1: Depositing %v as channel funding...\", toEth(channelFundingClient1))\n\terr = c1.IncreaseChannelCollateral(c2.Address(), channelFundingClient1)\n\trequire.NoError(err, \"Client1 increasing channel funding\")\n\te.logAccountBalance(c1)\n\te.logChannelBalances(c1)\n\n\t// Client1 sends another payment to Client2\n\tlog.Printf(\"Client1: Sending %v to Client2...\", toEth(payment2Client1ToClient2))\n\terr = c1.SendPayment(c2.Address(), payment2Client1ToClient2) // send another payment\n\trequire.NoError(err, \"Client1 sending another payment to Client2\")\n\te.logChannelBalances(c1, c2)\n\n\t// Client2 settles the channel and withdraws the received payments\n\tlog.Print(\"Client2: Settling channel...\")\n\terr = c2.Settle(c1.Address()) // c2 settles channel with c1\n\trequire.NoError(err, \"Client2 settling the channel\")\n\te.logAccountBalance(c2)\n\n\tlog.Print(\"Done.\")\n}", "func (m *MockServerStreamConnection) Dispatch(buffer buffer.IoBuffer) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Dispatch\", buffer)\n}", "func (m *MockisTcpCbKeyHandle_KeyOrHandle) isTcpCbKeyHandle_KeyOrHandle() {\n\tm.ctrl.Call(m, \"isTcpCbKeyHandle_KeyOrHandle\")\n}", "func (_m *ISession) ThreadStart(channelID string, name string, typ discordgo.ChannelType, archiveDuration int, options ...discordgo.RequestOption) (*discordgo.Channel, error) {\n\t_va := make([]interface{}, len(options))\n\tfor _i := range options {\n\t\t_va[_i] = options[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, channelID, name, typ, archiveDuration)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *discordgo.Channel\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(string, string, discordgo.ChannelType, int, ...discordgo.RequestOption) (*discordgo.Channel, error)); ok {\n\t\treturn rf(channelID, name, typ, archiveDuration, options...)\n\t}\n\tif rf, ok := ret.Get(0).(func(string, string, discordgo.ChannelType, int, ...discordgo.RequestOption) *discordgo.Channel); ok {\n\t\tr0 = rf(channelID, name, typ, archiveDuration, options...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*discordgo.Channel)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(string, string, discordgo.ChannelType, int, ...discordgo.RequestOption) error); ok {\n\t\tr1 = rf(channelID, name, typ, archiveDuration, options...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (_m *mockCopyCat) SubscribeToDataStructure(id *copycat.ID, provider copycat.SnapshotProvider) (chan<- []byte, <-chan []byte, <-chan error, copycat.SnapshotConsumer, error) {\n\tret := _m.Called(id, provider)\n\n\tvar r0 chan<- []byte\n\tif rf, ok := ret.Get(0).(func(*copycat.ID, copycat.SnapshotProvider) chan<- []byte); ok {\n\t\tr0 = rf(id, provider)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(chan<- []byte)\n\t\t}\n\t}\n\n\tvar r1 <-chan []byte\n\tif rf, ok := ret.Get(1).(func(*copycat.ID, copycat.SnapshotProvider) <-chan []byte); ok {\n\t\tr1 = rf(id, provider)\n\t} else {\n\t\tif ret.Get(1) != nil {\n\t\t\tr1 = ret.Get(1).(<-chan []byte)\n\t\t}\n\t}\n\n\tvar r2 <-chan error\n\tif rf, ok := ret.Get(2).(func(*copycat.ID, copycat.SnapshotProvider) <-chan error); ok {\n\t\tr2 = rf(id, provider)\n\t} else {\n\t\tif ret.Get(2) != nil {\n\t\t\tr2 = ret.Get(2).(<-chan error)\n\t\t}\n\t}\n\n\tvar r3 copycat.SnapshotConsumer\n\tif rf, ok := ret.Get(3).(func(*copycat.ID, copycat.SnapshotProvider) copycat.SnapshotConsumer); ok {\n\t\tr3 = rf(id, provider)\n\t} else {\n\t\tif ret.Get(3) != nil {\n\t\t\tr3 = ret.Get(3).(copycat.SnapshotConsumer)\n\t\t}\n\t}\n\n\tvar r4 error\n\tif rf, ok := ret.Get(4).(func(*copycat.ID, copycat.SnapshotProvider) error); ok {\n\t\tr4 = rf(id, provider)\n\t} else {\n\t\tr4 = ret.Error(4)\n\t}\n\n\treturn r0, r1, r2, r3, r4\n}", "func SmokeTestChannelImpl(t *testing.T) {\n\tclient := Setup(t, true)\n\tdefer TearDown(client)\n\n\tinstaller := NewInstaller(client.Dynamic, map[string]string{\n\t\t\"namespace\": client.Namespace,\n\t}, EndToEndConfigYaml([]string{\"smoke_test\", \"istio\"})...)\n\n\t// Create the resources for the test.\n\tif err := installer.Do(\"create\"); err != nil {\n\t\tt.Errorf(\"failed to create, %s\", err)\n\t\treturn\n\t}\n\n\t// Delete deferred.\n\tdefer func() {\n\t\tif err := installer.Do(\"delete\"); err != nil {\n\t\t\tt.Errorf(\"failed to create, %s\", err)\n\t\t}\n\t\t// Just chill for tick.\n\t\ttime.Sleep(10 * time.Second)\n\t}()\n\n\tif err := client.WaitForResourceReady(client.Namespace, \"e2e-smoke-test\", schema.GroupVersionResource{\n\t\tGroup: \"messaging.cloud.google.com\",\n\t\tVersion: \"v1alpha1\",\n\t\tResource: \"channels\",\n\t}); err != nil {\n\t\tt.Error(err)\n\t}\n}", "func getChannel(client fab.Resource, channelID string) (fab.Channel, error) {\n\n\tchannel, err := client.NewChannel(channelID)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"NewChannel failed\")\n\t}\n\n\tchCfg, err := client.Config().ChannelConfig(channel.Name())\n\tif err != nil || chCfg == nil {\n\t\treturn nil, errors.Errorf(\"reading channel config failed: %s\", err)\n\t}\n\n\tchOrderers, err := client.Config().ChannelOrderers(channel.Name())\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"reading channel orderers failed\")\n\t}\n\n\tfor _, ordererCfg := range chOrderers {\n\n\t\torderer, err := orderer.New(client.Config(), orderer.FromOrdererConfig(&ordererCfg))\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"creating orderer failed\")\n\t\t}\n\t\terr = channel.AddOrderer(orderer)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"adding orderer failed\")\n\t\t}\n\t}\n\n\treturn channel, nil\n}", "func (suite *KeeperTestSuite) TestChanOpenConfirm() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tchannelCap *capabilitytypes.Capability\n\t\theightDiff uint64\n\t)\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenAck()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {}, false},\n\t\t{\"channel state is not TRYOPEN\", func() {\n\t\t\t// create fully open channels on both cahins\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenAck()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointB.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainB.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointB.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tsuite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t}, false},\n\t\t{\"consensus state not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenAck()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\theightDiff = 3\n\t\t}, false},\n\t\t{\"channel verification failed\", func() {\n\t\t\t// chainA is INIT, chainB in TRYOPEN\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenAck()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = capabilitytypes.NewCapability(6)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\theightDiff = 0 // must be explicitly changed\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\tif path.EndpointB.ClientID != \"\" {\n\t\t\t\t// ensure client is up to date\n\t\t\t\terr := path.EndpointB.UpdateClient()\n\t\t\t\tsuite.Require().NoError(err)\n\n\t\t\t}\n\n\t\t\tchannelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tproof, proofHeight := suite.chainA.QueryProof(channelKey)\n\n\t\t\terr := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanOpenConfirm(\n\t\t\t\tsuite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID,\n\t\t\t\tchannelCap, proof, malleateHeight(proofHeight, heightDiff),\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func (suite *KeeperTestSuite) TestChanCloseConfirm() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tchannelCap *capabilitytypes.Capability\n\t\theightDiff uint64\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {\n\t\t\t// any non-nil values work for connections\n\t\t\tpath.EndpointA.ChannelID = ibctesting.FirstChannelID\n\t\t\tpath.EndpointB.ChannelID = ibctesting.FirstChannelID\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t}, false},\n\t\t{\"channel state is CLOSED\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\terr := path.EndpointB.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointB.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainB.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointB.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// create channel in init\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr = path.EndpointB.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, false},\n\t\t{\"consensus state not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\theightDiff = 3\n\t\t}, false},\n\t\t{\"channel verification failed\", func() {\n\t\t\t// channel not closed\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\theightDiff = 0 // must explicitly be changed\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\tchannelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tproof, proofHeight := suite.chainA.QueryProof(channelKey)\n\n\t\t\terr := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanCloseConfirm(\n\t\t\t\tsuite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID, channelCap,\n\t\t\t\tproof, malleateHeight(proofHeight, heightDiff),\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func (_m *ISession) ChannelMessages(channelID string, limit int, beforeID string, afterID string, aroundID string, options ...discordgo.RequestOption) ([]*discordgo.Message, error) {\n\t_va := make([]interface{}, len(options))\n\tfor _i := range options {\n\t\t_va[_i] = options[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, channelID, limit, beforeID, afterID, aroundID)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 []*discordgo.Message\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(string, int, string, string, string, ...discordgo.RequestOption) ([]*discordgo.Message, error)); ok {\n\t\treturn rf(channelID, limit, beforeID, afterID, aroundID, options...)\n\t}\n\tif rf, ok := ret.Get(0).(func(string, int, string, string, string, ...discordgo.RequestOption) []*discordgo.Message); ok {\n\t\tr0 = rf(channelID, limit, beforeID, afterID, aroundID, options...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*discordgo.Message)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(string, int, string, string, string, ...discordgo.RequestOption) error); ok {\n\t\tr1 = rf(channelID, limit, beforeID, afterID, aroundID, options...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func getAPIChannel(c api.ChannelProvider) (api.Channel, error) {\n\tch, err := c.NewAPIChannel()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := ch.CheckCompatiblity(vpe.AllMessages()...); err != nil {\n\t\treturn nil, fmt.Errorf(\"compatibility check failed: %w\", err)\n\t}\n\tif err := ch.CheckCompatiblity(interfaces.AllMessages()...); err != nil {\n\t\tlogInfo(\"compatibility check failed: %v\", err)\n\t}\n\treturn ch, nil\n}", "func (m *MockClient) Send() chan []byte {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Send\")\n\tret0, _ := ret[0].(chan []byte)\n\treturn ret0\n}", "func (m *MockFile) Chown(arg0, arg1 int) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Chown\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (m *MockFullNode) NetFindProvidersAsync(arg0 context.Context, arg1 cid.Cid, arg2 int) <-chan peer.AddrInfo {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NetFindProvidersAsync\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(<-chan peer.AddrInfo)\n\treturn ret0\n}", "func (_m *ChannelStore) Get(id string, allowFromCache bool) (*model.Channel, error) {\n\tret := _m.Called(id, allowFromCache)\n\n\tvar r0 *model.Channel\n\tif rf, ok := ret.Get(0).(func(string, bool) *model.Channel); ok {\n\t\tr0 = rf(id, allowFromCache)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*model.Channel)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, bool) error); ok {\n\t\tr1 = rf(id, allowFromCache)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func NewMockChannel(ctrl *gomock.Controller) *MockChannel {\n\tmock := &MockChannel{ctrl: ctrl}\n\tmock.recorder = &MockChannelMockRecorder{mock}\n\treturn mock\n}", "func (m *MockisProxycCbKeyHandle_KeyOrHandle) isProxycCbKeyHandle_KeyOrHandle() {\n\tm.ctrl.Call(m, \"isProxycCbKeyHandle_KeyOrHandle\")\n}", "func (m *MockAMQPChannel) NotifyClose(arg0 chan *amqp091.Error) chan *amqp091.Error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NotifyClose\", arg0)\n\tret0, _ := ret[0].(chan *amqp091.Error)\n\treturn ret0\n}", "func TestGcm(t *testing.T) {\n\n\tmockResponse := testCreateGoogleCloudMsgResponse(100, 1, 0, 0)\n\ttestAddGoogleCloudMsgResponseResult(mockResponse, \"someMessageId\", nadaStr, nadaStr)\n\n\tdata, err := json.Marshal(mockResponse)\n\tif err != nil { t.Errorf(\"TestGcm json encode mock response broken - err: %v\", err); return }\n\n\thttpClient := NewHttpRequestClientMock()\n\thttpClient.(*HttpRequestClientMock).AddMock(\"https://android.googleapis.com/gcm/send\", &HttpRequestClientMockResponse{\n\t\tHttpStatusCode: 200,\n\t\tData: data,\n\t})\n\n\trequestChannel := make(chan interface{})\n\tresponseChannel := make(chan interface{})\n\n\tsvc := NewGoogleCloudMessagingSvc(\"gcm\", httpClient, requestChannel, responseChannel)\n\n\tkernel, err := baseTestStartKernel(\"gcmTest\", func(kernel *Kernel) {\n\t\tkernel.AddComponentWithStartStopMethods(\"GoogleCloudMessagingSvc\", svc, \"Start\", \"Stop\")\n\t})\n\n\tif err != nil { t.Errorf(\"TestGcm start kernel is broken: %v\", err); return }\n\n\tmsgSendCount := 10000\n\tmsgReceivedCount := 0\n\n\tvar waitGroup sync.WaitGroup\n\n\tgo func() {\n\t\twaitGroup.Add(1)\n\t\tdefer waitGroup.Done()\n\t\tfor {\n\t\t\tmsg := <- responseChannel\n\t\t\tif msg == nil { t.Errorf(\"TestGcm is broken - response message is nil\") }\n\t\t\tmsgReceivedCount++\n\t\t\tif msgReceivedCount == msgSendCount { return }\n\t\t}\n\t}()\n\n\tfor idx := 0; idx < msgSendCount; idx++ {\n\t\trequestChannel <- &GoogleCloudMsg{\n\t\t\tRegistrationIds: []string { \"someRegistrationId\" },\n\t\t\tCollapseKey: \"someCollapseKey\",\n\t\t\tDelayWhileIdle: true,\n\t\t\tTimeToLive: 300,\n\t\t\tRestrictedPackageName: \"somePackageName\",\n\t\t\tDryRun: false,\n\t\t\tData: map[string]interface{} { \"someKey\": \"someValue\" },\n\t\t}\n\t}\n\n\twaitGroup.Wait()\n\n\tclose(requestChannel)\n\n\tif err := kernel.Stop(); err != nil { t.Errorf(\"TestGcm stop kernel is broken:\", err) }\n}", "func (m *MockAMQPChannel) Consume(arg0, arg1 string, arg2, arg3, arg4, arg5 bool, arg6 amqp091.Table) (<-chan amqp091.Delivery, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Consume\", arg0, arg1, arg2, arg3, arg4, arg5, arg6)\n\tret0, _ := ret[0].(<-chan amqp091.Delivery)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (amqpSuite *AmqpSuite) ChannelConsumeTester() *amqp.ChannelTesting {\n\treturn amqpSuite.ChannelConsume().Test(amqpSuite.T())\n}", "func (m *MockIInterConnector) receiver() ISubKeyBucketReceiver {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"receiver\")\n\tret0, _ := ret[0].(ISubKeyBucketReceiver)\n\treturn ret0\n}", "func (m *MockHealthCheck) Subscribe() chan *discovery.TabletHealth {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subscribe\")\n\tret0, _ := ret[0].(chan *discovery.TabletHealth)\n\treturn ret0\n}", "func (_m *ChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (model.ChannelList, error) {\n\tret := _m.Called(teamID, userID, offset, limit)\n\n\tvar r0 model.ChannelList\n\tif rf, ok := ret.Get(0).(func(string, string, int, int) model.ChannelList); ok {\n\t\tr0 = rf(teamID, userID, offset, limit)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(model.ChannelList)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, string, int, int) error); ok {\n\t\tr1 = rf(teamID, userID, offset, limit)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (c *ConnectionMock) Channels() []string {\n\targs := c.Called()\n\treturn args.Get(0).([]string)\n}", "func (m *MockisProxyrCbKeyHandle_KeyOrHandle) isProxyrCbKeyHandle_KeyOrHandle() {\n\tm.ctrl.Call(m, \"isProxyrCbKeyHandle_KeyOrHandle\")\n}", "func Test_Provider(t *testing.T) {\n\t// SetLogLevel(\"TRACE\")\n\t// CheckVersion()\n\n\t// Start provider API in the background\n\tgo InitProvider()\n\t// err := InitProvider()\n\t// if err != nil {\n\t// \tlog.Fatalf(\"Error initializing Provider %+v\", err)\n\t// }\n\n\tverifier := HTTPVerifier{}\n\t// Authorization middleware\n\t// This is your chance to modify the request before it hits your provider\n\t// NOTE: this should be used very carefully, as it has the potential to\n\t// _change_ the contract\n\t// f := func(next http.Handler) http.Handler {\n\t// \treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t// \t\tlog.Println(\"[DEBUG] HOOK request filter\")\n\t// \t\t// r.Header.Add(\"Authorization\", \"Bearer 1234-dynamic-value\")\n\t// \t\tnext.ServeHTTP(w, r)\n\t// \t})\n\t// }\n\n\t// Verify the Provider with local Pact Files\n\terr := verifier.VerifyProvider(t, VerifyRequest{\n\t\tProviderBaseURL: \"http://localhost:9000\",\n\t\tBrokerURL: \"http://localhost:9292\",\n\t\tProvider: \"GreetingAPI\",\n\t\tProviderVersion: \"1.0.0\",\n\t\tPublishVerificationResults: true,\n\t\t// PactFiles: []string{\n\t\t// \tfilepath.ToSlash(fmt.Sprintf(\"%s/GreetingAPIConsumer-GreetingAPI.json\", pactDir)),\n\t\t// },\n\t\t// RequestFilter: f,\n\t\t// BeforeEach: func() error {\n\t\t// \tlog.Println(\"[DEBUG] HOOK before each\")\n\t\t// \treturn nil\n\t\t// },\n\t\t// AfterEach: func() error {\n\t\t// \tlog.Println(\"[DEBUG] HOOK after each\")\n\t\t// \treturn nil\n\t\t// },\n\t\t// StateHandlers: StateHandlers{\n\t\t// \t\"User foo exists\": func(setup bool, s ProviderStateV3) (ProviderStateV3Response, error) {\n\n\t\t// \t\tif setup {\n\t\t// \t\t\tlog.Println(\"[DEBUG] HOOK calling user foo exists state handler\", s)\n\t\t// \t\t} else {\n\t\t// \t\t\tlog.Println(\"[DEBUG] HOOK teardown the 'User foo exists' state\")\n\t\t// \t\t}\n\n\t\t// \t\t// ... do something, such as create \"foo\" in the database\n\n\t\t// \t\t// Optionally (if there are generators in the pact) return provider state values to be used in the verification\n\t\t// \t\treturn ProviderStateV3Response{\"uuid\": \"1234\"}, nil\n\t\t// \t},\n\t\t// },\n\t})\n\n\tassert.NoError(t, err)\n}", "func (m *MockAergoRPCService_ListBlockStreamServer) Context() context.Context {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Context\")\n\tret0, _ := ret[0].(context.Context)\n\treturn ret0\n}", "func mockChildPackages() {\n\n\t// Fake an AWS credentials file so that the mfile package will nehave as if it is happy\n\tsetFakeCredentials()\n\n\t// Fake out the creds package into using an apparently credentials response from AWS\n\tcreds.SetGetSessionTokenFunc(func(awsService *sts.STS, input *sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) {\n\t\treturn getSessionTokenOutput, nil\n\t})\n\n}", "func (_m *ChannelRepository) Create(channel *model.Channel) (*model.Channel, error) {\n\tret := _m.Called(channel)\n\n\tvar r0 *model.Channel\n\tif rf, ok := ret.Get(0).(func(*model.Channel) *model.Channel); ok {\n\t\tr0 = rf(channel)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*model.Channel)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*model.Channel) error); ok {\n\t\tr1 = rf(channel)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (m *MockMachine) JetStreamConnection() (*jsm_go.Manager, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"JetStreamConnection\")\n\tret0, _ := ret[0].(*jsm_go.Manager)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (amqpSuite *AmqpSuite) getChannel(conn *amqp.Connection) *amqp.Channel {\n\tchannel, err := conn.Channel()\n\tif err != nil {\n\t\tamqpSuite.T().Errorf(\"error getting channel: %v\", err)\n\t\tamqpSuite.T().FailNow()\n\t}\n\n\treturn channel\n}", "func (m *MockReminds) ChannelMessageSend(arg0, arg1 string) (*discordgo.Message, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelMessageSend\", arg0, arg1)\n\tret0, _ := ret[0].(*discordgo.Message)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (_m *TimeTicker) C() <-chan time.Time {\n\tret := _m.Called()\n\n\tvar r0 <-chan time.Time\n\tif rf, ok := ret.Get(0).(func() <-chan time.Time); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(<-chan time.Time)\n\t\t}\n\t}\n\n\treturn r0\n}", "func TestConjur_Provider(t *testing.T) {\n\tvar err error\n\tvar provider plugin_v1.Provider\n\tname := \"conjur\"\n\n\toptions := plugin_v1.ProviderOptions{\n\t\tName: name,\n\t}\n\n\tt.Run(\"Can create the Conjur provider\", func(t *testing.T) {\n\t\tprovider, err = providers.ProviderFactories[name](options)\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"Has the expected provider name\", func(t *testing.T) {\n\t\tassert.Equal(t, \"conjur\", provider.GetName())\n\t})\n\n\tt.Run(\"Can provide an access token\", func(t *testing.T) {\n\t\tid := \"accessToken\"\n\t\tvalues, err := provider.GetValues(id)\n\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, values[id])\n\t\tassert.NoError(t, values[id].Error)\n\t\tassert.NotNil(t, values[id].Value)\n\n\t\ttoken := make(map[string]string)\n\t\terr = json.Unmarshal(values[id].Value, &token)\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, token[\"protected\"])\n\t\tassert.NotNil(t, token[\"payload\"])\n\t})\n\n\tt.Run(\"Reports an unknown value\",\n\t\ttestutils.Reports(\n\t\t\tprovider,\n\t\t\t\"foobar\",\n\t\t\t\"404 Not Found. CONJ00076E Variable dev:variable:foobar is empty or not found..\",\n\t\t),\n\t)\n\n\tt.Run(\"Provides\", func(t *testing.T) {\n\t\tfor _, testCase := range canProvideTestCases {\n\t\t\tt.Run(testCase.Description, testutils.CanProvide(provider, testCase.ID, testCase.ExpectedValue))\n\t\t}\n\t})\n}", "func (m *MockClienter) Connectable(timeout time.Duration) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Connectable\", timeout)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func startMockOrchestrator(t *testing.T, reportCh chan string, triggerCh chan interface{}, doneCh chan interface{}, wg *sync.WaitGroup, logger *logrus.Logger, m messenger.Messenger, expectedStatusReportBody orchestra.StatusReportBody) chan interface{} {\n\tstatusReportCh := make(chan []byte)\n\tstatusReportSubs := m.ChanSubscribe(\"status-report\", statusReportCh)\n\torcStoppedCh := make(chan interface{})\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tlogger.Infof(\"MockOrchestrator stopped.\")\n\t\t\tif err := statusReportSubs.Unsubscribe(); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tclose(statusReportCh)\n\t\t\tclose(orcStoppedCh)\n\t\t\twg.Done()\n\t\t}()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-doneCh:\n\t\t\t\tlogger.Infof(\"MockOrchestrator shuts down.\")\n\t\t\t\treturn\n\n\t\t\tcase <-triggerCh:\n\t\t\t\tlogger.Infof(\"MockOrchestrator received 'start-trigger'.\")\n\t\t\t\tlogger.Infof(\"MockOrchestrator sends 'status-request' message.\")\n\t\t\t\tstatusRequestMsg := orchestra.NewStatusRequestMessage()\n\t\t\t\tif err := m.Publish(\"status-request\", statusRequestMsg.Encode(msgs.JSONRepresentation)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t\t// TODO: Make orchestra message representations and channel names configurable\n\t\t\t\treportCh <- checkSendStatusRequest\n\n\t\t\tcase statusReportMsgBytes := <-statusReportCh:\n\t\t\t\tlogger.Infof(\"MockOrchestrator received 'status-report' message.\")\n\t\t\t\tvar statusReportMsg orchestra.StatusReport\n\t\t\t\terr := statusReportMsg.Decode(msgs.JSONRepresentation, statusReportMsgBytes)\n\t\t\t\tassert.Nil(t, err)\n\t\t\t\tassert.Equal(t, expectedStatusReportBody, statusReportMsg.Body)\n\t\t\t\treportCh <- checkStatusReportReceived\n\t\t\t}\n\t\t}\n\t}()\n\tlogger.Infof(\"Mock Orchestrator started.\")\n\n\treturn orcStoppedCh\n}", "func (s *TestSuite) TestGetChannels(c *C) {\n\tsvc := s.serviceGroup.UserService\n\tteam, _ := s.serviceGroup.TeamService.SaveTeam(msgcore.NewTeam(1, \"org\", \"team\"))\n\n\tusers := make([]*msgcore.User, 0, 0)\n\tchannels := make([]*msgcore.Channel, 0, 0)\n\tfor i := 1; i <= 10; i++ {\n\t\tcreator := msgcore.NewUser(int64(i), fmt.Sprintf(\"%d\", i), team)\n\t\t_ = svc.SaveUser(&msgcore.SaveUserRequest{nil, creator, false})\n\t\tusers = append(users, creator)\n\t\tchannel := msgcore.NewChannel(team, creator, int64(i), fmt.Sprintf(\"channel%d\", i))\n\t\tchannel, err := s.serviceGroup.ChannelService.CreateChannel(&msgcore.CreateChannelRequest{channel, nil, true})\n\t\tif err != nil {\n\t\t\tlog.Println(\"CreateChannel Error: \", err)\n\t\t}\n\t\tchannels = append(channels, channel)\n\t}\n\n\tfor i := 1; i <= 10; i++ {\n\t\t// add the creator and 4 next users as members\n\t\tmembers := make([]string, 0, 4)\n\t\tfor j := 0; j < 5; j++ {\n\t\t\tmembers = append(members, users[(i+j-1)%len(users)].Username)\n\t\t}\n\t\ts.serviceGroup.ChannelService.AddChannelMembers(&msgcore.InviteMembersRequest{nil, channels[i-1], members})\n\t}\n\n\t// Test owner filter\n\trequest := &msgcore.GetChannelsRequest{team, users[0], \"\", nil, true}\n\tresult, _ := s.serviceGroup.ChannelService.GetChannels(request)\n\tc.Assert(len(result.Channels), Equals, 1)\n\tc.Assert(len(result.Members), Equals, 1)\n\t// ensure all users have the same creator\n\tc.Assert(result.Channels[0].Creator.Id, Equals, users[0].Id)\n\tc.Assert(len(result.Members[0]), Equals, 5)\n\n\t// Test participants\n\trequest = &msgcore.GetChannelsRequest{team, nil, \"\", []*msgcore.User{users[1], users[2]}, true}\n\tresult, _ = s.serviceGroup.ChannelService.GetChannels(request)\n\tc.Assert(len(result.Channels), Equals, 4)\n\tfor i := 0; i < 4; i++ {\n\t\tc.Assert(len(result.Members[i]), Equals, 5)\n\t}\n}", "func (m *MockChoriaProvider) PublishRaw(arg0 string, arg1 []byte) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PublishRaw\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (m *MockWebsocketClientStore) CountChannels(clientID wspubsub.UUID) (int, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CountChannels\", clientID)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockAMQPChan) Consume(arg0, arg1 string, arg2, arg3, arg4, arg5 bool, arg6 amqp.Table) (<-chan amqp.Delivery, error) {\n\tret := m.ctrl.Call(m, \"Consume\", arg0, arg1, arg2, arg3, arg4, arg5, arg6)\n\tret0, _ := ret[0].(<-chan amqp.Delivery)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}" ]
[ "0.74381363", "0.6751296", "0.6729731", "0.6153569", "0.61135983", "0.6057166", "0.6054517", "0.5930565", "0.5925086", "0.59205496", "0.59125435", "0.5870955", "0.5845958", "0.5832964", "0.5823897", "0.58165205", "0.5808184", "0.57830024", "0.57754666", "0.57749516", "0.57468253", "0.57318926", "0.5721575", "0.5714591", "0.56840426", "0.56641996", "0.5653062", "0.56499577", "0.56364167", "0.5619127", "0.56025493", "0.55980915", "0.55738676", "0.55490685", "0.55266345", "0.5525505", "0.55210894", "0.55088264", "0.55066943", "0.54867184", "0.5479955", "0.54778075", "0.54713947", "0.54634446", "0.5462797", "0.54361594", "0.54206336", "0.5418061", "0.54170215", "0.54168415", "0.5416697", "0.54051226", "0.54006726", "0.53968203", "0.53892386", "0.53817624", "0.53779006", "0.53725594", "0.536024", "0.53566", "0.5346966", "0.5340234", "0.5328267", "0.5322905", "0.5322579", "0.53096706", "0.53016514", "0.52993655", "0.52804565", "0.5274022", "0.5272792", "0.527115", "0.5268956", "0.526725", "0.5266349", "0.5265111", "0.52625924", "0.52579296", "0.52540165", "0.52473897", "0.5245937", "0.5243764", "0.52350324", "0.5233514", "0.5219781", "0.5219683", "0.5217055", "0.5204583", "0.5202766", "0.519056", "0.5186911", "0.51867205", "0.51827526", "0.5182705", "0.51773465", "0.51739657", "0.5172467", "0.51712507", "0.5169238", "0.5166768" ]
0.72489923
1
ChannelProvider indicates an expected call of ChannelProvider
func (mr *MockProvidersMockRecorder) ChannelProvider() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChannelProvider", reflect.TypeOf((*MockProviders)(nil).ChannelProvider)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (mr *MockClientMockRecorder) ChannelProvider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ChannelProvider\", reflect.TypeOf((*MockClient)(nil).ChannelProvider))\n}", "func (m *MockClient) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}", "func (c *Provider) ChannelProvider() fab.ChannelProvider {\n\treturn c.channelProvider\n}", "func (m *MockProviders) ChannelProvider() fab.ChannelProvider {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ChannelProvider\")\n\tret0, _ := ret[0].(fab.ChannelProvider)\n\treturn ret0\n}", "func TestConsumerChannel(t *testing.T) {\n\tconsumerTestWithCommits(t, \"Channel Consumer\", 0, true, eventTestChannelConsumer, nil)\n}", "func (a *AbstractSSHConnectionHandler) OnUnsupportedChannel(_ uint64, _ string, _ []byte) {}", "func Test_ChannelFlow_Failed_FlowOkSend(t *testing.T) {\n\tsc, _ := getNewSC(getDefaultTestConfig())\n\tdefer sc.clean()\n\tch, _ := sc.client.Channel()\n\n\tflowChan := make(chan bool)\n\tcloseChan := make(chan *amqpclient.Error, 1)\n\tch.NotifyFlow(flowChan)\n\tch.NotifyClose(closeChan)\n\n\tchannel := getServerChannel(sc, 1)\n\tchannel.SendMethod(&amqp.ChannelFlow{Active: false})\n\n\tselect {\n\tcase <-flowChan:\n\tcase <-time.After(100 * time.Millisecond):\n\t}\n\n\tfor notify := range flowChan {\n\t\tfmt.Println(notify)\n\t}\n\n\tvar closeErr *amqpclient.Error\n\n\tselect {\n\tcase closeErr = <-closeChan:\n\tcase <-time.After(100 * time.Millisecond):\n\t}\n\n\tif closeErr == nil {\n\t\tt.Error(\"Expected NOT_IMPLEMENTED error\")\n\t}\n}", "func (s *RingpopOptionsTestSuite) TestChannelRequired() {\n\trp, err := New(\"test\")\n\ts.Nil(rp)\n\ts.Error(err)\n}", "func TestChannelAttachNotMember(t *testing.T) {\n\th := newHelper(t)\n\n\tch := h.repoMakePrivateCh()\n\n\th.apiChAttach(ch, []byte(\"NOPE\")).\n\t\tAssert(helpers.AssertError(\"not allowed to attach files this channel\")).\n\t\tEnd()\n}", "func (p *peer) hasChannel(chID byte) bool {\r\n\tfor _, ch := range p.channels {\r\n\t\tif ch == chID {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\t// NOTE: probably will want to remove this\r\n\t// but could be helpful while the feature is new\r\n\tp.Logger.Debug(\r\n\t\t\"Unknown channel for peer\",\r\n\t\t\"channel\",\r\n\t\tchID,\r\n\t\t\"channels\",\r\n\t\tp.channels,\r\n\t)\r\n\treturn false\r\n}", "func (*ProtocolHeader) Channel() uint16 {\n\tpanic(\"Should never be called\")\n}", "func TestProducerChannel(t *testing.T) {\n\tproducerTest(t, \"Channel producer (without DR)\",\n\t\tnil, producerCtrl{},\n\t\tfunc(p *Producer, m *Message, drChan chan Event) {\n\t\t\tp.ProduceChannel() <- m\n\t\t})\n}", "func (mr *MockRConnectionInterfaceMockRecorder) Channel() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Channel\", reflect.TypeOf((*MockRConnectionInterface)(nil).Channel))\n}", "func TestConjur_Provider(t *testing.T) {\n\tvar err error\n\tvar provider plugin_v1.Provider\n\tname := \"conjur\"\n\n\toptions := plugin_v1.ProviderOptions{\n\t\tName: name,\n\t}\n\n\tt.Run(\"Can create the Conjur provider\", func(t *testing.T) {\n\t\tprovider, err = providers.ProviderFactories[name](options)\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"Has the expected provider name\", func(t *testing.T) {\n\t\tassert.Equal(t, \"conjur\", provider.GetName())\n\t})\n\n\tt.Run(\"Can provide an access token\", func(t *testing.T) {\n\t\tid := \"accessToken\"\n\t\tvalues, err := provider.GetValues(id)\n\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, values[id])\n\t\tassert.NoError(t, values[id].Error)\n\t\tassert.NotNil(t, values[id].Value)\n\n\t\ttoken := make(map[string]string)\n\t\terr = json.Unmarshal(values[id].Value, &token)\n\t\tassert.NoError(t, err)\n\t\tassert.NotNil(t, token[\"protected\"])\n\t\tassert.NotNil(t, token[\"payload\"])\n\t})\n\n\tt.Run(\"Reports an unknown value\",\n\t\ttestutils.Reports(\n\t\t\tprovider,\n\t\t\t\"foobar\",\n\t\t\t\"404 Not Found. CONJ00076E Variable dev:variable:foobar is empty or not found..\",\n\t\t),\n\t)\n\n\tt.Run(\"Provides\", func(t *testing.T) {\n\t\tfor _, testCase := range canProvideTestCases {\n\t\t\tt.Run(testCase.Description, testutils.CanProvide(provider, testCase.ID, testCase.ExpectedValue))\n\t\t}\n\t})\n}", "func (a *AbstractSessionChannelHandler) OnUnsupportedChannelRequest(\n\t_ uint64,\n\t_ string,\n\t_ []byte,\n) {\n}", "func TestChannelStore(t *testing.T) {\n\t// mock Insert function\n\tfn := func(_ context.Context, v are_hub.Archetype) error {\n\t\treturn nil\n\t}\n\n\t// create mock repo and controller\n\trepo := &mock.ChannelRepo{InsertFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// create and embed a new channel\n\tmsport := are_hub.Channel{Name: \"Bentley Team M-Sport\", Password: \"abc123\"}\n\n\t// create a mock request\n\treq, e := http.NewRequest(http.MethodPost, \"/channel\", nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// update the request's context with the channel\n\treq = req.WithContext(msport.ToCtx(req.Context()))\n\n\t// create a response recorder and run the controller method\n\tw := httptest.NewRecorder()\n\te = controller.Store(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// check if the repo was hit\n\tif !repo.InsertCalled {\n\t\tt.Error(\"Did not call repo.Insert\")\n\t}\n\n\t// get the response\n\tres := w.Result()\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the returned channel\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\t// unmarshal the response body\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 msport.Name != received.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v\", msport, received)\n\t}\n}", "func New(fabricProvider api.FabricProvider) (*ChannelProvider, error) {\n\tcp := ChannelProvider{fabricProvider: fabricProvider}\n\treturn &cp, nil\n}", "func Test_Provider(t *testing.T) {\n\t// SetLogLevel(\"TRACE\")\n\t// CheckVersion()\n\n\t// Start provider API in the background\n\tgo InitProvider()\n\t// err := InitProvider()\n\t// if err != nil {\n\t// \tlog.Fatalf(\"Error initializing Provider %+v\", err)\n\t// }\n\n\tverifier := HTTPVerifier{}\n\t// Authorization middleware\n\t// This is your chance to modify the request before it hits your provider\n\t// NOTE: this should be used very carefully, as it has the potential to\n\t// _change_ the contract\n\t// f := func(next http.Handler) http.Handler {\n\t// \treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t// \t\tlog.Println(\"[DEBUG] HOOK request filter\")\n\t// \t\t// r.Header.Add(\"Authorization\", \"Bearer 1234-dynamic-value\")\n\t// \t\tnext.ServeHTTP(w, r)\n\t// \t})\n\t// }\n\n\t// Verify the Provider with local Pact Files\n\terr := verifier.VerifyProvider(t, VerifyRequest{\n\t\tProviderBaseURL: \"http://localhost:9000\",\n\t\tBrokerURL: \"http://localhost:9292\",\n\t\tProvider: \"GreetingAPI\",\n\t\tProviderVersion: \"1.0.0\",\n\t\tPublishVerificationResults: true,\n\t\t// PactFiles: []string{\n\t\t// \tfilepath.ToSlash(fmt.Sprintf(\"%s/GreetingAPIConsumer-GreetingAPI.json\", pactDir)),\n\t\t// },\n\t\t// RequestFilter: f,\n\t\t// BeforeEach: func() error {\n\t\t// \tlog.Println(\"[DEBUG] HOOK before each\")\n\t\t// \treturn nil\n\t\t// },\n\t\t// AfterEach: func() error {\n\t\t// \tlog.Println(\"[DEBUG] HOOK after each\")\n\t\t// \treturn nil\n\t\t// },\n\t\t// StateHandlers: StateHandlers{\n\t\t// \t\"User foo exists\": func(setup bool, s ProviderStateV3) (ProviderStateV3Response, error) {\n\n\t\t// \t\tif setup {\n\t\t// \t\t\tlog.Println(\"[DEBUG] HOOK calling user foo exists state handler\", s)\n\t\t// \t\t} else {\n\t\t// \t\t\tlog.Println(\"[DEBUG] HOOK teardown the 'User foo exists' state\")\n\t\t// \t\t}\n\n\t\t// \t\t// ... do something, such as create \"foo\" in the database\n\n\t\t// \t\t// Optionally (if there are generators in the pact) return provider state values to be used in the verification\n\t\t// \t\treturn ProviderStateV3Response{\"uuid\": \"1234\"}, nil\n\t\t// \t},\n\t\t// },\n\t})\n\n\tassert.NoError(t, err)\n}", "func testChannel(t *testing.T, src, dst *Chain) {\n\tchans, err := src.QueryChannels(1, 1000)\n\trequire.NoError(t, err)\n\trequire.Equal(t, 1, len(chans))\n\trequire.Equal(t, chans[0].GetOrdering().String(), \"ORDERED\")\n\trequire.Equal(t, chans[0].GetState().String(), \"OPEN\")\n\trequire.Equal(t, chans[0].GetCounterparty().GetChannelID(), dst.PathEnd.ChannelID)\n\trequire.Equal(t, chans[0].GetCounterparty().GetPortID(), dst.PathEnd.PortID)\n\n\th, err := src.Client.Status()\n\trequire.NoError(t, err)\n\n\tch, err := src.QueryChannel(h.SyncInfo.LatestBlockHeight)\n\trequire.NoError(t, err)\n\trequire.Equal(t, ch.Channel.GetOrdering().String(), \"ORDERED\")\n\trequire.Equal(t, ch.Channel.GetState().String(), \"OPEN\")\n\trequire.Equal(t, ch.Channel.GetCounterparty().GetChannelID(), dst.PathEnd.ChannelID)\n\trequire.Equal(t, ch.Channel.GetCounterparty().GetPortID(), dst.PathEnd.PortID)\n}", "func (_m *KenContext) Channel() (*discordgo.Channel, error) {\n\tret := _m.Called()\n\n\tvar r0 *discordgo.Channel\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func() (*discordgo.Channel, error)); ok {\n\t\treturn rf()\n\t}\n\tif rf, ok := ret.Get(0).(func() *discordgo.Channel); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*discordgo.Channel)\n\t\t}\n\t}\n\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 NewMockChannelProvider(ctx fab.Context) (*MockChannelProvider, error) {\n\tchannels := make(map[string]fab.Channel)\n\n\t// Create a mock client with the mock channel\n\tcp := MockChannelProvider{\n\t\tctx,\n\t\tchannels,\n\t}\n\treturn &cp, nil\n}", "func (suite *KeeperTestSuite) TestChanCloseInit() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tchannelCap *capabilitytypes.Capability\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {\n\t\t\t// any non-nil values work for connections\n\t\t\tpath.EndpointA.ConnectionID = ibctesting.FirstConnectionID\n\t\t\tpath.EndpointB.ConnectionID = ibctesting.FirstConnectionID\n\n\t\t\tpath.EndpointA.ChannelID = ibctesting.FirstChannelID\n\t\t\tpath.EndpointB.ChannelID = ibctesting.FirstChannelID\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel state is CLOSED\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// close channel\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointA.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointA.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// create channel in init\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr = path.EndpointA.ChanOpenInit()\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\terr := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanCloseInit(\n\t\t\t\tsuite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, ibctesting.FirstChannelID, channelCap,\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error {\n\tctx := log.With(context.Background(), log.Str(log.ProviderName, p.name))\n\tlogger := log.FromContext(ctx)\n\n\toperation := func() error {\n\t\tif _, err := p.kvClient.Exists(path.Join(p.RootKey, \"qmslkjdfmqlskdjfmqlksjazçueznbvbwzlkajzebvkwjdcqmlsfj\"), nil); err != nil {\n\t\t\treturn fmt.Errorf(\"KV store connection error: %w\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tnotify := func(err error, time time.Duration) {\n\t\tlogger.Errorf(\"KV connection error: %+v, retrying in %s\", err, time)\n\t}\n\terr := backoff.RetryNotify(safe.OperationWithRecover(operation), job.NewBackOff(backoff.NewExponentialBackOff()), notify)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot connect to KV server: %w\", err)\n\t}\n\n\tconfiguration, err := p.buildConfiguration()\n\tif err != nil {\n\t\tlogger.Errorf(\"Cannot build the configuration: %v\", err)\n\t} else {\n\t\tconfigurationChan <- dynamic.Message{\n\t\t\tProviderName: p.name,\n\t\t\tConfiguration: configuration,\n\t\t}\n\t}\n\n\tpool.GoCtx(func(ctxPool context.Context) {\n\t\tctxLog := log.With(ctxPool, log.Str(log.ProviderName, p.name))\n\n\t\terr := p.watchKv(ctxLog, configurationChan)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"Cannot watch KV store: %v\", err)\n\t\t}\n\t})\n\n\treturn nil\n}", "func (m *MockRConnectionInterface) Channel() (*amqp.Channel, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Channel\")\n\tret0, _ := ret[0].(*amqp.Channel)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestKnativeEventingKafkaChannelAcceptance(t *testing.T) {\n\t// test meta for the Kafka channel\n\tname := \"test-kafka-channel\"\n\tnamespace := \"knative-eventing\"\n\n\t// load cluster config\n\tconfig := loadConfigOrDie(t)\n\n\t// prepare a Kafka client\n\tkafkaClient := kafkaclientset.NewForConfigOrDie(config).KafkaChannels(namespace)\n\n\t// cleanup test resources gracefully when an interrupt signal is received\n\tinterrupted := cleanupOnInterrupt(t, interruptSignals, func() { deleteChannel(t, kafkaClient, name) })\n\tdefer close(interrupted)\n\n\t// cleanup the Kafka channel when the test is finished\n\tdefer deleteChannel(t, kafkaClient, name)\n\n\t// delete the Kafka channel if existed before to make sure that\n\t// the new channel to be created has the correct structure and data\n\tif err := deleteChannelIfExistsAndWaitUntilDeleted(t, interrupted, kafkaClient, name, 5*time.Second, 10, retry.FixedDelay); err != nil {\n\t\tt.Fatalf(\"test failed with error: %s\", err)\n\t}\n\n\t// create a Kafka channel\n\tif _, err := kafkaClient.Create(newKafkaChannel(name, namespace)); err != nil {\n\t\tt.Fatalf(\"cannot create a Kafka channel: %s: error: %v\", name, err)\n\t} else {\n\t\tt.Logf(\"created Kafka channel: %s\", name)\n\t}\n\n\t// assert the Kafka channel status to be ready\n\tif err := checkChannelReadyWithRetry(t, interrupted, kafkaClient, name, 5*time.Second, 10, retry.FixedDelay); err != nil {\n\t\tt.Fatalf(\"test failed with error: %s\", err)\n\t} else {\n\t\tt.Logf(\"test finished successfully\")\n\t}\n\n\t// TODO(marcobebway) extend the test to assert event delivery also works using the Kafka channel https://github.com/kyma-project/kyma/issues/7015.\n}", "func InvalidChannel(plat int8, srcCh, cfgCh string) bool {\n\treturn plat == PlatAndroid && cfgCh != \"*\" && cfgCh != srcCh\n}", "func (suite *KeeperTestSuite) TestChanCloseConfirm() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tchannelCap *capabilitytypes.Capability\n\t\theightDiff uint64\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {\n\t\t\t// any non-nil values work for connections\n\t\t\tpath.EndpointA.ChannelID = ibctesting.FirstChannelID\n\t\t\tpath.EndpointB.ChannelID = ibctesting.FirstChannelID\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t}, false},\n\t\t{\"channel state is CLOSED\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\terr := path.EndpointB.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointB.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainB.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointB.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// create channel in init\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr = path.EndpointB.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// ensure channel capability check passes\n\t\t\tsuite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, false},\n\t\t{\"consensus state not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\theightDiff = 3\n\t\t}, false},\n\t\t{\"channel verification failed\", func() {\n\t\t\t// channel not closed\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\terr := path.EndpointA.SetChannelClosed()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\theightDiff = 0 // must explicitly be changed\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\tchannelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tproof, proofHeight := suite.chainA.QueryProof(channelKey)\n\n\t\t\terr := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanCloseConfirm(\n\t\t\t\tsuite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID, channelCap,\n\t\t\t\tproof, malleateHeight(proofHeight, heightDiff),\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func (suite *KeeperTestSuite) TestChanOpenConfirm() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tchannelCap *capabilitytypes.Capability\n\t\theightDiff uint64\n\t)\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenAck()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {}, false},\n\t\t{\"channel state is not TRYOPEN\", func() {\n\t\t\t// create fully open channels on both cahins\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenAck()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointB.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainB.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointB.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tsuite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t}, false},\n\t\t{\"consensus state not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenAck()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\n\t\t\theightDiff = 3\n\t\t}, false},\n\t\t{\"channel verification failed\", func() {\n\t\t\t// chainA is INIT, chainB in TRYOPEN\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenAck()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = capabilitytypes.NewCapability(6)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\theightDiff = 0 // must be explicitly changed\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\tif path.EndpointB.ClientID != \"\" {\n\t\t\t\t// ensure client is up to date\n\t\t\t\terr := path.EndpointB.UpdateClient()\n\t\t\t\tsuite.Require().NoError(err)\n\n\t\t\t}\n\n\t\t\tchannelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tproof, proofHeight := suite.chainA.QueryProof(channelKey)\n\n\t\t\terr := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanOpenConfirm(\n\t\t\t\tsuite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID,\n\t\t\t\tchannelCap, proof, malleateHeight(proofHeight, heightDiff),\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func TestChannelShow(t *testing.T) {\n\t// expecting this channel\n\twrt := channels[0]\n\n\t// create the mock repo and controller\n\trepo := &mock.ChannelRepo{FindIDFunc: 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.MethodGet, \"/channel/\"+p.Value, nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// embed the channel ID in the request's\n\t// context (necessary for controller.Show to function)\n\tuf.EmbedParams(req, httprouter.Param{Key: \"id\", Value: \"1\"})\n\n\t// create a response recorder and call the show method\n\tw := httptest.NewRecorder()\n\te = controller.Show(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// check the repo was hit\n\tif !repo.FindIDCalled {\n\t\tt.Error(\"Did not call repo.FindID\")\n\t}\n\n\tres := w.Result()\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// read and unmarshal the body\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\t// compare the expected and received channels\n\tif received.Name != wrt.Name {\n\t\tt.Fatalf(\"Expected: %+v. Actual: %+v.\", wrt, received)\n\t}\n\n\t// check show returns 404 for an invalid ID\n\tp = httprouter.Param{Key: \"id\", Value: \"-1\"}\n\ttest404(t, http.MethodGet, \"/channel/\"+p.Value, nil, controller.Show, p)\n}", "func TestChannelFactoryPattern(t *testing.T) {\n\tsuck(pump(5))\n\ttime.Sleep(1e9)\n}", "func (suite *KeeperTestSuite) TestChanOpenAck() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tcounterpartyChannelID string\n\t\tchannelCap *capabilitytypes.Capability\n\t\theightDiff uint64\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, true},\n\t\t{\"success with empty stored counterparty channel ID\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// set the channel's counterparty channel identifier to empty string\n\t\t\tchannel := path.EndpointA.GetChannel()\n\t\t\tchannel.Counterparty.ChannelId = \"\"\n\n\t\t\t// use a different channel identifier\n\t\t\tcounterpartyChannelID = path.EndpointB.ChannelID\n\n\t\t\tsuite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, true},\n\t\t{\"channel doesn't exist\", func() {}, false},\n\t\t{\"channel state is not INIT or TRYOPEN\", func() {\n\t\t\t// create fully open channels on both chains\n\t\t\tsuite.coordinator.Setup(path)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"connection not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\t// set the channel's connection hops to wrong connection ID\n\t\t\tchannel := path.EndpointA.GetChannel()\n\t\t\tchannel.ConnectionHops[0] = \"doesnotexist\"\n\t\t\tsuite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\n\t\t\terr := path.EndpointA.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\t// create channel in init\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr = path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tsuite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"consensus state not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\n\t\t\theightDiff = 3 // consensus state doesn't exist at this height\n\t\t}, false},\n\t\t{\"invalid counterparty channel identifier\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointB.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tcounterpartyChannelID = \"otheridentifier\"\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel verification failed\", func() {\n\t\t\t// chainB is INIT, chainA in TRYOPEN\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\n\t\t\terr := path.EndpointB.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\terr = path.EndpointA.ChanOpenTry()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tchannelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t\t}, false},\n\t\t{\"channel capability not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr := path.EndpointA.ChanOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tpath.EndpointB.ChanOpenTry()\n\n\t\t\tchannelCap = capabilitytypes.NewCapability(6)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\tcounterpartyChannelID = \"\" // must be explicitly changed in malleate\n\t\t\theightDiff = 0 // must be explicitly changed\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\tif counterpartyChannelID == \"\" {\n\t\t\t\tcounterpartyChannelID = ibctesting.FirstChannelID\n\t\t\t}\n\n\t\t\tif path.EndpointA.ClientID != \"\" {\n\t\t\t\t// ensure client is up to date\n\t\t\t\terr := path.EndpointA.UpdateClient()\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t}\n\n\t\t\tchannelKey := host.ChannelKey(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\t\t\tproof, proofHeight := suite.chainB.QueryProof(channelKey)\n\n\t\t\terr := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanOpenAck(\n\t\t\t\tsuite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channelCap, path.EndpointB.ChannelConfig.Version, counterpartyChannelID,\n\t\t\t\tproof, malleateHeight(proofHeight, heightDiff),\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func (m *MockCallResult) Channel() <-chan *Result {\n\targs := m.MethodCalled(\"Channel\")\n\n\tif resultChan := args.Get(0); resultChan != nil {\n\t\treturn resultChan.(<-chan *Result)\n\t}\n\n\treturn nil\n}", "func (scnb *SupplyChainNodeBuilder) requireProvider() bool {\n\tif scnb.currentProvider == nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (amqpSuite *AmqpSuite) ChannelConsumeTester() *amqp.ChannelTesting {\n\treturn amqpSuite.ChannelConsume().Test(amqpSuite.T())\n}", "func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints types.Constraints) error {\n\tif p.Metadata == nil {\n\t\treturn p.apiProvide(configurationChan, pool, constraints)\n\t}\n\treturn p.metadataProvide(configurationChan, pool, constraints)\n}", "func (suite *KeeperTestSuite) TestChanOpenTry() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tpreviousChannelID string\n\t\tportCap *capabilitytypes.Capability\n\t\theightDiff uint64\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, true},\n\t\t{\"success with crossing hello\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\terr := suite.coordinator.ChanOpenInitOnBothChains(path)\n\t\t\tsuite.Require().NoError(err)\n\n\t\t\tpreviousChannelID = path.EndpointB.ChannelID\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, true},\n\t\t{\"previous channel with invalid state\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\n\t\t\t// make previous channel have wrong ordering\n\t\t\tpath.EndpointA.ChanOpenInit()\n\t\t}, false},\n\t\t{\"connection doesn't exist\", func() {\n\t\t\tpath.EndpointA.ConnectionID = ibctesting.FirstConnectionID\n\t\t\tpath.EndpointB.ConnectionID = ibctesting.FirstConnectionID\n\n\t\t\t// pass capability check\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t\t{\"connection is not OPEN\", func() {\n\t\t\tsuite.coordinator.SetupClients(path)\n\t\t\t// pass capability check\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\n\t\t\terr := path.EndpointB.ConnOpenInit()\n\t\t\tsuite.Require().NoError(err)\n\t\t}, false},\n\t\t{\"consensus state not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\n\t\t\theightDiff = 3 // consensus state doesn't exist at this height\n\t\t}, false},\n\t\t{\"channel verification failed\", func() {\n\t\t\t// not creating a channel on chainA will result in an invalid proof of existence\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t\t{\"port capability not found\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\tportCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t\t{\"connection version not negotiated\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\t// modify connB versions\n\t\t\tconn := path.EndpointB.GetConnection()\n\n\t\t\tversion := connectiontypes.NewVersion(\"2\", []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"})\n\t\t\tconn.Versions = append(conn.Versions, version)\n\n\t\t\tsuite.chainB.App.GetIBCKeeper().ConnectionKeeper.SetConnection(\n\t\t\t\tsuite.chainB.GetContext(),\n\t\t\t\tpath.EndpointB.ConnectionID, conn,\n\t\t\t)\n\t\t\tsuite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainB.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t\t{\"connection does not support ORDERED channels\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tpath.SetChannelOrdered()\n\t\t\tpath.EndpointA.ChanOpenInit()\n\n\t\t\t// modify connA versions to only support UNORDERED channels\n\t\t\tconn := path.EndpointA.GetConnection()\n\n\t\t\tversion := connectiontypes.NewVersion(\"1\", []string{\"ORDER_UNORDERED\"})\n\t\t\tconn.Versions = []*connectiontypes.Version{version}\n\n\t\t\tsuite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(\n\t\t\t\tsuite.chainA.GetContext(),\n\t\t\t\tpath.EndpointA.ConnectionID, conn,\n\t\t\t)\n\t\t\tsuite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainA.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\tsuite.SetupTest() // reset\n\t\t\theightDiff = 0 // must be explicitly changed in malleate\n\t\t\tpreviousChannelID = \"\"\n\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\n\t\t\ttc.malleate()\n\n\t\t\tif path.EndpointB.ClientID != \"\" {\n\t\t\t\t// ensure client is up to date\n\t\t\t\terr := path.EndpointB.UpdateClient()\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t}\n\n\t\t\tcounterparty := types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID)\n\n\t\t\tchannelKey := host.ChannelKey(counterparty.PortId, counterparty.ChannelId)\n\t\t\tproof, proofHeight := suite.chainA.QueryProof(channelKey)\n\n\t\t\tchannelID, cap, err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanOpenTry(\n\t\t\t\tsuite.chainB.GetContext(), types.ORDERED, []string{path.EndpointB.ConnectionID},\n\t\t\t\tpath.EndpointB.ChannelConfig.PortID, previousChannelID, portCap, counterparty, path.EndpointB.ChannelConfig.Version, path.EndpointA.ChannelConfig.Version,\n\t\t\t\tproof, malleateHeight(proofHeight, heightDiff),\n\t\t\t)\n\n\t\t\tif tc.expPass {\n\t\t\t\tsuite.Require().NoError(err)\n\t\t\t\tsuite.Require().NotNil(cap)\n\n\t\t\t\tchanCap, ok := suite.chainB.App.GetScopedIBCKeeper().GetCapability(\n\t\t\t\t\tsuite.chainB.GetContext(),\n\t\t\t\t\thost.ChannelCapabilityPath(path.EndpointB.ChannelConfig.PortID, channelID),\n\t\t\t\t)\n\t\t\t\tsuite.Require().True(ok, \"could not retrieve channel capapbility after successful ChanOpenTry\")\n\t\t\t\tsuite.Require().Equal(chanCap.String(), cap.String(), \"channel capability is not correct\")\n\t\t\t} else {\n\t\t\t\tsuite.Require().Error(err)\n\t\t\t}\n\t\t})\n\t}\n}", "func getAPIChannel(c api.ChannelProvider) (api.Channel, error) {\n\tch, err := c.NewAPIChannel()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := ch.CheckCompatiblity(vpe.AllMessages()...); err != nil {\n\t\treturn nil, fmt.Errorf(\"compatibility check failed: %w\", err)\n\t}\n\tif err := ch.CheckCompatiblity(interfaces.AllMessages()...); err != nil {\n\t\tlogInfo(\"compatibility check failed: %v\", err)\n\t}\n\treturn ch, nil\n}", "func (suite *KeeperTestSuite) TestSetChannel() {\n\t// create client and connections on both chains\n\tpath := ibctesting.NewPath(suite.chainA, suite.chainB)\n\tsuite.coordinator.SetupConnections(path)\n\n\t// check for channel to be created on chainA\n\t_, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\tsuite.False(found)\n\n\tpath.SetChannelOrdered()\n\n\t// init channel\n\terr := path.EndpointA.ChanOpenInit()\n\tsuite.NoError(err)\n\n\tstoredChannel, found := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)\n\t// counterparty channel id is empty after open init\n\texpectedCounterparty := types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, \"\")\n\n\tsuite.True(found)\n\tsuite.Equal(types.INIT, storedChannel.State)\n\tsuite.Equal(types.ORDERED, storedChannel.Ordering)\n\tsuite.Equal(expectedCounterparty, storedChannel.Counterparty)\n}", "func (am AppModule) OnChanOpenTry(\n\tctx sdk.Context,\n\torder channeltypes.Order,\n\tconnectionHops []string,\n\tportID,\n\tchannelID string,\n\tchanCap *capabilitytypes.Capability,\n\tcounterparty channeltypes.Counterparty,\n\tversion,\n\tcounterpartyVersion string,\n) error {\n\t// TODO: Enforce ordering, currently relayers use ORDERED channels\n\n\tif counterparty.GetPortID() != commontypes.PortID {\n\t\treturn sdkerrors.Wrapf(porttypes.ErrInvalidPort, \"counterparty has invalid portid. expected: %s, got %s\", commontypes.PortID, counterparty.GetPortID())\n\t}\n\n\tif version != commontypes.Version {\n\t\treturn sdkerrors.Wrapf(porttypes.ErrInvalidPort, \"invalid version: %s, expected %s\", version, commontypes.Version)\n\t}\n\n\tif counterpartyVersion != commontypes.Version {\n\t\treturn sdkerrors.Wrapf(porttypes.ErrInvalidPort, \"invalid counterparty version: %s, expected %s\", counterpartyVersion, commontypes.Version)\n\t}\n\n\t// Claim channel capability passed back by IBC module\n\tif err := am.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {\n\t\treturn sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, err.Error()+\"by cross chanOpenTry\")\n\t}\n\n\t// TODO: escrow\n\treturn nil\n}", "func TestChannelOpenOnAClosedConnectionFails_ReleasesAllocatedChannel(t *testing.T) {\n\tconn := integrationConnection(t, \"releases channel allocation\")\n\tconn.Close()\n\n\tbefore := len(conn.channels)\n\n\tif _, err := conn.Channel(); err != ErrClosed {\n\t\tt.Fatalf(\"channel.open on a closed connection %#v is expected to fail\", conn)\n\t}\n\n\tif len(conn.channels) != before {\n\t\tt.Fatalf(\"channel.open failed, but the allocated channel was not released\")\n\t}\n}", "func eventTestChannelConsumer(c *Consumer, mt *msgtracker, expCnt int) {\n\tfor ev := range c.Events() {\n\t\tif !handleTestEvent(c, mt, expCnt, ev) {\n\t\t\tbreak\n\t\t}\n\t}\n}", "func (mdhth *MockDHTHandler) Provider(string, bool) error {\n\treturn nil\n}", "func (suite *KeeperTestSuite) TestChanOpenInit() {\n\tvar (\n\t\tpath *ibctesting.Path\n\t\tfeatures []string\n\t\tportCap *capabilitytypes.Capability\n\t)\n\n\ttestCases := []testCase{\n\t\t{\"success\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tfeatures = []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"}\n\t\t\tsuite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainA.GetPortCapability(ibctesting.MockPort)\n\t\t}, true},\n\t\t{\"channel already exists\", func() {\n\t\t\tsuite.coordinator.Setup(path)\n\t\t}, false},\n\t\t{\"connection doesn't exist\", func() {\n\t\t\t// any non-empty values\n\t\t\tpath.EndpointA.ConnectionID = \"connection-0\"\n\t\t\tpath.EndpointB.ConnectionID = \"connection-0\"\n\t\t}, false},\n\t\t{\"capability is incorrect\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\t\t\tfeatures = []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"}\n\t\t\tportCap = capabilitytypes.NewCapability(3)\n\t\t}, false},\n\t\t{\"connection version not negotiated\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\n\t\t\t// modify connA versions\n\t\t\tconn := path.EndpointA.GetConnection()\n\n\t\t\tversion := connectiontypes.NewVersion(\"2\", []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"})\n\t\t\tconn.Versions = append(conn.Versions, version)\n\n\t\t\tsuite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(\n\t\t\t\tsuite.chainA.GetContext(),\n\t\t\t\tpath.EndpointA.ConnectionID, conn,\n\t\t\t)\n\t\t\tfeatures = []string{\"ORDER_ORDERED\", \"ORDER_UNORDERED\"}\n\t\t\tsuite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainA.GetPortCapability(ibctesting.MockPort)\n\t\t}, false},\n\t\t{\"connection does not support ORDERED channels\", func() {\n\t\t\tsuite.coordinator.SetupConnections(path)\n\n\t\t\t// modify connA versions to only support UNORDERED channels\n\t\t\tconn := path.EndpointA.GetConnection()\n\n\t\t\tversion := connectiontypes.NewVersion(\"1\", []string{\"ORDER_UNORDERED\"})\n\t\t\tconn.Versions = []*connectiontypes.Version{version}\n\n\t\t\tsuite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(\n\t\t\t\tsuite.chainA.GetContext(),\n\t\t\t\tpath.EndpointA.ConnectionID, conn,\n\t\t\t)\n\t\t\t// NOTE: Opening UNORDERED channels is still expected to pass but ORDERED channels should fail\n\t\t\tfeatures = []string{\"ORDER_UNORDERED\"}\n\t\t\tsuite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort)\n\t\t\tportCap = suite.chainA.GetPortCapability(ibctesting.MockPort)\n\t\t}, true},\n\t}\n\n\tfor _, tc := range testCases {\n\t\ttc := tc\n\t\tsuite.Run(fmt.Sprintf(\"Case %s\", tc.msg), func() {\n\t\t\t// run test for all types of ordering\n\t\t\tfor _, order := range []types.Order{types.UNORDERED, types.ORDERED} {\n\t\t\t\tsuite.SetupTest() // reset\n\t\t\t\tpath = ibctesting.NewPath(suite.chainA, suite.chainB)\n\t\t\t\tpath.EndpointA.ChannelConfig.Order = order\n\t\t\t\tpath.EndpointB.ChannelConfig.Order = order\n\n\t\t\t\ttc.malleate()\n\n\t\t\t\tcounterparty := types.NewCounterparty(ibctesting.MockPort, ibctesting.FirstChannelID)\n\n\t\t\t\tchannelID, cap, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanOpenInit(\n\t\t\t\t\tsuite.chainA.GetContext(), path.EndpointA.ChannelConfig.Order, []string{path.EndpointA.ConnectionID},\n\t\t\t\t\tpath.EndpointA.ChannelConfig.PortID, portCap, counterparty, path.EndpointA.ChannelConfig.Version,\n\t\t\t\t)\n\n\t\t\t\t// check if order is supported by channel to determine expected behaviour\n\t\t\t\torderSupported := false\n\t\t\t\tfor _, f := range features {\n\t\t\t\t\tif f == order.String() {\n\t\t\t\t\t\torderSupported = true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Testcase must have expectedPass = true AND channel order supported before\n\t\t\t\t// asserting the channel handshake initiation succeeded\n\t\t\t\tif tc.expPass && orderSupported {\n\t\t\t\t\tsuite.Require().NoError(err)\n\t\t\t\t\tsuite.Require().NotNil(cap)\n\t\t\t\t\tsuite.Require().Equal(types.FormatChannelIdentifier(0), channelID)\n\n\t\t\t\t\tchanCap, ok := suite.chainA.App.GetScopedIBCKeeper().GetCapability(\n\t\t\t\t\t\tsuite.chainA.GetContext(),\n\t\t\t\t\t\thost.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, channelID),\n\t\t\t\t\t)\n\t\t\t\t\tsuite.Require().True(ok, \"could not retrieve channel capability after successful ChanOpenInit\")\n\t\t\t\t\tsuite.Require().Equal(chanCap.String(), cap.String(), \"channel capability is not correct\")\n\t\t\t\t} else {\n\t\t\t\t\tsuite.Require().Error(err)\n\t\t\t\t\tsuite.Require().Nil(cap)\n\t\t\t\t\tsuite.Require().Equal(\"\", channelID)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error {\n\tpool.GoCtx(func(routineCtx context.Context) {\n\t\tlogger := log.Ctx(routineCtx).With().Str(logs.ProviderName, dockerName).Logger()\n\t\tctxLog := logger.WithContext(routineCtx)\n\n\t\toperation := func() error {\n\t\t\tvar err error\n\t\t\tctx, cancel := context.WithCancel(ctxLog)\n\t\t\tdefer cancel()\n\n\t\t\tctx = log.Ctx(ctx).With().Str(logs.ProviderName, dockerName).Logger().WithContext(ctx)\n\n\t\t\tdockerClient, err := p.createClient(ctxLog)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error().Err(err).Msg(\"Failed to create Docker API client\")\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer func() { _ = dockerClient.Close() }()\n\n\t\t\tbuilder := NewDynConfBuilder(p.Shared, dockerClient)\n\n\t\t\tserverVersion, err := dockerClient.ServerVersion(ctx)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error().Err(err).Msg(\"Failed to retrieve information of the docker client and server host\")\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlogger.Debug().Msgf(\"Provider connection established with docker %s (API %s)\", serverVersion.Version, serverVersion.APIVersion)\n\n\t\t\tdockerDataList, err := p.listContainers(ctx, dockerClient)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error().Err(err).Msg(\"Failed to list containers for docker\")\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tconfiguration := builder.build(ctxLog, dockerDataList)\n\t\t\tconfigurationChan <- dynamic.Message{\n\t\t\t\tProviderName: dockerName,\n\t\t\t\tConfiguration: configuration,\n\t\t\t}\n\n\t\t\tif p.Watch {\n\t\t\t\tf := filters.NewArgs()\n\t\t\t\tf.Add(\"type\", \"container\")\n\t\t\t\toptions := dockertypes.EventsOptions{\n\t\t\t\t\tFilters: f,\n\t\t\t\t}\n\n\t\t\t\tstartStopHandle := func(m eventtypes.Message) {\n\t\t\t\t\tlogger.Debug().Msgf(\"Provider event received %+v\", m)\n\t\t\t\t\tcontainers, err := p.listContainers(ctx, dockerClient)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogger.Error().Err(err).Msg(\"Failed to list containers for docker\")\n\t\t\t\t\t\t// Call cancel to get out of the monitor\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tconfiguration := builder.build(ctx, containers)\n\t\t\t\t\tif configuration != nil {\n\t\t\t\t\t\tmessage := dynamic.Message{\n\t\t\t\t\t\t\tProviderName: dockerName,\n\t\t\t\t\t\t\tConfiguration: configuration,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselect {\n\t\t\t\t\t\tcase configurationChan <- message:\n\t\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\teventsc, errc := dockerClient.Events(ctx, options)\n\t\t\t\tfor {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase event := <-eventsc:\n\t\t\t\t\t\tif event.Action == \"start\" ||\n\t\t\t\t\t\t\tevent.Action == \"die\" ||\n\t\t\t\t\t\t\tstrings.HasPrefix(event.Action, \"health_status\") {\n\t\t\t\t\t\t\tstartStopHandle(event)\n\t\t\t\t\t\t}\n\t\t\t\t\tcase err := <-errc:\n\t\t\t\t\t\tif errors.Is(err, io.EOF) {\n\t\t\t\t\t\t\tlogger.Debug().Msg(\"Provider event stream closed\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn err\n\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\n\t\tnotify := func(err error, time time.Duration) {\n\t\t\tlogger.Error().Err(err).Msgf(\"Provider error, retrying in %s\", time)\n\t\t}\n\t\terr := backoff.RetryNotify(safe.OperationWithRecover(operation), backoff.WithContext(job.NewBackOff(backoff.NewExponentialBackOff()), ctxLog), notify)\n\t\tif err != nil {\n\t\t\tlogger.Error().Err(err).Msg(\"Cannot retrieve data\")\n\t\t}\n\t})\n\n\treturn nil\n}", "func AssertSent(t *testing.T, ch <-chan bool) {\n\ttimeout := time.After(10 * time.Second)\n\tselect {\n\tcase <-ch:\n\t\t// This case is ok\n\tcase <-timeout:\n\t\trequire.FailNow(t, \"Nothing sent on channel\")\n\t}\n}", "func TestGetNonExistentChannel(t *testing.T) {\n\tclearTable()\n\t// Generate JWT for authorization.\n\tvalidToken, err := auth.GenerateJWT()\n\tif err != nil {\n\t\tt.Error(\"Failed to generate token\")\n\t}\n\treq, _ := http.NewRequest(\"GET\", \"/api/channel/\"+channelTestID.String(), nil)\n\t// Add \"Token\" header to request with generated token.\n\treq.Header.Add(\"Token\", validToken)\n\tresponse := executeRequest(req)\n\n\tcheckResponseCode(t, http.StatusNotFound, response.Code)\n\n\tvar m map[string]string\n\tjson.Unmarshal(response.Body.Bytes(), &m)\n\tif m[\"error\"] != \"Channel not found\" {\n\t\tt.Errorf(\"Expected the 'error' key of the response to be set to 'Channel not found'. Got '%s'\", m[\"error\"])\n\t}\n}", "func TestChannelClientBasic(t *testing.T) {\n\tc := make(chan *http.Response, 10)\n\tclient := cloudtest.NewChannelClient(c)\n\n\tresp := &http.Response{}\n\tresp.StatusCode = http.StatusOK\n\tresp.Status = \"OK\"\n\tc <- resp\n\tresp, err := client.Get(\"http://foobar\")\n\tlog.Printf(\"%v\\n\", resp)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tt.Error(\"Response should be OK: \", resp.Status)\n\t}\n}", "func (mr *MockClientMockRecorder) InfraProvider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"InfraProvider\", reflect.TypeOf((*MockClient)(nil).InfraProvider))\n}", "func (amqpSuite *AmqpSuite) ChannelPublishTester() *amqp.ChannelTesting {\n\treturn amqpSuite.channelPublish.Test(amqpSuite.T())\n}", "func (mr *MockProviderMockRecorder) Provide(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Provide\", reflect.TypeOf((*MockProvider)(nil).Provide), arg0)\n}", "func (_m *AuthServer) mustEmbedUnimplementedAuthServer() {\n\t_m.Called()\n}", "func allowedChan(f *fact, m slack.Msg) bool {\n\tif len(f.RestrictToChannelsID) > 0 {\n\t\tfor _, rc := range f.RestrictToChannelsID {\n\t\t\tif rc == m.Channel {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *SwitchTicker) Channel() <-chan time.Time {\n\tfailCount := atomic.LoadInt64(&c.failCount)\n\tif failCount > c.threshold {\n\t\treturn c.fastTicker.C\n\t}\n\treturn c.slowTicker.C\n}", "func isValidChannel(f corev1.ObjectReference) *apis.FieldError {\n\treturn IsValidObjectReference(f)\n}", "func (t *Transport) ChannelConnectivityStateForTesting() connectivity.State {\n\treturn t.cc.GetState()\n}", "func IsChannel(data interface{}) bool {\n\treturn typeIs(data, reflect.Chan)\n}", "func ChannelValidator(c Channel) error {\n\tswitch c {\n\tcase ChannelShopee, ChannelDirect:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"outboundtransaction: invalid enum value for channel field: %q\", c)\n\t}\n}", "func (o *Invoice) GetChannelOk() (*string, bool) {\n\tif o == nil || o.Channel == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Channel, true\n}", "func (_m *Socket) WriteChannel() chan<- *packet.Packet {\n\tret := _m.Called()\n\n\tvar r0 chan<- *packet.Packet\n\tif rf, ok := ret.Get(0).(func() chan<- *packet.Packet); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(chan<- *packet.Packet)\n\t\t}\n\t}\n\n\treturn r0\n}", "func TestChannelIndex(t *testing.T) {\n\t// mock All function\n\tfn := func(_ context.Context) ([]are_hub.Channel, error) {\n\t\treturn channels, nil\n\t}\n\n\t// create the mock repo and controller\n\trepo := &mock.ChannelRepo{AllFunc: fn}\n\tcontroller := NewChannel(repo)\n\n\t// create a mock request\n\treq, e := http.NewRequest(http.MethodGet, \"/channel\", nil)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// create a response recorder and run the controller method\n\tw := httptest.NewRecorder()\n\te = controller.Index(w, req)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\t// get the response\n\tres := w.Result()\n\n\t// check if the repo was hit\n\tif !repo.AllCalled {\n\t\tt.Error(\"Did not call repo.All\")\n\t}\n\n\t// ensure the content type is application/json\n\tcheckCT(res, t)\n\n\t// extract the body and confirm all data 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\tvar received []are_hub.Channel\n\te = json.Unmarshal(body, &received)\n\n\tif e != nil {\n\t\tt.Fatal(e)\n\t}\n\n\tlr := len(received)\n\tlc := len(channels)\n\n\t// check that all channels were returned\n\tif lr != lc {\n\t\tt.Fatalf(\"Expected: %d channels. Actual: %d.\", lc, lr)\n\t}\n\n\t// loop and ensure the data is correct\n\tfor i := 0; i < lr; i++ {\n\t\tif received[i].Name != channels[i].Name {\n\t\t\tt.Fatalf(\"Expected: %s. Actual: %s.\", channels[i].Name, received[i].Name)\n\t\t}\n\t}\n}", "func HasPrimaryPeerJoinedChannel(client fab.FabricClient, orgUser ca.User, channel fab.Channel) (bool, error) {\n\tfoundChannel := false\n\tprimaryPeer := channel.PrimaryPeer()\n\n\tcurrentUser := client.UserContext()\n\tdefer client.SetUserContext(currentUser)\n\n\tclient.SetUserContext(orgUser)\n\tresponse, err := client.QueryChannels(primaryPeer)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"Error querying channel for primary peer: %s\", err)\n\t}\n\tlog.Println(\"channel num: \",len(response.Channels))\n\tfor _, responseChannel := range response.Channels {\n\t\tlog.Println(\"channel ----------> : \",responseChannel.ChannelId)\n\t\tif responseChannel.ChannelId == channel.Name() {\n\t\t\tfoundChannel = true\n\t\t}\n\t}\n\treturn foundChannel, nil\n}", "func TestChannelFull(t *testing.T) {\n\ticmpPackets := make(chan gopacket.Packet, 100)\n\tvar data []byte\n\tdata = nil\n\tpacket := gopacket.NewPacket(data, layers.LayerTypeEthernet, gopacket.Default)\n\n\tvar err error\n\terr = nil\n\ti := 0\n\tfor err == nil {\n\t\ti++\n\t\terr = putChannel(packet, icmpPackets)\n\t\tif i > 200 {\n\t\t\tt.Error(\"Channel should be full and there should be an error but there isn't.\")\n\t\t}\n\t}\n}", "func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints types.Constraints) error {\n\tif p.APIVersion == \"\" {\n\t\tp.APIVersion = sf.DefaultAPIVersion\n\t}\n\n\ttlsConfig, err := p.TLS.CreateTLSConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsfClient, err := sf.NewClient(http.DefaultClient, p.ClusterManagementURL, p.APIVersion, tlsConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif p.RefreshSeconds <= 0 {\n\t\tp.RefreshSeconds = 10\n\t}\n\n\treturn p.updateConfig(configurationChan, pool, sfClient, time.Duration(p.RefreshSeconds)*time.Second)\n}", "func (mr *MockBootstrapperProviderMockRecorder) Provide() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Provide\", reflect.TypeOf((*MockBootstrapperProvider)(nil).Provide))\n}", "func (o *NotificationConfig) GetChannelOk() (*string, bool) {\n\tif o == nil || o.Channel == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Channel, true\n}", "func (res channelBase) Invoker() auth.Identifiable {\n\treturn res.invoker\n}", "func (a *MockAction) ChannelClient() (*channel.Client, error) {\n\tpanic(\"not implemented\")\n}", "func (cm *ConnectionManager) WantsMoreChannels() bool {\n\t_, ok := cm.raiden.MessageHandler.blockedTokens[cm.tokenAddress]\n\tif ok {\n\t\treturn false\n\t}\n\treturn cm.fundsRemaining().Cmp(utils.BigInt0) > 0 && len(cm.openChannels()) < int(cm.initChannelTarget)\n}", "func (_m *Knapsack) UpdateChannel() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}", "func set_channel(c spi.Conn, channel uint8) {\n\tif (channel > 125) {\n\t\tchannel = 125\n\t}\n\twrite_register(c, RfCh, channel)\n}", "func (mr *MockCandidatePropertyGetterMockRecorder) Cloudprovider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Cloudprovider\", reflect.TypeOf((*MockCandidatePropertyGetter)(nil).Cloudprovider))\n}", "func TestDontWaitForOtherProvidersIfWeGotError(t *testing.T) {\n\tstart := time.Now()\n\n\tappCustom := App{\n\t\tContentProvider: NewContentProviderService(\n\t\t\tmap[Provider]Client{\n\t\t\t\tProvider1: &ClientMock{\n\t\t\t\t\tGetContentFn: func(userIP string, count int) ([]*ContentItem, error) {\n\t\t\t\t\t\treturn []*ContentItem{}, errors.New(\"some error from provider 1\")\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tProvider2: &ClientMock{\n\t\t\t\t\tGetContentFn: func(userIP string, count int) ([]*ContentItem, error) {\n\t\t\t\t\t\treturn []*ContentItem{}, errors.New(\"some error from provider 2\")\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tProvider3: &ClientMock{\n\t\t\t\t\tGetContentFn: func(userIP string, count int) ([]*ContentItem, error) {\n\t\t\t\t\t\t// let's imitate some pending request to provider\n\t\t\t\t\t\ttime.Sleep(5 * time.Second)\n\t\t\t\t\t\treturn []*ContentItem{{\n\t\t\t\t\t\t\tSource: \"3\",\n\t\t\t\t\t\t}}, nil\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tDefaultConfig,\n\t\t\tWithTimeOut(500*time.Millisecond),\n\t\t),\n\t}\n\n\tcontent := runRequest(t, appCustom, SimpleContentRequest)\n\n\tif len(content) != 0 {\n\t\tt.Fatalf(\"Got %d items back, want 0\", len(content))\n\t}\n\n\texecTime := time.Since(start)\n\tif execTime > time.Second {\n\t\tt.Fatalf(\"test time should be less then 1 second, got: %s\", execTime)\n\t}\n}", "func verified(srvChan chan string, channel, nick, hostname string, args []string) {\n\tmessage := \"NOTICE \" + channel + \" :\"\n\tif len(args) != 1 {\n\t\tmessage += \":ERROR: Invalid number of arguments\"\n\t} else {\n\t\tuname := args[0]\n\t\tif checkVerified(uname, hostname) {\n\t\t\tmessage += \"You are \" + uname + \" at \" + hostname\n\t\t} else {\n\t\t\tmessage += \"You are not \" + uname\n\t\t}\n\t}\n\tlog.Println(message)\n\tsrvChan <- message\n}", "func TestChannelEvents(t *testing.T) {\n\ttc := testutil.SystemTest(t)\n\tbuf := &bytes.Buffer{}\n\n\t// Test setup\n\n\t// Stop and delete the default channel if it exists\n\tif err := getChannel(buf, tc.ProjectID, location, channelID); err == nil {\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := stopChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\t\t// Ignore the error when the channel is already stopped.\n\t\t\t}\n\t\t})\n\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := deleteChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\t\tr.Errorf(\"deleteChannel got err: %v\", err)\n\t\t\t}\n\t\t})\n\t}\n\n\t// Delete the default input if it exists\n\tif err := getInput(buf, tc.ProjectID, location, inputID); err == nil {\n\t\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\t\tif err := deleteInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\t\tr.Errorf(\"deleteInput got err: %v\", err)\n\t\t\t}\n\t\t})\n\t}\n\n\t// Create a new input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tinputName := fmt.Sprintf(\"projects/%s/locations/%s/inputs/%s\", tc.ProjectID, location, inputID)\n\t\tif err := createInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\tr.Errorf(\"createInput got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, inputName) {\n\t\t\tr.Errorf(\"createInput got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, inputName)\n\t\t}\n\t})\n\n\t// Create a new channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tchannelName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s\", tc.ProjectID, location, channelID)\n\t\tif err := createChannel(buf, tc.ProjectID, location, channelID, inputID, outputURI); err != nil {\n\t\t\tr.Errorf(\"createChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, channelName) {\n\t\t\tr.Errorf(\"createChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, channelName)\n\t\t}\n\t})\n\n\t// Start the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := startChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"startChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, startChannelResponse) {\n\t\t\tr.Errorf(\"startChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, startChannelResponse)\n\t\t}\n\t})\n\n\tbuf.Reset()\n\n\t// Tests\n\n\t// Create a new channel event.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\teventName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s/events/%s\", tc.ProjectID, location, channelID, eventID)\n\t\tif err := createChannelEvent(buf, tc.ProjectID, location, channelID, eventID); err != nil {\n\t\t\tr.Errorf(\"createChannelEvent got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, eventName) {\n\t\t\tr.Errorf(\"createChannelEvent got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, eventName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// List the channel events for a given channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\teventName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s/events/%s\", tc.ProjectID, location, channelID, eventID)\n\t\tif err := listChannelEvents(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"listChannelEvents got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, eventName) {\n\t\t\tr.Errorf(\"listChannelEvents got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, eventName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Get the channel event.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\teventName := fmt.Sprintf(\"projects/%s/locations/%s/channels/%s/events/%s\", tc.ProjectID, location, channelID, eventID)\n\t\tif err := getChannelEvent(buf, tc.ProjectID, location, channelID, eventID); err != nil {\n\t\t\tr.Errorf(\"getChannelEvent got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, eventName) {\n\t\t\tr.Errorf(\"getChannelEvent got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, eventName)\n\t\t}\n\t})\n\tbuf.Reset()\n\n\t// Delete the channel event.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteChannelEvent(buf, tc.ProjectID, location, channelID, eventID); err != nil {\n\t\t\tr.Errorf(\"deleteChannelEvent got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteChannelEventResponse) {\n\t\t\tr.Errorf(\"deleteChannelEvent got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteChannelEventResponse)\n\t\t}\n\t})\n\n\t// Clean up\n\n\t// Stop the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := stopChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"stopChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, stopChannelResponse) {\n\t\t\tr.Errorf(\"stopChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, stopChannelResponse)\n\t\t}\n\t})\n\n\t// Delete the channel.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteChannel(buf, tc.ProjectID, location, channelID); err != nil {\n\t\t\tr.Errorf(\"deleteChannel got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteChannelResponse) {\n\t\t\tr.Errorf(\"deleteChannel got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteChannelResponse)\n\t\t}\n\t})\n\n\t// Delete the input.\n\ttestutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) {\n\t\tif err := deleteInput(buf, tc.ProjectID, location, inputID); err != nil {\n\t\t\tr.Errorf(\"deleteInput got err: %v\", err)\n\t\t}\n\t\tif got := buf.String(); !strings.Contains(got, deleteInputResponse) {\n\t\t\tr.Errorf(\"deleteInput got\\n----\\n%v\\n----\\nWant to contain:\\n----\\n%v\\n----\\n\", got, deleteInputResponse)\n\t\t}\n\t})\n\tt.Logf(\"\\nTestChannelEvents() completed\\n\")\n}", "func (amqpSuite *AmqpSuite) ChannelConsume() *amqp.Channel {\n\tif amqpSuite.channelConsume != nil {\n\t\treturn amqpSuite.channelConsume\n\t}\n\tamqpSuite.channelConsume = amqpSuite.getChannel(amqpSuite.ConnConsume())\n\treturn amqpSuite.channelConsume\n}", "func TestProducerChannelDR(t *testing.T) {\n\tproducerTest(t, \"Channel producer (with DR)\",\n\t\tnil, producerCtrl{withDr: true},\n\t\tfunc(p *Producer, m *Message, drChan chan Event) {\n\t\t\tp.ProduceChannel() <- m\n\t\t})\n\n}", "func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints types.Constraints) error {\n\tlog.Debugf(\"Providing Provider...\")\n\tp.Constraints = append(p.Constraints, constraints...)\n\thandleCanceled := func(ctx context.Context, err error) error {\n\t\tif ctx.Err() == context.Canceled || err == context.Canceled {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tpool.Go(func(stop chan bool) {\n\t\tctx, cancel := context.WithCancel(context.Background())\n\t\tgo func() {\n\t\t\tselect {\n\t\t\tcase <-stop:\n\t\t\t\tcancel()\n\t\t\t}\n\t\t}()\n\n\t\toperation := func() error {\n\t\t\taws, err := p.createClient()\n\t\t\tif err != nil {\n\t\t\t\treturn handleCanceled(ctx, err)\n\t\t\t}\n\n\t\t\tconfiguration, err := p.loadPostgresConfig(aws)\n\t\t\tif err != nil {\n\t\t\t\treturn handleCanceled(ctx, err)\n\t\t\t}\n\n\t\t\tconfigurationChan <- types.ConfigMessage{\n\t\t\t\tProviderName: \"postgres\",\n\t\t\t\tConfiguration: configuration,\n\t\t\t}\n\n\t\t\tif p.Watch {\n\t\t\t\treload := time.NewTicker(time.Second * time.Duration(p.RefreshSeconds))\n\t\t\t\tdefer reload.Stop()\n\t\t\t\tfor {\n\t\t\t\t\tlog.Debug(\"Watching Provider...\")\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-reload.C:\n\t\t\t\t\t\tconfiguration, err := p.loadPostgresConfig(aws)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn handleCanceled(ctx, err)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconfigurationChan <- types.ConfigMessage{\n\t\t\t\t\t\t\tProviderName: \"postgres\",\n\t\t\t\t\t\t\tConfiguration: configuration,\n\t\t\t\t\t\t}\n\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\treturn handleCanceled(ctx, ctx.Err())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tnotify := func(err error, time time.Duration) {\n\t\t\tlog.Errorf(\"Provider error: %s time: %v\", err.Error(), time)\n\t\t}\n\n\t\terr := backoff.RetryNotify(safe.OperationWithRecover(operation), job.NewBackOff(backoff.NewExponentialBackOff()), notify)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to connect to Provider. %s\", err.Error())\n\t\t}\n\t})\n\treturn nil\n}", "func NewChannel() Channel {\n\t// dependency injection? never heard of it...\n\treturn Channel{request{validator.New()}}\n}", "func TestGetChannel(t *testing.T) {\n\tclearTable()\n\taddChannel(1)\n\t// Generate JWT for authorization.\n\tvalidToken, err := auth.GenerateJWT()\n\tif err != nil {\n\t\tt.Error(\"Failed to generate token\")\n\t}\n\n\treq, _ := http.NewRequest(\"GET\", \"/api/channel/\"+channelTestID.String(), nil)\n\t// Add \"Token\" header to request with generated token.\n\treq.Header.Add(\"Token\", validToken)\n\tresponse := executeRequest(req)\n\n\tcheckResponseCode(t, http.StatusOK, response.Code)\n}", "func (_m *MockMessageProducer) ProduceChannel() chan *kafka.Message {\n\tret := _m.Called()\n\n\tvar r0 chan *kafka.Message\n\tif rf, ok := ret.Get(0).(func() chan *kafka.Message); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(chan *kafka.Message)\n\t\t}\n\t}\n\n\treturn r0\n}", "func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool) error {\n\toperation := func() error {\n\t\tconfig := marathon.NewDefaultConfig()\n\t\tconfig.URL = p.Endpoint\n\t\tconfig.EventsTransport = marathon.EventsTransportSSE\n\t\tif p.Trace {\n\t\t\tconfig.LogOutput = log.CustomWriterLevel(logrus.DebugLevel, traceMaxScanTokenSize)\n\t\t}\n\t\tif p.Basic != nil {\n\t\t\tconfig.HTTPBasicAuthUser = p.Basic.HTTPBasicAuthUser\n\t\t\tconfig.HTTPBasicPassword = p.Basic.HTTPBasicPassword\n\t\t}\n\t\tvar rc *readinessChecker\n\t\tif p.RespectReadinessChecks {\n\t\t\tlog.Debug(\"Enabling Marathon readiness checker\")\n\t\t\trc = defaultReadinessChecker(p.Trace)\n\t\t}\n\t\tp.readyChecker = rc\n\n\t\tif len(p.DCOSToken) > 0 {\n\t\t\tconfig.DCOSToken = p.DCOSToken\n\t\t}\n\t\tTLSConfig, err := p.TLS.CreateTLSConfig()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tconfig.HTTPClient = &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tDialContext: (&net.Dialer{\n\t\t\t\t\tKeepAlive: time.Duration(p.KeepAlive),\n\t\t\t\t\tTimeout: time.Duration(p.DialerTimeout),\n\t\t\t\t}).DialContext,\n\t\t\t\tResponseHeaderTimeout: time.Duration(p.ResponseHeaderTimeout),\n\t\t\t\tTLSHandshakeTimeout: time.Duration(p.TLSHandshakeTimeout),\n\t\t\t\tTLSClientConfig: TLSConfig,\n\t\t\t},\n\t\t}\n\t\tclient, err := marathon.NewClient(config)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to create a client for marathon, error: %s\", err)\n\t\t\treturn err\n\t\t}\n\t\tp.marathonClient = client\n\n\t\tif p.Watch {\n\t\t\tupdate, err := client.AddEventsListener(marathonEventIDs)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to register for events, %s\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpool.Go(func(stop chan bool) {\n\t\t\t\tdefer close(update)\n\t\t\t\tfor {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-stop:\n\t\t\t\t\t\treturn\n\t\t\t\t\tcase event := <-update:\n\t\t\t\t\t\tlog.Debugf(\"Received provider event %s\", event)\n\n\t\t\t\t\t\tconfiguration := p.getConfiguration()\n\t\t\t\t\t\tif configuration != nil {\n\t\t\t\t\t\t\tconfigurationChan <- types.ConfigMessage{\n\t\t\t\t\t\t\t\tProviderName: \"marathon\",\n\t\t\t\t\t\t\t\tConfiguration: configuration,\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\n\t\tconfiguration := p.getConfiguration()\n\t\tconfigurationChan <- types.ConfigMessage{\n\t\t\tProviderName: \"marathon\",\n\t\t\tConfiguration: configuration,\n\t\t}\n\t\treturn nil\n\t}\n\n\tnotify := func(err error, time time.Duration) {\n\t\tlog.Errorf(\"Provider connection error %+v, retrying in %s\", err, time)\n\t}\n\terr := backoff.RetryNotify(safe.OperationWithRecover(operation), job.NewBackOff(backoff.NewExponentialBackOff()), notify)\n\tif err != nil {\n\t\tlog.Errorf(\"Cannot connect to Provider server %+v\", err)\n\t}\n\treturn nil\n}", "func (r AuthenticationMethodsReferences) ChannelBrowser() bool {\n\treturn r.UsernameAndPassword || r.TOTP || r.WebAuthn\n}", "func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints types.Constraints) error {\n\tp.Constraints = append(p.Constraints, constraints...)\n\toperation := func() error {\n\t\tconfig := marathon.NewDefaultConfig()\n\t\tconfig.URL = p.Endpoint\n\t\tconfig.EventsTransport = marathon.EventsTransportSSE\n\t\tif p.Trace {\n\t\t\tconfig.LogOutput = log.CustomWriterLevel(logrus.DebugLevel, traceMaxScanTokenSize)\n\t\t}\n\t\tif p.Basic != nil {\n\t\t\tconfig.HTTPBasicAuthUser = p.Basic.HTTPBasicAuthUser\n\t\t\tconfig.HTTPBasicPassword = p.Basic.HTTPBasicPassword\n\t\t}\n\t\tvar rc *readinessChecker\n\t\tif p.RespectReadinessChecks {\n\t\t\tlog.Debug(\"Enabling Marathon readiness checker\")\n\t\t\trc = defaultReadinessChecker(p.Trace)\n\t\t}\n\t\tp.readyChecker = rc\n\n\t\tif len(p.DCOSToken) > 0 {\n\t\t\tconfig.DCOSToken = p.DCOSToken\n\t\t}\n\t\tTLSConfig, err := p.TLS.CreateTLSConfig()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tconfig.HTTPClient = &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tDialContext: (&net.Dialer{\n\t\t\t\t\tKeepAlive: time.Duration(p.KeepAlive),\n\t\t\t\t\tTimeout: time.Duration(p.DialerTimeout),\n\t\t\t\t}).DialContext,\n\t\t\t\tTLSClientConfig: TLSConfig,\n\t\t\t},\n\t\t}\n\t\tclient, err := marathon.NewClient(config)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to create a client for marathon, error: %s\", err)\n\t\t\treturn err\n\t\t}\n\t\tp.marathonClient = client\n\n\t\tif p.Watch {\n\t\t\tupdate, err := client.AddEventsListener(marathonEventIDs)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to register for events, %s\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpool.Go(func(stop chan bool) {\n\t\t\t\tdefer close(update)\n\t\t\t\tfor {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-stop:\n\t\t\t\t\t\treturn\n\t\t\t\t\tcase event := <-update:\n\t\t\t\t\t\tlog.Debugf(\"Received provider event %s\", event)\n\t\t\t\t\t\tconfiguration := p.loadMarathonConfig()\n\t\t\t\t\t\tif configuration != nil {\n\t\t\t\t\t\t\tconfigurationChan <- types.ConfigMessage{\n\t\t\t\t\t\t\t\tProviderName: \"marathon\",\n\t\t\t\t\t\t\t\tConfiguration: configuration,\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\tconfiguration := p.loadMarathonConfig()\n\t\tconfigurationChan <- types.ConfigMessage{\n\t\t\tProviderName: \"marathon\",\n\t\t\tConfiguration: configuration,\n\t\t}\n\t\treturn nil\n\t}\n\n\tnotify := func(err error, time time.Duration) {\n\t\tlog.Errorf(\"Provider connection error %+v, retrying in %s\", err, time)\n\t}\n\terr := backoff.RetryNotify(safe.OperationWithRecover(operation), job.NewBackOff(backoff.NewExponentialBackOff()), notify)\n\tif err != nil {\n\t\tlog.Errorf(\"Cannot connect to Provider server %+v\", err)\n\t}\n\treturn nil\n}", "func deleteChannel(t *testing.T, kafkaClient kafkaclientset.KafkaChannelInterface, name string) {\n\tt.Helper()\n\n\terr := kafkaClient.Delete(name, &v1.DeleteOptions{})\n\tswitch {\n\tcase errors.IsGone(err):\n\tcase errors.IsNotFound(err):\n\t\tt.Logf(\"tried to delete Kafka channel: %s but it was already deleted\", name)\n\tcase err != nil:\n\t\tt.Fatalf(\"cannot delete Kafka channel %v, Error: %v\", name, err)\n\tdefault:\n\t\tt.Logf(\"deleted Kafka channel: %s\", name)\n\t}\n}", "func TestDefaultProviderIsWarnOnceProvider(t *testing.T) {\n\t// create logger that writes to buffer using the default logger provider\n\tbuf := &bytes.Buffer{}\n\tlogger := svc1log.New(buf, wlog.DebugLevel) // uses default provider\n\n\t// verify that output provides warning that no logger provider was specified\n\tlogger.Info(\"Test output 1\")\n\tconst wantOutput = `[WARNING] Logging operation that uses the default logger provider was performed without specifying a logger provider implementation. To see logger output, set the global logger provider implementation using wlog.SetDefaultLoggerProvider or by importing an implementation. This warning can be disabled by setting the global logger provider to be the noop logger provider using wlog.SetDefaultLoggerProvider(wlog.NewNoopLoggerProvider()).` + \"\\n\"\n\tgot := buf.String()\n\tassert.Equal(t, wantOutput, got)\n\n\t// verify that warning is only written on first call to logger\n\tlogger.Info(\"Test output 2\")\n\tbuf.Reset()\n\tgot = buf.String()\n\tassert.Equal(t, \"\", got)\n}", "func (_m *ISession) Channel(channelID string, options ...discordgo.RequestOption) (*discordgo.Channel, error) {\n\t_va := make([]interface{}, len(options))\n\tfor _i := range options {\n\t\t_va[_i] = options[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, channelID)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *discordgo.Channel\n\tvar r1 error\n\tif rf, ok := ret.Get(0).(func(string, ...discordgo.RequestOption) (*discordgo.Channel, error)); ok {\n\t\treturn rf(channelID, options...)\n\t}\n\tif rf, ok := ret.Get(0).(func(string, ...discordgo.RequestOption) *discordgo.Channel); ok {\n\t\tr0 = rf(channelID, options...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*discordgo.Channel)\n\t\t}\n\t}\n\n\tif rf, ok := ret.Get(1).(func(string, ...discordgo.RequestOption) error); ok {\n\t\tr1 = rf(channelID, options...)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func BotHasChannelPermission(session *discordgo.Session, channel *discordgo.Channel) error {\n\tpermissions, err := session.UserChannelPermissions(session.State.User.ID, channel.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to determine channel permissions: %w\", err)\n\t}\n\n\tif permissions&discordgo.PermissionViewChannel != discordgo.PermissionViewChannel {\n\t\treturn fmt.Errorf(\"insufficient channel permissions: channel: %s\", channel.Name)\n\t}\n\n\treturn nil\n}", "func TestClock_AfterApplyInterval(t *testing.T) {\n\tc := raft.NewClock()\n\tc.ApplyInterval = 10 * time.Millisecond\n\tt0 := time.Now()\n\t<-c.AfterApplyInterval()\n\tif d := time.Since(t0); d < c.ApplyInterval {\n\t\tt.Fatalf(\"channel fired too soon: %v\", d)\n\t}\n}", "func TestRawCanChannelMultiplexWorks(t *testing.T) {\n\tmessage := RawCanFrame{ID: 555}\n\tres1 := RawCanFrame{}\n\tres2 := RawCanFrame{}\n\tcanIn := make(chan RawCanFrame)\n\tout1 := make(chan RawCanFrame)\n\tout2 := make(chan RawCanFrame)\n\n\tgo RawCanChannelMultiplex(canIn, out1, out2)\n\tcanIn <- message\n\tres1 = <-out1\n\tres2 = <-out2\n\tclose(canIn)\n\n\tif !CompareRawFrames(res1, message) {\n\t\tt.Error(\"The CAN frames did not match\")\n\t}\n\tif !CompareRawFrames(res2, message) {\n\t\tt.Error(\"The CAN frames did not match\")\n\t}\n}", "func handleNewChannel(newChannel ssh.NewChannel, sshRuntime *sshConnectionRuntime, app *applicationItemData) {\n\tchType := newChannel.ChannelType()\n\n\tswitch chType {\n\tcase comm_app.ProvideSSHChannelType:\n\t\t// this commands is not for Intent application type\n\t\tif !app.appIntentType {\n\t\t\terr := app.provideApplication(newChannel, sshRuntime)\n\t\t\tif err != nil {\n\t\t\t\t// create transport container\n\t\t\t\treplyData, errLocal := comm_app.ErrorViaCommunicationContainer(err.Error())\n\t\t\t\tif errLocal != nil {\n\t\t\t\t\tapp.logger.Errorf(\"Can't create communication error object for received provide channel creation request from %s due to: %v\", BrokerInfo(sshRuntime), errLocal)\n\t\t\t\t\tnewChannel.Reject(ssh.ConnectionFailed, \"\")\n\t\t\t\t} else {\n\t\t\t\t\tnewChannel.Reject(ssh.ConnectionFailed, string(replyData))\n\t\t\t\t}\n\t\t\t\t// because something goes wrong, we doesn't reset provide negiate status until connection closed\n\t\t\t}\n\t\t} else {\n\t\t\t// create transport container\n\t\t\treplyData, errLocal := comm_app.ErrorViaCommunicationContainer(\"Internally unsupported payload struct type\")\n\t\t\tif errLocal != nil {\n\t\t\t\tapp.logger.Errorf(\"Can't create communication error object for received unsupported channel creation request from %s due to: %v\", BrokerInfo(sshRuntime), errLocal)\n\t\t\t\tnewChannel.Reject(ssh.ConnectionFailed, \"\")\n\t\t\t} else {\n\t\t\t\tnewChannel.Reject(ssh.ConnectionFailed, string(replyData))\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tapp.logger.Warnf(\"Unsupported channel type %s detected in connection from %s\", chType, BrokerInfo(sshRuntime))\n\n\t\t// create transport container\n\t\treplyData, errLocal := comm_app.ErrorViaCommunicationContainer(fmt.Sprintf(\"Unsupported channel type: %s detected\", chType))\n\t\tif errLocal != nil {\n\t\t\tapp.logger.Errorf(\"Can't create communication error object for received unsupported channel creation request from %s due to: %v\", BrokerInfo(sshRuntime), errLocal)\n\t\t\tnewChannel.Reject(ssh.ConnectionFailed, \"\")\n\t\t} else {\n\t\t\tnewChannel.Reject(ssh.ConnectionFailed, string(replyData))\n\t\t}\n\t}\n}", "func (e EEPROM) ChannelDriver(c Channel) bool {\n\treturn e.channelValue(channelDriver, c) != 0\n}", "func TestBasicMethodChannelStringCodecSend(t *testing.T) {\n\tcodec := StringCodec{}\n\tmessenger := NewTestingBinaryMessenger()\n\tmessenger.MockSetChannelHandler(\"ch\", func(encodedMessage []byte, r ResponseSender) error {\n\t\tmessage, err := codec.DecodeMessage(encodedMessage)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to decode message\")\n\t\t}\n\t\tmessageString, ok := message.(string)\n\t\tif !ok {\n\t\t\treturn errors.New(\"message is invalid type, expected string\")\n\t\t}\n\t\treply := messageString + \" world\"\n\t\tencodedReply, err := codec.EncodeMessage(reply)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to encode message\")\n\t\t}\n\t\tr.Send(encodedReply)\n\t\treturn nil\n\t})\n\tchannel := NewBasicMessageChannel(messenger, \"ch\", codec)\n\treply, err := channel.SendWithReply(\"hello\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Log(spew.Sdump(reply))\n\treplyString, ok := reply.(string)\n\tif !ok {\n\t\tt.Fatal(\"reply is invalid type, expected string\")\n\t}\n\tEqual(t, \"hello world\", replyString)\n}", "func (mr *MockProvidersMockRecorder) InfraProvider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"InfraProvider\", reflect.TypeOf((*MockProviders)(nil).InfraProvider))\n}", "func (cp *MockChannelProvider) SetChannel(id string, channel fab.Channel) {\n\tcp.channels[id] = channel\n}", "func (s *Server) ExposeChannel() (string, chan interface{}, chan error, error) {\n\t// TODO(adamb) Fire off error handlers on callbacks if server shuts down without\n\t// response.\n\n\tisRunningMutex := s.isRunningMutex\n\tisRunningMutex.Lock()\n\tdefer isRunningMutex.Unlock()\n\tif s.isRunning {\n\t\t// Make new token\n\t\ttoken := randomToken(16)\n\t\tch := make(chan interface{}, 1)\n\t\terrChan := make(chan error, 1)\n\t\ts.registerChannelChan <- registerChannelEntry{token, ch, errChan}\n\t\taddress := fmt.Sprintf(\"%s@%s\", token, s.listener.Addr().String())\n\t\treturn address, ch, errChan, nil\n\t} else {\n\t\treturn \"\", nil, nil, fmt.Errorf(\"Server is not running; can't expose a channel\")\n\t}\n}", "func (_m *Socket) ReadChannel() <-chan *packet.Packet {\n\tret := _m.Called()\n\n\tvar r0 <-chan *packet.Packet\n\tif rf, ok := ret.Get(0).(func() <-chan *packet.Packet); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(<-chan *packet.Packet)\n\t\t}\n\t}\n\n\treturn r0\n}", "func TestBasicMethodChannelStringCodecHandle(t *testing.T) {\n\tcodec := StringCodec{}\n\tmessenger := NewTestingBinaryMessenger()\n\tchannel := NewBasicMessageChannel(messenger, \"ch\", codec)\n\tchannel.HandleFunc(func(message interface{}) (reply interface{}, err error) {\n\t\tmessageString, ok := message.(string)\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"message is invalid type, expected string\")\n\t\t}\n\t\treply = messageString + \" world\"\n\t\treturn reply, nil\n\t})\n\tencodedMessage, err := codec.EncodeMessage(\"hello\")\n\tif err != nil {\n\t\tt.Fatalf(\"failed to encode message: %v\", err)\n\t}\n\tencodedReply, err := messenger.MockSend(\"ch\", encodedMessage)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treply, err := codec.DecodeMessage(encodedReply)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to decode reply: %v\", err)\n\t}\n\tt.Log(spew.Sdump(reply))\n\treplyString, ok := reply.(string)\n\tif !ok {\n\t\tt.Fatal(\"reply is invalid type, expected string\")\n\t}\n\tEqual(t, \"hello world\", replyString)\n}", "func (r AuthenticationMethodsReferences) ChannelService() bool {\n\treturn r.Duo\n}", "func (mr *MockProcessProviderMockRecorder) BootstrapperProvider() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"BootstrapperProvider\", reflect.TypeOf((*MockProcessProvider)(nil).BootstrapperProvider))\n}", "func (_m *MockDispatchServer) mustEmbedUnimplementedDispatchServer() {\n\t_m.Called()\n}" ]
[ "0.70419014", "0.6634641", "0.65435016", "0.6516153", "0.6099235", "0.59935945", "0.5946837", "0.5912251", "0.57246834", "0.56565267", "0.5589579", "0.5576268", "0.55481195", "0.5538942", "0.5522845", "0.54247093", "0.539553", "0.5343411", "0.53341347", "0.53230613", "0.53107256", "0.5304953", "0.5304325", "0.52708155", "0.52682376", "0.5265407", "0.5262659", "0.5253242", "0.52393335", "0.5235599", "0.5201759", "0.5194129", "0.51773113", "0.5168842", "0.51646125", "0.51547575", "0.51407886", "0.5119364", "0.5088532", "0.5073777", "0.505195", "0.5051145", "0.5045389", "0.50350887", "0.50346965", "0.5015394", "0.50077283", "0.5004003", "0.49969736", "0.49870816", "0.49703485", "0.49635538", "0.4960643", "0.4956236", "0.49549285", "0.4953771", "0.4935411", "0.49306852", "0.49194685", "0.49168688", "0.49089566", "0.49072424", "0.49065807", "0.48985603", "0.48953497", "0.48909712", "0.48885196", "0.4877172", "0.48707885", "0.4870101", "0.4861601", "0.48588252", "0.48579273", "0.48456746", "0.4845072", "0.48361874", "0.48323974", "0.4828724", "0.4827501", "0.4810319", "0.48002473", "0.47991386", "0.47870457", "0.47845745", "0.4771932", "0.47717753", "0.4763954", "0.475909", "0.4754825", "0.4753716", "0.47503385", "0.47394165", "0.4738918", "0.47372764", "0.47247392", "0.47200933", "0.47192973", "0.4716962", "0.471304", "0.4710472" ]
0.6936447
1
CryptoSuite mocks base method
func (m *MockProviders) CryptoSuite() core.CryptoSuite { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CryptoSuite") ret0, _ := ret[0].(core.CryptoSuite) return ret0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestEncrypt() {\n\n}", "func (m *MockisCryptoApiRequest_CryptoApiReq) isCryptoApiRequest_CryptoApiReq() {\n\tm.ctrl.Call(m, \"isCryptoApiRequest_CryptoApiReq\")\n}", "func (m *MockisCryptoAsymApiReqSetupPrivateKeyEx_Key) isCryptoAsymApiReqSetupPrivateKeyEx_Key() {\n\tm.ctrl.Call(m, \"isCryptoAsymApiReqSetupPrivateKeyEx_Key\")\n}", "func (pc *MockProviderContext) CryptoSuite() apicryptosuite.CryptoSuite {\n\treturn pc.cryptoSuite\n}", "func (m *MockClient) CryptoSuite() core.CryptoSuite {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CryptoSuite\")\n\tret0, _ := ret[0].(core.CryptoSuite)\n\treturn ret0\n}", "func TestMain(m *testing.M) {\n\tconfigImp = mocks.NewMockConfig(caServerURL)\n\tcryptoSuiteProvider, _ = cryptosuiteimpl.GetSuiteByConfig(configImp)\n\tif cryptoSuiteProvider == nil {\n\t\tpanic(\"Failed initialize cryptoSuiteProvider\")\n\t}\n\t// Start Http Server\n\tgo mocks.StartFabricCAMockServer(strings.TrimPrefix(caServerURL, \"http://\"))\n\t// Allow HTTP server to start\n\ttime.Sleep(1 * time.Second)\n\tos.Exit(m.Run())\n}", "func (m *MockisCryptoAsymApiRespSetupPrivateKey_KeyInfo) isCryptoAsymApiRespSetupPrivateKey_KeyInfo() {\n\tm.ctrl.Call(m, \"isCryptoAsymApiRespSetupPrivateKey_KeyInfo\")\n}", "func (m *MockisCryptoApiResponse_CryptoApiResp) isCryptoApiResponse_CryptoApiResp() {\n\tm.ctrl.Call(m, \"isCryptoApiResponse_CryptoApiResp\")\n}", "func mockChildPackages() {\n\n\t// Fake an AWS credentials file so that the mfile package will nehave as if it is happy\n\tsetFakeCredentials()\n\n\t// Fake out the creds package into using an apparently credentials response from AWS\n\tcreds.SetGetSessionTokenFunc(func(awsService *sts.STS, input *sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) {\n\t\treturn getSessionTokenOutput, nil\n\t})\n\n}", "func (s *SignSuite) SetUpTest(c *C) {\n}", "func TestCryptoSignerInterfaceBehavior(t *testing.T) {\n\tcs := NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.EmptyCryptoServiceInterfaceBehaviorTests(t, cs)\n\tinterfaces.CreateGetKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.CreateListKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.AddGetKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.AddListKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n}", "func (m *MockInternalServer) CryptoAsymKeyWrite(arg0 context.Context, arg1 *CryptoAsymKeyWriteRequestMsg) (*CryptoAsymKeyWriteResponseMsg, error) {\n\tret := m.ctrl.Call(m, \"CryptoAsymKeyWrite\", arg0, arg1)\n\tret0, _ := ret[0].(*CryptoAsymKeyWriteResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestCorePkg_CreateCryptoSuiteProvider(t *testing.T) {\n\tpkg := newCorePkg()\n\trequire.NotNil(t, pkg)\n\n\tp, err := pkg.CreateCryptoSuiteProvider(nil)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, p)\n}", "func (m *MockInternalServer) CryptoKeyUpdate(arg0 context.Context, arg1 *CryptoKeyUpdateRequestMsg) (*CryptoKeyUpdateResponseMsg, error) {\n\tret := m.ctrl.Call(m, \"CryptoKeyUpdate\", arg0, arg1)\n\tret0, _ := ret[0].(*CryptoKeyUpdateResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockPacketHandler) getCryptoStream() cryptoStreamI {\n\tret := m.ctrl.Call(m, \"getCryptoStream\")\n\tret0, _ := ret[0].(cryptoStreamI)\n\treturn ret0\n}", "func TestHandshakeCoreData(t *testing.T) {\n\n\t// node 1\n\tport := crypto.GetRandomUserPort()\n\taddress := fmt.Sprintf(\"0.0.0.0:%d\", port)\n\n\tnode1Local, err := NewNodeIdentity(address, nodeconfig.ConfigValues, false)\n\n\tif err != nil {\n\t\tt.Error(\"failed to create local node1\", err)\n\t}\n\n\t// this will be node 2 view of node 1\n\tnode1Remote, _ := NewRemoteNode(node1Local.String(), address)\n\n\t// node 2\n\tport1 := crypto.GetRandomUserPort()\n\taddress1 := fmt.Sprintf(\"0.0.0.0:%d\", port1)\n\n\tnode2Local, err := NewNodeIdentity(address1, nodeconfig.ConfigValues, false)\n\n\tif err != nil {\n\t\tt.Error(\"failed to create local node2\", err)\n\t}\n\n\t// this will be node1 view of node 2\n\tnode2Remote, _ := NewRemoteNode(node2Local.String(), address1)\n\n\t// STEP 1: Node1 generates handshake data and sends it to node2 ....\n\tdata, session, err := generateHandshakeRequestData(node1Local, node2Remote)\n\n\tassert.NoErr(t, err, \"expected no error\")\n\tassert.NotNil(t, session, \"expected session\")\n\tassert.NotNil(t, data, \"expected session\")\n\n\tlog.Info(\"Node 1 session data: Id:%s, AES-KEY:%s\", hex.EncodeToString(session.ID()), hex.EncodeToString(session.KeyE()))\n\n\tassert.False(t, session.IsAuthenticated(), \"Expected session to be not authenticated yet\")\n\n\t// STEP 2: Node2 gets handshake data from node 1 and processes it to establish a session with a shared AES key\n\n\tresp, session1, err := processHandshakeRequest(node2Local, node1Remote, data)\n\n\tassert.NoErr(t, err, \"expected no error\")\n\tassert.NotNil(t, session1, \"expected session\")\n\tassert.NotNil(t, resp, \"expected resp data\")\n\n\tlog.Info(\"Node 2 session data: Id:%s, AES-KEY:%s\", hex.EncodeToString(session1.ID()), hex.EncodeToString(session1.KeyE()))\n\n\tassert.Equal(t, string(session.ID()), string(session1.ID()), \"expected agreed Id\")\n\tassert.Equal(t, string(session.KeyE()), string(session1.KeyE()), \"expected same shared AES enc key\")\n\tassert.Equal(t, string(session.KeyM()), string(session1.KeyM()), \"expected same shared AES mac key\")\n\tassert.Equal(t, string(session.PubKey()), string(session1.PubKey()), \"expected same shared secret\")\n\n\tassert.True(t, session1.IsAuthenticated(), \"expected session1 to be authenticated\")\n\n\t// STEP 3: Node2 sends data1 back to node1.... Node 1 validates the data and sets its network session to authenticated\n\terr = processHandshakeResponse(node1Local, node2Remote, session, resp)\n\n\tassert.True(t, session.IsAuthenticated(), \"expected session to be authenticated\")\n\tassert.NoErr(t, err, \"failed to authenticate or process response\")\n\n\t// test session sym enc / dec\n\n\tconst msg = \"hello spacemesh - hello spacemesh - hello spacemesh :-)\"\n\tcipherText, err := session.Encrypt([]byte(msg))\n\tassert.NoErr(t, err, \"expected no error\")\n\n\tclearText, err := session1.Decrypt(cipherText)\n\tassert.NoErr(t, err, \"expected no error\")\n\tassert.True(t, bytes.Equal(clearText, []byte(msg)), \"Expected enc/dec to work\")\n\n\tnode1Local.Shutdown()\n\tnode2Local.Shutdown()\n}", "func (m *MockisKey_KeyInfo) isKey_KeyInfo() {\n\tm.ctrl.Call(m, \"isKey_KeyInfo\")\n}", "func (m *MockInternalServer) CryptoApiInvoke(arg0 context.Context, arg1 *CryptoApiRequestMsg) (*CryptoApiResponseMsg, error) {\n\tret := m.ctrl.Call(m, \"CryptoApiInvoke\", arg0, arg1)\n\tret0, _ := ret[0].(*CryptoApiResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestContext(t *testing.T) {\n\tnsCfg := config.Namespace{\n\t\tNamespace: didTrustblocNamespace,\n\t\tBasePath: didTrustblocBasePath,\n\t}\n\n\ttxnProvider := &peermocks.TxnServiceProvider{}\n\tdcasProvider := &peermocks.DCASClientProvider{}\n\topQueueProvider := &mocks.OperationQueueProvider{}\n\n\tt.Run(\"Success\", func(t *testing.T) {\n\t\tprotocolVersions := map[string]protocolApi.Protocol{\n\t\t\t\"0.5\": {\n\t\t\t\tStartingBlockChainTime: 100,\n\t\t\t\tHashAlgorithmInMultiHashCode: 18,\n\t\t\t\tMaxOperationsPerBatch: 100,\n\t\t\t\tMaxOperationByteSize: 1000,\n\t\t\t},\n\t\t}\n\n\t\tstConfigService := &peermocks.SidetreeConfigService{}\n\t\tstConfigService.LoadProtocolsReturns(protocolVersions, nil)\n\n\t\tctx, err := newContext(channel1, nsCfg, stConfigService, txnProvider, dcasProvider, opQueueProvider)\n\t\trequire.NoError(t, err)\n\t\trequire.NotNil(t, ctx)\n\n\t\trequire.NotNil(t, ctx.BatchWriter())\n\n\t\trequire.NoError(t, ctx.Start())\n\n\t\ttime.Sleep(20 * time.Millisecond)\n\n\t\tctx.Stop()\n\t})\n\n\tt.Run(\"No protocols -> error\", func(t *testing.T) {\n\t\tstConfigService := &peermocks.SidetreeConfigService{}\n\n\t\tctx, err := newContext(channel1, nsCfg, stConfigService, txnProvider, dcasProvider, opQueueProvider)\n\t\trequire.Error(t, err)\n\t\trequire.Contains(t, err.Error(), \"no protocols defined\")\n\t\trequire.Nil(t, ctx)\n\t})\n\n\tt.Run(\"Initialize protocols -> error\", func(t *testing.T) {\n\t\terrExpected := errors.New(\"injected sidetreeCfgService error\")\n\t\tstConfigService := &peermocks.SidetreeConfigService{}\n\t\tstConfigService.LoadProtocolsReturns(nil, errExpected)\n\n\t\tctx, err := newContext(channel1, nsCfg, stConfigService, txnProvider, dcasProvider, opQueueProvider)\n\t\trequire.EqualError(t, err, errExpected.Error())\n\t\trequire.Nil(t, ctx)\n\t})\n}", "func Test_Crypto(t *testing.T) {\n\trequire := require.New(t)\n\n\tc := &sm2.Driver{}\n\n\tpriv, err := c.GenKey()\n\trequire.Nil(err)\n\tt.Logf(\"priv:%X, len:%d\", priv.Bytes(), len(priv.Bytes()))\n\n\tpub := priv.PubKey()\n\trequire.NotNil(pub)\n\tt.Logf(\"pub:%X, len:%d\", pub.Bytes(), len(pub.Bytes()))\n\n\tmsg := []byte(\"hello world\")\n\tsignature := priv.Sign(msg)\n\tt.Logf(\"sign:%X, len:%d\", signature.Bytes(), len(signature.Bytes()))\n\n\tok := pub.VerifyBytes(msg, signature)\n\trequire.Equal(true, ok)\n}", "func (tradingSuite *KyberTradingTestSuite) SetupSuite() {\n\tfmt.Println(\"Setting up the suite...\")\n\t// Kovan env\n\ttradingSuite.EtherAddressStrKyber = \"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\"\n\n\ttradingSuite.IncKBNTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000082\"\n\ttradingSuite.IncSALTTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000081\"\n\ttradingSuite.IncOMGTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000072\"\n\ttradingSuite.IncSNTTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000071\"\n\ttradingSuite.KBNAddressStr = \"0xad67cB4d63C9da94AcA37fDF2761AaDF780ff4a2\" // kovan\n\ttradingSuite.SALTAddressStr = \"0x6fEE5727EE4CdCBD91f3A873ef2966dF31713A04\" // kovan\n\ttradingSuite.OMGAddressStr = \"0xdB7ec4E4784118D9733710e46F7C83fE7889596a\" // kovan\n\ttradingSuite.SNTAddressStr = \"0x4c99B04682fbF9020Fcb31677F8D8d66832d3322\" // kovan\n\ttradingSuite.KyberTradeDeployedAddr = common.HexToAddress(\"0x38A3cE5d944ff3de96401ddBFA9971D656222F89\") //kovan\n\ttradingSuite.KyberMultiTradeDeployedAddr = common.HexToAddress(\"0x8E7050E23A42052C75cdCE2d919f5e4F89afaD0a\") //kovan\n\ttradingSuite.DepositingEther = float64(0.05)\n\ttradingSuite.KyberContractAddr = common.HexToAddress(\"0x692f391bCc85cefCe8C237C01e1f636BbD70EA4D\") // kovan\n}", "func mockBatchCTXHeader() *BatchHeader {\n\tbh := NewBatchHeader()\n\tbh.ServiceClassCode = CreditsOnly\n\tbh.StandardEntryClassCode = CTX\n\tbh.CompanyName = \"Payee Name\"\n\tbh.CompanyIdentification = \"121042882\"\n\tbh.CompanyEntryDescription = \"ACH CTX\"\n\tbh.ODFIIdentification = \"12104288\"\n\treturn bh\n}", "func (m *MockInternalServer) CryptoKeyRead(arg0 context.Context, arg1 *CryptoKeyReadRequestMsg) (*CryptoKeyReadResponseMsg, error) {\n\tret := m.ctrl.Call(m, \"CryptoKeyRead\", arg0, arg1)\n\tret0, _ := ret[0].(*CryptoKeyReadResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (suite *SmsTests) SetUpSuite(c *C) {\n}", "func (m *MockInternalClient) CryptoAsymKeyWrite(ctx context.Context, in *CryptoAsymKeyWriteRequestMsg, opts ...grpc.CallOption) (*CryptoAsymKeyWriteResponseMsg, error) {\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CryptoAsymKeyWrite\", varargs...)\n\tret0, _ := ret[0].(*CryptoAsymKeyWriteResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockSystemContract) Init(arg0 core.Keepers, arg1 types1.BaseTx, arg2 uint64) core.SystemContract {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Init\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(core.SystemContract)\n\treturn ret0\n}", "func (m *MockProvider) KMSDecryptEnv(arg0, arg1 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"KMSDecryptEnv\", arg0, arg1)\n}", "func (m *MockInternalServer) CryptoAsymKeyCreate(arg0 context.Context, arg1 *CryptoAsymKeyCreateRequestMsg) (*CryptoAsymKeyCreateResponseMsg, error) {\n\tret := m.ctrl.Call(m, \"CryptoAsymKeyCreate\", arg0, arg1)\n\tret0, _ := ret[0].(*CryptoAsymKeyCreateResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestEncryptionEncryptByPassPhrase(t *testing.T) {\n\tpassPhrase := \"123\"\n\tplaintext := []byte{1, 2, 3, 4}\n\n\tciphertextStr, err := encryptByPassPhrase(passPhrase, plaintext)\n\tfmt.Println(\"ciphertextStr : \", ciphertextStr)\n\n\tassert.Equal(t, nil, err)\n\tassert.Greater(t, len(ciphertextStr), 0)\n\n\tplaintext2, err := decryptByPassPhrase(passPhrase, ciphertextStr)\n\tassert.Equal(t, plaintext, plaintext2)\n}", "func (m *MockInternalClient) CryptoApiInvoke(ctx context.Context, in *CryptoApiRequestMsg, opts ...grpc.CallOption) (*CryptoApiResponseMsg, error) {\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CryptoApiInvoke\", varargs...)\n\tret0, _ := ret[0].(*CryptoApiResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockServicer) CalculateHashAndDuration(startTime time.Time, fiveSecTimer *time.Timer, password string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"CalculateHashAndDuration\", startTime, fiveSecTimer, password)\n}", "func TestCommitMultipleKeys4A(t *testing.T) {\n}", "func Test_Redis(t *testing.T) {\n\n}", "func (s *TestSuite) setup() {\n\t// The first few keys from the following well-known mnemonic used by 0x:\n\t//\tconcert load couple harbor equip island argue ramp clarify fence smart topic\n\tkeys := []string{\n\t\t\"f2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d\",\n\t\t\"5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72\",\n\t\t\"df02719c4df8b9b8ac7f551fcb5d9ef48fa27eef7a66453879f4d8fdc6e78fb1\",\n\t\t\"ff12e391b79415e941a94de3bf3a9aee577aed0731e297d5cfa0b8a1e02fa1d0\",\n\t\t\"752dd9cf65e68cfaba7d60225cbdbc1f4729dd5e5507def72815ed0d8abc6249\",\n\t\t\"efb595a0178eb79a8df953f87c5148402a224cdf725e88c0146727c6aceadccd\",\n\t}\n\ts.account = make([]account, len(keys))\n\tfor i, key := range keys {\n\t\tb, err := hex.DecodeString(key)\n\t\ts.Require().NoError(err)\n\t\ts.account[i].key, err = crypto.ToECDSA(b)\n\t\ts.Require().NoError(err)\n\t}\n\ts.signer = signer(s.account[0])\n}", "func TestDelegation(t *testing.T) {\n\tcsp, cleanup := newProvider(t, defaultOptions())\n\tdefer cleanup()\n\n\tk, err := csp.KeyGen(&bccsp.AES256KeyGenOpts{})\n\trequire.NoError(t, err)\n\n\tt.Run(\"KeyGen\", func(t *testing.T) {\n\t\tk, err := csp.KeyGen(&bccsp.AES256KeyGenOpts{})\n\t\trequire.NoError(t, err)\n\t\trequire.True(t, k.Private())\n\t\trequire.True(t, k.Symmetric())\n\t})\n\n\tt.Run(\"KeyDeriv\", func(t *testing.T) {\n\t\tk, err := csp.KeyDeriv(k, &bccsp.HMACDeriveKeyOpts{Arg: []byte{1}})\n\t\trequire.NoError(t, err)\n\t\trequire.True(t, k.Private())\n\t})\n\n\tt.Run(\"KeyImport\", func(t *testing.T) {\n\t\traw := make([]byte, 32)\n\t\t_, err := rand.Read(raw)\n\t\trequire.NoError(t, err)\n\n\t\tk, err := csp.KeyImport(raw, &bccsp.AES256ImportKeyOpts{})\n\t\trequire.NoError(t, err)\n\t\trequire.True(t, k.Private())\n\t})\n\n\tt.Run(\"GetKey\", func(t *testing.T) {\n\t\tk, err := csp.GetKey(k.SKI())\n\t\trequire.NoError(t, err)\n\t\trequire.True(t, k.Private())\n\t})\n\n\tt.Run(\"Hash\", func(t *testing.T) {\n\t\tdigest, err := csp.Hash([]byte(\"message\"), &bccsp.SHA3_384Opts{})\n\t\trequire.NoError(t, err)\n\t\trequire.NotEmpty(t, digest)\n\t})\n\n\tt.Run(\"GetHash\", func(t *testing.T) {\n\t\th, err := csp.GetHash(&bccsp.SHA256Opts{})\n\t\trequire.NoError(t, err)\n\t\trequire.Equal(t, sha256.New(), h)\n\t})\n\n\tt.Run(\"Sign\", func(t *testing.T) {\n\t\t_, err := csp.Sign(k, []byte(\"message\"), nil)\n\t\trequire.EqualError(t, err, \"Unsupported 'SignKey' provided [*sw.aesPrivateKey]\")\n\t})\n\n\tt.Run(\"Verify\", func(t *testing.T) {\n\t\t_, err := csp.Verify(k, []byte(\"signature\"), []byte(\"digest\"), nil)\n\t\trequire.Error(t, err)\n\t\trequire.Contains(t, err.Error(), \"Unsupported 'VerifyKey' provided\")\n\t})\n\n\tt.Run(\"EncryptDecrypt\", func(t *testing.T) {\n\t\tmsg := []byte(\"message\")\n\t\tct, err := csp.Encrypt(k, msg, &bccsp.AESCBCPKCS7ModeOpts{})\n\t\trequire.NoError(t, err)\n\n\t\tpt, err := csp.Decrypt(k, ct, &bccsp.AESCBCPKCS7ModeOpts{})\n\t\trequire.NoError(t, err)\n\t\trequire.Equal(t, msg, pt)\n\t})\n}", "func (suite *EmailTests) SetUpSuite(c *C) {\n}", "func (m *MockInternalClient) CryptoKeyUpdate(ctx context.Context, in *CryptoKeyUpdateRequestMsg, opts ...grpc.CallOption) (*CryptoKeyUpdateResponseMsg, error) {\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CryptoKeyUpdate\", varargs...)\n\tret0, _ := ret[0].(*CryptoKeyUpdateResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestPagarmeEncryptCard(t *testing.T) {\n\t\n\tCard := new(pagarme.Card)\n\tPagarme := pagarme.NewPagarme(\"pt-BR\", ApiKey, CryptoKey)\n Pagarme.SetDebug()\n\n\tpagarmeFillCard(Card)\n\n\tresult, err := Pagarme.EncryptCard(Card)\n\n if err != nil {\n \tt.Errorf(\"Erro ao encrypt card: %v\", err)\n return\n }\n\n if len(result.Hash) == 0 {\n t.Errorf(\"card hash is expected\")\n return\n }\n}", "func (m *MockisCryptoAsymApiReqSetupPrivateKeyEx_Key) Size() int {\n\tret := m.ctrl.Call(m, \"Size\")\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}", "func TestDelegatorProxyValidatorShares7Steps(t *testing.T) {\n\n}", "func TestSingleCommit4A(t *testing.T) {\n}", "func TestNewIdentityManager(t *testing.T) {\n\tt.Run(\"success\", func(t *testing.T) {\n\t\tepCfg := &mocks.EndpointConfig{}\n\t\tepCfg.NetworkConfigReturns(&fab.NetworkConfig{\n\t\t\tOrganizations: map[string]fab.OrganizationConfig{\"org1msp\": {}},\n\t\t})\n\n\t\tm, err := newIdentityManager(\"org1MSP\", &mocks.CryptoSuite{}, epCfg, \"./msp\")\n\t\trequire.NoError(t, err)\n\t\trequire.NotNil(t, m)\n\t})\n\n\tt.Run(\"No endpoint config -> error\", func(t *testing.T) {\n\t\tm, err := newIdentityManager(\"org1MSP\", &mocks.CryptoSuite{}, nil, \"./msp\")\n\t\trequire.EqualError(t, err, \"endpoint config is required\")\n\t\trequire.Nil(t, m)\n\t})\n\n\tt.Run(\"No org name -> error\", func(t *testing.T) {\n\t\tm, err := newIdentityManager(\"\", nil, &mocks.EndpointConfig{}, \"./msp\")\n\t\trequire.EqualError(t, err, \"orgName is required\")\n\t\trequire.Nil(t, m)\n\t})\n\n\tt.Run(\"No crypto suite -> error\", func(t *testing.T) {\n\t\tm, err := newIdentityManager(\"org1MSP\", nil, &mocks.EndpointConfig{}, \"./msp\")\n\t\trequire.EqualError(t, err, \"cryptoProvider is required\")\n\t\trequire.Nil(t, m)\n\t})\n\n\tt.Run(\"Org not found -> error\", func(t *testing.T) {\n\t\tepCfg := &mocks.EndpointConfig{}\n\t\tepCfg.NetworkConfigReturns(&fab.NetworkConfig{})\n\n\t\tm, err := newIdentityManager(\"org1MSP\", &mocks.CryptoSuite{}, epCfg, \"./msp\")\n\t\trequire.EqualError(t, err, \"org config retrieval failed\")\n\t\trequire.Nil(t, m)\n\t})\n\n\tt.Run(\"MSP config path not provided -> error\", func(t *testing.T) {\n\t\tepCfg := &mocks.EndpointConfig{}\n\t\tepCfg.NetworkConfigReturns(&fab.NetworkConfig{\n\t\t\tOrganizations: map[string]fab.OrganizationConfig{\"org1msp\": {}},\n\t\t})\n\n\t\tm, err := newIdentityManager(\"org1MSP\", &mocks.CryptoSuite{}, epCfg, \"\")\n\t\trequire.EqualError(t, err, \"either mspConfigPath or an embedded list of users is required\")\n\t\trequire.Nil(t, m)\n\t})\n}", "func (m *MockInternalClient) CryptoKeyRead(ctx context.Context, in *CryptoKeyReadRequestMsg, opts ...grpc.CallOption) (*CryptoKeyReadResponseMsg, error) {\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CryptoKeyRead\", varargs...)\n\tret0, _ := ret[0].(*CryptoKeyReadResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestCipheringBasic(t *testing.T) {\n\tprivkey, err := NewPrivateKey(S256())\n\tif err != nil {\n\t\tt.Fatal(\"failed to generate private key\")\n\t}\n\n\tin := []byte(\"Hey there dude. How are you doing? This is a test.\")\n\n\tout, err := Encrypt(privkey.PubKey(), in)\n\tif err != nil {\n\t\tt.Fatal(\"failed to encrypt:\", err)\n\t}\n\n\tdec, err := Decrypt(privkey, out)\n\tif err != nil {\n\t\tt.Fatal(\"failed to decrypt:\", err)\n\t}\n\n\tif !bytes.Equal(in, dec) {\n\t\tt.Error(\"decrypted data doesn't match original\")\n\t}\n}", "func (v2 *UniswapTestSuite) SetupSuite() {\n\tfmt.Println(\"Setting up the suite...\")\n\tvar err error\n\tv2.WETH = common.HexToAddress(\"0xd0a1e359811322d97991e03f863a0c30c2cf029c\")\n\tv2.EtherAddress = common.HexToAddress(\"0x0000000000000000000000000000000000000000\")\n\tv2.ETHUniswapRouterAddress = common.HexToAddress(\"0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\")\n\tv2.DAIAddress = common.HexToAddress(\"0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa\")\n\tv2.MRKAddressStr = common.HexToAddress(\"0xef13c0c8abcaf5767160018d268f9697ae4f5375\")\n\tv2.EthPrivateKey = \"B8DB29A7A43FB88AD520F762C5FDF6F1B0155637FA1E5CB2C796AFE9E5C04E31\"\n\tv2.VaultAddress = common.HexToAddress(\"0xF92c6bb5206BEFD3c8305ddd64d554322cC22aFc\")\n\tv2.EthHost = \"https://kovan.infura.io/v3/93fe721349134964aa71071a713c5cef\"\n\tv2.UniswapProxy = common.HexToAddress(\"0xc7724A86ced6D95573d36fc4B98f9C0414B907a1\")\n\tv2.IncAddr = common.HexToAddress(\"0xf295681641c170359E04Bbe2EA3985BaA4CF0baf\")\n\tv2.connectToETH()\n\tv2.c = getFixedCommittee()\n\tv2.auth = bind.NewKeyedTransactor(v2.ETHPrivKey)\n\tv2.v, err = vault.NewVault(v2.VaultAddress, v2.ETHClient)\n\trequire.Equal(v2.T(), nil, err)\n\n\t// uncomment to deploy new one on kovan\n\t// incAddr, tx, _, err := incognito_proxy.DeployIncognitoProxy(v2.auth, v2.ETHClient, v2.auth.From, v2.c.beacons, v2.c.bridges)\n\t// require.Equal(v2.T(), nil, err)\n\t// // Wait until tx is confirmed\n\t// err = wait(v2.ETHClient, tx.Hash())\n\t// require.Equal(v2.T(), nil, err)\n\t// v2.IncAddr = incAddr\n\t// fmt.Printf(\"Proxy address: %s\\n\", v2.IncAddr.Hex())\n\n\t// delegatorAddr, tx, _, err := vault.DeployVault(v2.auth, v2.ETHClient)\n\t// require.Equal(v2.T(), nil, err)\n\t// err = wait(v2.ETHClient, tx.Hash())\n\t// require.Equal(v2.T(), nil, err)\n\t// fmt.Printf(\"delegatorAddr address: %s\\n\", delegatorAddr.Hex())\n\n\t// vaultAbi, _ := abi.JSON(strings.NewReader(vault.VaultABI))\n\t// input, _ := vaultAbi.Pack(\"initialize\", common.Address{})\t\n\n\t// v2.VaultAddress, tx, _, err = vaultproxy.DeployVaultproxy(v2.auth, v2.ETHClient, delegatorAddr, common.HexToAddress(\"0x0000000000000000000000000000000000000001\"), v2.IncAddr, input)\n\t// require.Equal(v2.T(), nil, err)\n\t// err = wait(v2.ETHClient, tx.Hash())\n\t// require.Equal(v2.T(), nil, err)\n\t// fmt.Printf(\"vault proxy address: %s\\n\", v2.VaultAddress.Hex())\n\n\t// v2.UniswapProxy, tx, _, err = uniswap.DeployUniswapV2Trade(v2.auth, v2.ETHClient, v2.ETHUniswapRouterAddress)\n\t// require.Equal(v2.T(), nil, err)\n\t// err = wait(v2.ETHClient, tx.Hash())\n\t// require.Equal(v2.T(), nil, err)\n\t// fmt.Printf(\"Uniswap proxy address: %s\\n\", v2.UniswapProxy.Hex())\n}", "func TestEncryption(t *testing.T) {\n password := \"timisadork\"\n bPass := []byte(password)\n hash := Encrypt(password)\n\n if err := bcrypt.CompareHashAndPassword(hash, bPass); err != nil {\n t.Error(err)\n }\n}", "func (m *MockGQUICAEAD) Open(arg0, arg1 []byte, arg2 protocol.PacketNumber, arg3 []byte) ([]byte, protocol.EncryptionLevel, error) {\n\tret := m.ctrl.Call(m, \"Open\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(protocol.EncryptionLevel)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\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 (pg *PortalIntegrationTestSuite) SetupSuite() {\n\tfmt.Println(\"Setting up the suite...\")\n\t// Kovan env\n\tpg.IncKBNTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000082\"\n\tpg.IncSALTTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000081\"\n\tpg.IncOMGTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000072\"\n\tpg.IncSNTTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000071\"\n\tpg.OMGAddressStr = \"0xdB7ec4E4784118D9733710e46F7C83fE7889596a\" // kovan\n\tpg.SNTAddressStr = \"0x4c99B04682fbF9020Fcb31677F8D8d66832d3322\" // kovan\n\tpg.DepositingEther = float64(5)\n\tpg.ETHPrivKeyStr = \"1ABA488300A9D7297A315D127837BE4219107C62C61966ECDF7A75431D75CC61\"\n\tpg.PortalAdminKey = \"B8DB29A7A43FB88AD520F762C5FDF6F1B0155637FA1E5CB2C796AFE9E5C04E31\"\n\tpg.ETHHost = \"http://localhost:8545\"\n\n\tvar err error\n\tfmt.Println(\"Pulling image if not exist, please wait...\")\n\t// remove container if already running\n\texec.Command(\"/bin/sh\", \"-c\", \"docker rm -f portalv3\").Output()\n\texec.Command(\"/bin/sh\", \"-c\", \"docker rm -f incognito\").Output()\n\t_, err = exec.Command(\"/bin/sh\", \"-c\", \"docker run -d -p 8545:8545 --name portalv3 trufflesuite/ganache-cli --account=\\\"0x1ABA488300A9D7297A315D127837BE4219107C62C61966ECDF7A75431D75CC61,10000000000000000000000000000000000,0xB8DB29A7A43FB88AD520F762C5FDF6F1B0155637FA1E5CB2C796AFE9E5C04E31,10000000000000000000000000000000000\\\"\").Output()\n\trequire.Equal(pg.T(), nil, err)\n\ttime.Sleep(10 * time.Second)\n\n\tETHPrivKey, ETHClient, err := ethInstance(pg.ETHPrivKeyStr, pg.ETHHost)\n\trequire.Equal(pg.T(), nil, err)\n\tpg.ETHClient = ETHClient\n\tpg.ETHPrivKey = ETHPrivKey\n\tpg.auth = bind.NewKeyedTransactor(ETHPrivKey)\n\n\t// admin key\n\tprivKey, err := crypto.HexToECDSA(pg.PortalAdminKey)\n\trequire.Equal(pg.T(), nil, err)\n\tadmin := bind.NewKeyedTransactor(privKey)\n\n\t//pg.Portalv3 = common.HexToAddress(\"0x8c13AFB7815f10A8333955854E6ec7503eD841B7\")\n\t//pg.portalV3Inst, err = portalv3.NewPortalv3(pg.Portalv3, pg.ETHClient)\n\t//require.Equal(pg.T(), nil, err)\n\t//incAddr := common.HexToAddress(\"0x2fe0423B148739CD9D0E49e07b5ca00d388A15ac\")\n\t//pg.incProxy, err = incognitoproxy.NewIncognitoproxy(incAddr, pg.ETHClient)\n\t//require.Equal(pg.T(), nil, err)\n\n\tc := getFixedCommittee()\n\tincAddr, _, _, err := incognitoproxy.DeployIncognitoproxy(pg.auth, pg.ETHClient, admin.From, c.beacons)\n\trequire.Equal(pg.T(), nil, err)\n\tfmt.Printf(\"Proxy address: %s\\n\", incAddr.Hex())\n\tportalv3Logic, _, _, err := portalv3.DeployPortalv3(pg.auth, pg.ETHClient)\n\trequire.Equal(pg.T(), nil, err)\n\tfmt.Printf(\"portalv3 address: %s\\n\", portalv3Logic.Hex())\n\n\tportalv3ABI, _ := abi.JSON(strings.NewReader(portalv3.Portalv3ABI))\n\tinput, _ := portalv3ABI.Pack(\"initialize\")\n\n\t//PortalV3\n\tpg.Portalv3, _, _, err = delegator.DeployDelegator(pg.auth, pg.ETHClient, portalv3Logic, admin.From, incAddr, input)\n\trequire.Equal(pg.T(), nil, err)\n\tfmt.Printf(\"delegator address: %s\\n\", pg.Portalv3.Hex())\n\tpg.portalV3Inst, err = portalv3.NewPortalv3(pg.Portalv3, pg.ETHClient)\n\trequire.Equal(pg.T(), nil, err)\n\tpg.incProxy, err = incognitoproxy.NewIncognitoproxy(incAddr, pg.ETHClient)\n\trequire.Equal(pg.T(), nil, err)\n\n\t// 0x54d28562271De782B261807a01d1D2fb97417912\n\tpg.USDTAddress, _, _, err = usdt.DeployUsdt(pg.auth, pg.ETHClient, big.NewInt(100000000000), \"Tether\", \"USDT\", big.NewInt(6))\n\trequire.Equal(pg.T(), nil, err)\n\tfmt.Printf(\"usdt address: %s\\n\", pg.USDTAddress.Hex())\n\n\t//get portalv3 ip\n\tipAddress, err := exec.Command(\"/bin/sh\", \"-c\", \"docker inspect -f \\\"{{ .NetworkSettings.IPAddress }}\\\" portalv3\").Output()\n\trequire.Equal(pg.T(), nil, err)\n\n\t// run incognito chaind\n\tincogitoWithArgument := fmt.Sprintf(\"docker run -d -p 9334:9334 -p 9338:9338 --name incognito -e GETH_NAME=%v -e PORTAL_CONTRACT=%v incognito\", string(ipAddress), pg.Portalv3.Hex())\n\tincogitoWithArgument = strings.Replace(incogitoWithArgument, \"\\n\", \"\", -1)\n\t_, err = exec.Command(\"/bin/sh\", \"-c\", incogitoWithArgument).Output()\n\trequire.Equal(pg.T(), nil, err)\n\n\tfor {\n\t\ttime.Sleep(5 * time.Second)\n\t\tif checkRepsonse(pg.IncBridgeHost) {\n\t\t\tbreak\n\t\t}\n\t}\n\ttime.Sleep(40 * time.Second)\n}", "func (c CryptoServiceTester) TestAddKey(t *testing.T) {\n\tcryptoService := c.cryptoServiceFactory()\n\tcryptoService.keyStores = append(cryptoService.keyStores,\n\t\ttrustmanager.NewKeyMemoryStore(passphraseRetriever))\n\n\tprivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\n\t// Add the key to the targets role\n\trequire.NoError(t, cryptoService.AddKey(data.CanonicalTargetsRole, c.gun, privKey))\n\n\t// Check that we added the key and its info to only the first keystore\n\tretrievedKey, retrievedRole, err := cryptoService.keyStores[0].GetKey(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, privKey.Private(), retrievedKey.Private())\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedRole)\n\n\tretrievedKeyInfo, err := cryptoService.keyStores[0].GetKeyInfo(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedKeyInfo.Role)\n\trequire.Equal(t, c.gun, retrievedKeyInfo.Gun)\n\n\t// The key should not exist in the second keystore\n\t_, _, err = cryptoService.keyStores[1].GetKey(privKey.ID())\n\trequire.Error(t, err)\n\t_, err = cryptoService.keyStores[1].GetKeyInfo(privKey.ID())\n\trequire.Error(t, err)\n\n\t// We should be able to successfully get the key from the cryptoservice level\n\tretrievedKey, retrievedRole, err = cryptoService.GetPrivateKey(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, privKey.Private(), retrievedKey.Private())\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedRole)\n\tretrievedKeyInfo, err = cryptoService.GetKeyInfo(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedKeyInfo.Role)\n\trequire.Equal(t, c.gun, retrievedKeyInfo.Gun)\n\n\t// Add the same key to the targets role, since the info is the same we should have no error\n\trequire.NoError(t, cryptoService.AddKey(data.CanonicalTargetsRole, c.gun, privKey))\n\n\t// Try to add the same key to the snapshot role, which should error due to the role mismatch\n\trequire.Error(t, cryptoService.AddKey(data.CanonicalSnapshotRole, c.gun, privKey))\n}", "func (m *MockisTlsProxyFlowConfig_Keys) isTlsProxyFlowConfig_Keys() {\n\tm.ctrl.Call(m, \"isTlsProxyFlowConfig_Keys\")\n}", "func (_m *MockEncoderPool) Init(alloc EncoderAllocate) {\n\t_m.ctrl.Call(_m, \"Init\", alloc)\n}", "func TestAssetSysCC_InvalidateToken(t *testing.T) {\n\n\tfmt.Println(\"-----------------------------------\")\n\tfmt.Println(\"Test3: invalidateToken\")\n\n\t//fmt.Println(\"******test string to big.newInt\")\n\t//str := \"12321\"\n\t//strInt := big.NewInt(0)\n\t//strInt.SetString(str,10)\n\t//fmt.Println(strInt.String())\n\t//fmt.Println(\"*******************************\")\n\n\tascc := new(AssetSysCC)\n\tstub := shim.NewMockStub(\"ascc\", ascc)\n\tcheckInit(t, stub, [][]byte{[]byte(\"\")})\n\n\tres_test3 := stub.MockInvoke(\"1\", [][]byte{[]byte(\"issueToken\"), []byte(\"SSToken\"), []byte(\"250\"), []byte(\"18\"), []byte(MAddress[:])})\n\n\tif res_test3.Status != shim.OK {\n\t\tfmt.Println(\"Register token failed\", string(res_test3.Message))\n\t\tt.FailNow()\n\t}\n\n\t////query token quantity\n\t//res1 := stub.MockInvoke(\"2\", [][]byte{[]byte(\"getBalance\"), []byte(MAddress[:]), []byte(\"SSToken\")});\n\t//if res1.Status != shim.OK {\n\t//\tfmt.Println(\"Query failed\", string(res1.Message))\n\t//\tt.FailNow()\n\t//}\n\t//amount,_ := strconv.Atoi(string(res1.Payload))\n\t//if amount != 250 {\n\t//\tfmt.Printf(\"Query result error! %v\", amount )\n\t//\tt.FailNow()\n\t//}\n\n\t//beging to invalidate this token\n\tcheckQueryInfo(t, stub, [][]byte{[]byte(\"getTokenInfo\"), []byte(\"SSToken\")})\n\n\ttestInvalidate := stub.MockInvoke(\"4\", [][]byte{[]byte(\"invalidateToken\"), []byte(\"SSToken\")});\n\tif testInvalidate.Status != shim.OK {\n\t\tfmt.Println(\"Query failed\", string(testInvalidate.Message))\n\t\tt.FailNow()\n\t}\n\n\tcheckQueryInfo(t, stub, [][]byte{[]byte(\"getTokenInfo\"), []byte(\"SSToken\")})\n}", "func TestRecommitKey4A(t *testing.T) {\n}", "func (m *MockInternalClient) CryptoAsymKeyCreate(ctx context.Context, in *CryptoAsymKeyCreateRequestMsg, opts ...grpc.CallOption) (*CryptoAsymKeyCreateResponseMsg, error) {\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CryptoAsymKeyCreate\", varargs...)\n\tret0, _ := ret[0].(*CryptoAsymKeyCreateResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestSqlSMSStorage_GetSMSs(t *testing.T) {\n\n}", "func TestGetCaptcha(t *testing.T) {}", "func (m *MockisCryptoAsymApiRespSetupPrivateKey_KeyInfo) Size() int {\n\tret := m.ctrl.Call(m, \"Size\")\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}", "func (m *MockClusterScoper) HashKey() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"HashKey\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func (m *MockProposalContract) Init(arg0 core.Keepers, arg1 types1.BaseTx, arg2 uint64) core.SystemContract {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Init\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(core.SystemContract)\n\treturn ret0\n}", "func setupSuite(t *testing.T) (*os.File, *os.File, *os.File, func(t *testing.T)) {\n\ttempCertFile, err := ioutil.TempFile(\"\", \"\")\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\n\ttempCertFile.Write([]byte(`-----BEGIN CERTIFICATE-----\nMIIFRDCCAyygAwIBAgIEYiZSQDANBgkqhkiG9w0BAQsFADA7MTkwNwYDVQQDEzBB\nbnNpYmxlIEF1dG9tYXRpb24gQ29udHJvbGxlciBOb2RlcyBNZXNoIFJPT1QgQ0Ew\nHhcNMjIwMzA3MTg0MzEyWhcNMzExMjI4MDUwMzUxWjARMQ8wDQYDVQQDEwZmb29i\nYXIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnXsRTTIoV2Oqh5zvN\nJzQBYOZPpxmnKzwLvgeop44Csk++zARvg5XIpmPbSEU2PY3pNGvLTH6nD54/ZfOI\nRzSN0ipvfcrpJtkrJ7OYo1gX7ROXM30x3bj2KcJ/cMgMiZMQLqPegKhtMHLGz0TX\n+0MfJ5jqTlowVjSAyUhK6pMtf2ISpHqOA6uvmLhUhkruUrUkHMnbwWMTzrO8QDMa\ndLvV+hiWZNZFaf6Xt3lNBRY+yrXuSG7ZOc/6UsWDb4NVALL1mJ0IjfSeiK58Sf8V\nHUY4MEjy8VW2lfARU/mcNkxrUY1DBNp5zcHMhwoLkLId90PyFyzXMDCvZxHrGEwt\nZ23UAYY/wAvw1XWm5XJBiLzaL12dStuHeZgtAUOucQHvEOglvPilU6vKf5PFdxqo\nKEOwXtgLUTlw4otm2bWx5p2LPlxkPApbAv7UaxiTbcpuIMh8WTTSk/EUgpyEUjph\niN0uqnp2fH9Mmyn8hgSB/Kf6FhIZFl3VMNN6x8VTkqLkzVG8Ud48gFHfraVQXvaL\ncDDCLxTeda6Th6uTw2zCifBzXbWxZKjlinx8MEM/kIA1we/wlwsYwpQNhkbOorR3\neJ6Exdl1Ar8l3jHp293hCvxUNuzG5Z9oPDMQ6MSm8xxrBN2pYZNL3DCWaJ0njuNj\nYeNR7l7s+9ibX5RD+uASiC6hOwIDAQABo3oweDAOBgNVHQ8BAf8EBAMCB4AwHQYD\nVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMB8GA1UdIwQYMBaAFFAlC81rH211\nfPJoWglERKb/7/NfMCYGA1UdEQQfMB2HBH8AAAGgFQYJKwYBBAGSCBMBoAgMBmZv\nb2JhcjANBgkqhkiG9w0BAQsFAAOCAgEAbzKRqx2i8S0Kuu0bIX094EoGiGSTWW4l\nYNHwn9mC/5KgzjSvxTkD0pInt31d5O27rK7/wMVezeqBIG92uwwZr7ndS6Fe0FT1\n7tMZ1VH5VetIiicbu3AYssqMs/JYEocqOngLh/pGHmlwcnmPpCltipcE50bv9YWn\nO8Yc5O7v16SxHzGsDUDO5eQAe2qvBaE5F5SBCVkjSoajmh3fdx/4eSzoF2wrug3/\nO+WAb70UXX6r8dmRpr4RezQ6XPWAG57BgU3g0NUkczFo5gFndBUJngLhR6wr14xB\nst21haZ65XIA46PB8jY04l/H2INwCzo++PlKJ3ROKwLXYDSZlgQ3X9XxsSzCX3Hs\nviK9Ybzp2W8sl1Pvtb/jodcNTpD2IB8IrWnvuOgnwVmewqAqlxM7Ers9kC83lBpt\nEhAXh0QyJ5BpHOkpm4jpVhOx1swHTBDoibysvpdr5KuuOm1JTr7cYRYhIe65rVz3\naL0PryzHdvQB97LhYAaUPtFnxNxUIeXKZO3Ndg/KSrSe4IqGz51uKjxJy+MnH9//\nnnG0JqlerSVvSPSiZ2kdn4OwzV2eA3Gj3uyTSGsjjoj82bhhRwKaSWmUh+AJByQ9\nkE6r/6za1Hvm+i/mz8f1cTUxFjF5pKzrprNRz5NMzs6NkQ0pg+mq5CNzav1ATSyv\nBdt96MbGrC0=\n-----END CERTIFICATE-----\n`))\n\n\ttempCertKey, err := ioutil.TempFile(\"\", \"\")\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\n\ttempCertKey.Write([]byte(`-----BEGIN RSA PRIVATE KEY-----\nMIIJKAIBAAKCAgEAp17EU0yKFdjqoec7zSc0AWDmT6cZpys8C74HqKeOArJPvswE\nb4OVyKZj20hFNj2N6TRry0x+pw+eP2XziEc0jdIqb33K6SbZKyezmKNYF+0TlzN9\nMd249inCf3DIDImTEC6j3oCobTByxs9E1/tDHyeY6k5aMFY0gMlISuqTLX9iEqR6\njgOrr5i4VIZK7lK1JBzJ28FjE86zvEAzGnS71foYlmTWRWn+l7d5TQUWPsq17khu\n2TnP+lLFg2+DVQCy9ZidCI30noiufEn/FR1GODBI8vFVtpXwEVP5nDZMa1GNQwTa\nec3BzIcKC5CyHfdD8hcs1zAwr2cR6xhMLWdt1AGGP8AL8NV1puVyQYi82i9dnUrb\nh3mYLQFDrnEB7xDoJbz4pVOryn+TxXcaqChDsF7YC1E5cOKLZtm1seadiz5cZDwK\nWwL+1GsYk23KbiDIfFk00pPxFIKchFI6YYjdLqp6dnx/TJsp/IYEgfyn+hYSGRZd\n1TDTesfFU5Ki5M1RvFHePIBR362lUF72i3Awwi8U3nWuk4erk8Nswonwc121sWSo\n5Yp8fDBDP5CANcHv8JcLGMKUDYZGzqK0d3iehMXZdQK/Jd4x6dvd4Qr8VDbsxuWf\naDwzEOjEpvMcawTdqWGTS9wwlmidJ47jY2HjUe5e7PvYm1+UQ/rgEoguoTsCAwEA\nAQKCAgApCj3Nxyjc7pGqHY82YPSJmf8fbPQHX7ybjH9IRb22v456VICJ75Qc3WAC\n9xexkypnEqmT8i/kOxospY0vz3X9iJlLOWc2AIaj5FpPhU4mn8V7/+4k+h9OjTLa\nGQeUu29KOoWIG7gw/f5G7bAN3di5nPYMDiZjT+AT7EdDx31LXL7pn1dF13ST3Djm\n0P8yrSkpr713m1X2F2tPL9bYF+OvNmItDpDT+IerIBwoXKT1xLMTuMMllN2Anic8\ncW2cvE0ll8R5woVHEnDmnSZlQQZk5MIegDrqSJ3TQeok+dOHRToEQv5ne6KXyk0W\nRObIHkeU50XhhjmJ6RYltZGIWKI/QohWBECINhjmBxqGKBz5ultIOmeLPd5IlC+Y\now+zQk8WuYaUIX2PAzhFnhRfxUsv2Zoljt2J4YC3oKsB9cynrhonozvwEJy9MJJF\na48+meJ6Wkm6LtcREPgbjFtfhrPKQlD+/kfHR6mxhjR977lgZAvrGhlBTZPKx/MF\nr0ZOP34+Cw2ZDrHO1L7GQVEjY0JM2B6lCEYtI8Mxy04gqa+kRIjL+04WhjT1w2Lk\n71tOBNNB2AqxK+aptqxLG2By4mlW7WliGZI0j/6caXkg02olL/WqeBWTKSoUXLd6\nLD523A02VHQgBDhTdIjezKI1FpAVKCXdHuwgqSWPQiQx6FkdAQKCAQEA1YinOp0U\n1/9nq5f9Oet5uOLLGNG5lpzvCY9tPk9gWjTlAes5aQ8Pftg+P6dGgAsVqGxT2NvS\nuNSqYIBdm7Uy7jUG9m6PjQeQ7+oQ1vJqbryqr4QDwnAtHdWFfXak17YZs9YuhesP\nl5h4Oxi43Q2tZalMUY/rAmn+URqI5jlSWYiH6D9p2j9mEzvFrPQLvsbDb6zbxlAv\n8oaqOiOrQa+q3T+loeRX0ErN9qf84Vw7tc7Qp5a4siWyWIHKGHHVveB+ITcHJ2+7\nKJf7saRAjcRyHxX3tsPyRVSfg37nIMoPHilnN8bbhgBs0eMq1zcQgEYVceWx4pcZ\nGonabS85TBsqwQKCAQEAyKfZoot+oOOfWXMVBD761o4msd3fxRJlyS9RsPzRx7VO\nrQNTw9fCmurcFnF444fCfnEVJ/bCh/rWETyt1wVQhuy+th16hq4NEwGOD87WBXCn\nb3K8ZNbFDB9WL30q7bLe9UBw4j1ciHGKqpkjEACBrrdBF3HxVjBCQiHUKci3KK7E\nj6rtmR97UJj3XtTU0XiFm2FNKRa+aw0OQ3rr5Bw9ZURd9aXoDCXUMoXgfFnUxLWd\ny8Mdh5/PWmf8/o7/WqWpwejRJqfcGR1576QJXZjbduXG5zviDjwe5VKjgH5XRe8x\nytCa5Z6APGWA4hhuZYfERcCsirEPO4ruew+iE0c2+wKCAQAA7o28Rb83ihfLuegS\n/qITWnoEa7XhoGGyqvuREAudmSl+rqYbfUNWDF+JK5O1L1cy2vYqthrfT55GuYiv\nC0VjoLudC7J4rRXG1kCoj3pDbXNZPLw/dvnbbXkdqQzjHBpUnJSrZPE2eiXcLCly\nXYLqNKjumjAuXIQNmo4KYymm1l+xdcVifHBXmSUtsgrzFC76J8j1vpfW+Rt5EXrH\n2JpoSMTSRgrUD9+COg1ydlKUYoiqko/PxzZWCIr3PFfwcjBauMDBPU2VycQBbHQT\nqk3NMO1Z0NUX1Fy12DHuBLO4L/oRVj7TAOF4sQMY2VarGKMzUgtKr9oeMYfQfipD\n2MKBAoIBAQCyCFuNYP+FePDVyMoI7mhZHd8vSZFVpbEyBA4TXv4yl6eq0pzr0vAT\ny/Zi42NDXh0vWt5Oix6mz+RHfvMvKMP+MugzZYxlGuD20BZf6ED0qrOkqsSFJBnJ\nW7R4hjIknOQ97mM6GP+VAEjsfNsjQ4/MmUPjrXFX65GeY61/NVtteUNlxV7y0X/0\nTwSM24HIKYtCBd8Uad2h1f+l19acmoHO7A4B+qYcwSO5gBdhvcKOliXfuMrmnuC3\ncjSDGBVxNDOenReVmLIshn6+JWk55noy0ETevb8gqi8vgVcYlwCQSF6BeP02Zp+Y\n9uaXtN2esAtxaDavB9JgHjDid0hymmkpAoIBABmtcLim8rEIo82NERAUvVHR7MxR\nhXKx9g3bm1O0w7kJ16jyf5uyJ85JNi1XF2/AomSNWH6ikHuX5Xj6vOdL4Ki9jPDq\nTOlmvys2LtCAMOM3e3NvzIfTnrQEurGusCQKxCbnlRk2W13j3uc2gVFgB3T1+w2H\nlSEhzuFpDrxKrsE9QcCf7/Cju+2ir9h3FsPDRKoxfRJ2/onsgQ/Q7NODRRQGjwxw\nP/Hli/j17jC7TdgC26JhtVHH7K5xC6iNL03Pf3GTSvwN1vK1BY2reoz1FtQrGZvM\nrydzkVNNVeMVX2TER9yc8AdFqkRlaBWHmO61rYmV+N1quLM0uMVsu55ZNCY=\n-----END RSA PRIVATE KEY-----\n`))\n\n\ttempCA, err := ioutil.TempFile(\"\", \"\")\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\n\ttempCA.Write([]byte(`-----BEGIN CERTIFICATE-----\nMIIFVTCCAz2gAwIBAgIEYdeDaTANBgkqhkiG9w0BAQsFADA7MTkwNwYDVQQDEzBB\nbnNpYmxlIEF1dG9tYXRpb24gQ29udHJvbGxlciBOb2RlcyBNZXNoIFJPT1QgQ0Ew\nHhcNMjIwMTA3MDAwMzUxWhcNMzIwMTA3MDAwMzUxWjA7MTkwNwYDVQQDEzBBbnNp\nYmxlIEF1dG9tYXRpb24gQ29udHJvbGxlciBOb2RlcyBNZXNoIFJPT1QgQ0EwggIi\nMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCxAErOWvVDU8mfZgtE6BSygTWU\nMkPxxIEQSYs/UesRAHaB+QXa7/0Foa0VUJKcWwUE+2yYkNRrg8MmE8VWMSewcaNI\nAs407stFXP+A2anPEglwemTskpO72sigiYDKShC5n5ciyPsHckwVlOCTtac5TwFe\neTmGnHWRcd4uBGvaEXx98fw/wLgYtr9vmKTdnOQjriX9EaAWrjlrlzm54Bs3uVUj\nGSL7zY381EuUVV4AjbqQyThbY9cVfsK0nmzLUqpiHG2IhGZDZA9+jxtz2wJWFkNQ\nnWA3afCUjcWV+4FpP3p1U1myCeh2yR2uCHs9pkUK3ts9uD/Wd5j9M1oBMlymbN/C\n5Fahd+cTXrPAjsoRqCso9TBP4mIlNl1Jq8MRUWTL5HOuwn+KnufBtuQ1hIb71Eso\nkj90eWeo/P+temYAEquUVWiej7lnHyZVW647lE+o+xJEOmW+tY5H4jgA/twP4s7U\nBgR545usWF9/utvnhsGSkg1EYcdzaM01pkrWrw1GvHT++HshsrG6Tse8gY7JrTds\nLDtU8LPhPUEnSfVBcgcMg2Dg8lEbaODtdp2xtCJwZHy9CiAx3CKcogVEfecrKSSr\n2iSocft9/l8J+mhVG2CI6ekG6Cy9hDct/3SV01Dfd4FG7xXJIE3mTDLILpi1AVIW\nMHxYD3skuQMyLhJDAwIDAQABo2EwXzAOBgNVHQ8BAf8EBAMCAoQwHQYDVR0lBBYw\nFAYIKwYBBQUHAwIGCCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE\nFFAlC81rH211fPJoWglERKb/7/NfMA0GCSqGSIb3DQEBCwUAA4ICAQCWCP/O6YQ9\njhae2/BeUeeKsnoxf90prg3o6/QHbelF6yL+MvGg5ZbPSlt+ywLDNR2CYvXk/4SD\n5To7CPKhSPBwwUJpafvQfAOZijU30fvXvp5yZEFoOzOyvBP58NfzL5qH6Pf5A6i3\nrHvtR1v7DgS7u2qWWcSimIM0UPoV3JubLTEORjOR6FIyNkIxdjhrP3SxyZ54xxde\nG3bchKaRcGVNoFYSDN4bAA22JAjlD8kXNYKzIS/0cOR/9SnHd1wMIQ2trx0+TfyG\nFAA1mW1mjzQd+h5SGBVeCz2W2XttNSIfQDndJCsyACxmIaOK99AQxdhZsWfHtGO1\n3TjnyoiHjf8rozJbAVYqrIdB6GDf6fUlxwhUXT0qkgOvvAzjNnLoOBUkE4TWqXHl\n38a+ITDNVzaUlrTd63eexS69V6kHe7mrqjywNQ9EXF9kaVeoNTzRf/ztT/DEVAl+\nrKshMt4IOKQf1ScE+EJe1njpREHV+fa+kYvQB6cRuxW9a8sOSeQNaSL73Zv54elZ\nxffYhMv6yXvVxVnJHEsG3kM/CsvsU364BBd9kDcZbHpjNcDHMu+XxECJjD2atVtu\nFdaOLykGKfMCYVBP+xs97IJO8En/5N9QQwc+N4cfCg9/BWoZKHPbRx/V+57VEj0m\n69EpJXbL15ZQLCPsaIcqJqpK23VyJKc8fA==\n-----END CERTIFICATE-----\n`))\n\n\treturn tempCertFile, tempCertKey, tempCA, func(t *testing.T) {\n\t\tdefer os.Remove(tempCertFile.Name())\n\t\tdefer os.Remove(tempCertKey.Name())\n\t\tdefer os.Remove(tempCA.Name())\n\t}\n}", "func (m *MockManagedClusterScoper) HashKey() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"HashKey\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func (m *MockCall) Key() []byte {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Key\")\n\tret0, _ := ret[0].([]byte)\n\treturn ret0\n}", "func (m *MockIpsecServer) IpsecSAEncryptGet(arg0 context.Context, arg1 *IpsecSAEncryptGetRequestMsg) (*IpsecSAEncryptGetResponseMsg, error) {\n\tret := m.ctrl.Call(m, \"IpsecSAEncryptGet\", arg0, arg1)\n\tret0, _ := ret[0].(*IpsecSAEncryptGetResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestPrivateData(t *testing.T) {\n\tsdk := mainSDK\n\n\torgsContext := setupMultiOrgContext(t, sdk)\n\terr := integration.EnsureChannelCreatedAndPeersJoined(t, sdk, orgChannelID, \"orgchannel.tx\", orgsContext)\n\trequire.NoError(t, err)\n\n\tcoll1 := \"collection1\"\n\tccID := integration.GenerateExamplePvtID(true)\n\tcollConfig, err := newCollectionConfig(coll1, \"OR('Org2MSP.member')\", 0, 2, 1000)\n\trequire.NoError(t, err)\n\n\terr = integration.InstallExamplePvtChaincode(orgsContext, ccID)\n\trequire.NoError(t, err)\n\terr = integration.InstantiateExamplePvtChaincode(orgsContext, orgChannelID, ccID, \"OR('Org1MSP.member','Org2MSP.member')\", collConfig)\n\trequire.NoError(t, err)\n\n\tctxProvider := sdk.ChannelContext(orgChannelID, fabsdk.WithUser(org1User), fabsdk.WithOrg(org1Name))\n\n\tchClient, err := channel.New(ctxProvider)\n\trequire.NoError(t, err)\n\n\tt.Run(\"Specified Invocation Chain\", func(t *testing.T) {\n\t\tresponse, err := chClient.Execute(\n\t\t\tchannel.Request{\n\t\t\t\tChaincodeID: ccID,\n\t\t\t\tFcn: \"putprivate\",\n\t\t\t\tArgs: [][]byte{[]byte(coll1), []byte(\"key\"), []byte(\"value\")},\n\t\t\t\tInvocationChain: []*fab.ChaincodeCall{\n\t\t\t\t\t{ID: ccID, Collections: []string{coll1}},\n\t\t\t\t},\n\t\t\t},\n\t\t\tchannel.WithRetry(retry.TestRetryOpts),\n\t\t)\n\t\trequire.NoError(t, err)\n\t\tt.Logf(\"Got %d response(s)\", len(response.Responses))\n\t\trequire.NotEmptyf(t, response.Responses, \"expecting at least one response\")\n\t})\n\n\tt.Run(\"Auto-detect Invocation Chain\", func(t *testing.T) {\n\t\tresponse, err := chClient.Execute(\n\t\t\tchannel.Request{\n\t\t\t\tChaincodeID: ccID,\n\t\t\t\tFcn: \"putprivate\",\n\t\t\t\tArgs: [][]byte{[]byte(coll1), []byte(\"key\"), []byte(\"value\")},\n\t\t\t},\n\t\t\tchannel.WithRetry(retry.TestRetryOpts),\n\t\t)\n\t\trequire.NoError(t, err)\n\t\tt.Logf(\"Got %d response(s)\", len(response.Responses))\n\t\trequire.NotEmptyf(t, response.Responses, \"expecting at least one response\")\n\t})\n}", "func (m *MockCipher) Encrypt(arg0 []byte) ([]byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Encrypt\", arg0)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func StandardCrypto() {\n\n}", "func NewCryptographyServiceMock(t minimock.Tester) *CryptographyServiceMock {\n\tm := &CryptographyServiceMock{t: t}\n\n\tif controller, ok := t.(minimock.MockController); ok {\n\t\tcontroller.RegisterMocker(m)\n\t}\n\n\tm.GetPublicKeyMock = mCryptographyServiceMockGetPublicKey{mock: m}\n\tm.SignMock = mCryptographyServiceMockSign{mock: m}\n\tm.VerifyMock = mCryptographyServiceMockVerify{mock: m}\n\n\treturn m\n}", "func (m *MockInternalServer) CryptoAsymKeyDelete(arg0 context.Context, arg1 *CryptoAsymKeyDeleteRequestMsg) (*CryptoAsymKeyDeleteResponseMsg, error) {\n\tret := m.ctrl.Call(m, \"CryptoAsymKeyDelete\", arg0, arg1)\n\tret0, _ := ret[0].(*CryptoAsymKeyDeleteResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockC2Client) GetCryptoMode(arg0 context.Context, arg1 *pb.GetCryptoModeRequest, arg2 ...grpc.CallOption) (*pb.GetCryptoModeResponse, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetCryptoMode\", varargs...)\n\tret0, _ := ret[0].(*pb.GetCryptoModeResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockInternalServer) CryptoKeyCreate(arg0 context.Context, arg1 *CryptoKeyCreateRequestMsg) (*CryptoKeyCreateResponseMsg, error) {\n\tret := m.ctrl.Call(m, \"CryptoKeyCreate\", arg0, arg1)\n\tret0, _ := ret[0].(*CryptoKeyCreateResponseMsg)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockChoriaProvider) MainCollective() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"MainCollective\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func TestOAuth2ClientCredentialsCache(t *testing.T) {\n\t// Setup\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\n\t// Mock mockTokenProvider\n\tmockTokenProvider := mock.NewMockTokenProviderInterface(mockCtrl)\n\n\tgomock.InOrder(\n\t\t// First call returning abc and Bearer, expires within 1 second\n\t\tmockTokenProvider.\n\t\t\tEXPECT().\n\t\t\tGetToken(gomock.Any()).\n\t\t\tReturn(&oauth2.Token{\n\t\t\t\tAccessToken: \"abc\",\n\t\t\t\tTokenType: \"Bearer\",\n\t\t\t\tExpiry: time.Now().In(time.UTC).Add(1 * time.Second),\n\t\t\t}, nil).\n\t\t\tTimes(1),\n\t\t// Second call returning def and MAC, expires within 1 second\n\t\tmockTokenProvider.\n\t\t\tEXPECT().\n\t\t\tGetToken(gomock.Any()).\n\t\t\tReturn(&oauth2.Token{\n\t\t\t\tAccessToken: \"def\",\n\t\t\t\tTokenType: \"MAC\",\n\t\t\t\tExpiry: time.Now().In(time.UTC).Add(1 * time.Second),\n\t\t\t}, nil).\n\t\t\tTimes(1),\n\t)\n\n\t// Specify components metadata\n\tvar metadata middleware.Metadata\n\tmetadata.Properties = map[string]string{\n\t\t\"clientID\": \"testId\",\n\t\t\"clientSecret\": \"testSecret\",\n\t\t\"scopes\": \"ascope\",\n\t\t\"tokenURL\": \"https://localhost:9999\",\n\t\t\"headerName\": \"someHeader\",\n\t\t\"authStyle\": \"1\",\n\t}\n\n\t// Initialize middleware component and inject mocked TokenProvider\n\tlog := logger.NewLogger(\"oauth2clientcredentials.test\")\n\toauth2clientcredentialsMiddleware, _ := NewOAuth2ClientCredentialsMiddleware(log).(*Middleware)\n\toauth2clientcredentialsMiddleware.SetTokenProvider(mockTokenProvider)\n\thandler, err := oauth2clientcredentialsMiddleware.GetHandler(context.Background(), metadata)\n\trequire.NoError(t, err)\n\n\t// First handler call should return abc Token\n\tr := httptest.NewRequest(http.MethodGet, \"http://dapr.io\", nil)\n\tw := httptest.NewRecorder()\n\thandler(http.HandlerFunc(mockedRequestHandler)).ServeHTTP(w, r)\n\n\t// Assertion\n\tassert.Equal(t, \"Bearer abc\", r.Header.Get(\"someHeader\"))\n\n\t// Second handler call should still return 'cached' abc Token\n\tr = httptest.NewRequest(http.MethodGet, \"http://dapr.io\", nil)\n\tw = httptest.NewRecorder()\n\thandler(http.HandlerFunc(mockedRequestHandler)).ServeHTTP(w, r)\n\n\t// Assertion\n\tassert.Equal(t, \"Bearer abc\", r.Header.Get(\"someHeader\"))\n\n\t// Wait at a second to invalidate cache entry for abc\n\ttime.Sleep(1 * time.Second)\n\n\t// Third call should return def Token\n\tr = httptest.NewRequest(http.MethodGet, \"http://dapr.io\", nil)\n\tw = httptest.NewRecorder()\n\thandler(http.HandlerFunc(mockedRequestHandler)).ServeHTTP(w, r)\n\n\t// Assertion\n\tassert.Equal(t, \"MAC def\", r.Header.Get(\"someHeader\"))\n}", "func (suite *BaseSuite) SetupSuite() {\n\tif err := godotenv.Load(); err != nil {\n\t\tsuite.T().Log(err)\n\t}\n\n\tsetFromEnv := func(key string, target *string) {\n\t\tv := os.Getenv(key)\n\t\tif v == \"\" {\n\t\t\tsuite.FailNowf(\"missing environment variable\", \"%q required for integration tests.\", key)\n\t\t}\n\n\t\t*target = v\n\t}\n\n\tsetFromEnv(\"AZURE_TENANT_ID\", &suite.TenantID)\n\tsetFromEnv(\"AZURE_SUBSCRIPTION_ID\", &suite.SubscriptionID)\n\tsetFromEnv(\"AZURE_CLIENT_ID\", &suite.ClientID)\n\tsetFromEnv(\"AZURE_CLIENT_SECRET\", &suite.ClientSecret)\n\tsetFromEnv(\"SERVICEBUS_CONNECTION_STRING\", &suite.ConnStr)\n\tsetFromEnv(\"TEST_SERVICEBUS_RESOURCE_GROUP\", &suite.ResourceGroup)\n\n\t// TODO: automatically infer the location from the resource group, if it's not specified.\n\t// https://github.com/Azure/azure-service-bus-go/issues/40\n\tsetFromEnv(\"TEST_SERVICEBUS_LOCATION\", &suite.Location)\n\n\tparsed, err := conn.ParsedConnectionFromStr(suite.ConnStr)\n\tif !suite.NoError(err) {\n\t\tsuite.FailNowf(\"connection string could not be parsed\", \"Connection String: %q\", suite.ConnStr)\n\t}\n\tsuite.Namespace = parsed.Namespace\n\tsuite.Token = suite.servicePrincipalToken()\n\tsuite.Environment = azure.PublicCloud\n\tsuite.TagID = randomString(\"tag\", 10)\n\n\tif !suite.NoError(suite.ensureProvisioned(sbmgmt.SkuTierStandard)) {\n\t\tsuite.FailNow(\"failed to ensure provisioned\")\n\t}\n}", "func (m *MockIInterConnector) Key() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Key\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func (c *Provider) CryptoSuite() core.CryptoSuite {\n\treturn c.cryptoSuite\n}", "func TestAssetSysCC_IssueToken(t *testing.T) {\n\n\tfmt.Println(\"-----------------------------------\")\n\tfmt.Println(\"Test2: issueToken\")\n\n\tascc := new(AssetSysCC)\n\tstub := shim.NewMockStub(\"ascc\", ascc)\n\tcheckInit(t, stub, [][]byte{[]byte(\"\")})\n\n\n\tres_test2 := stub.MockInvoke(\"1\", [][]byte{[]byte(\"registerToken\"), []byte(\"SSToken\"), []byte(\"250\"), []byte(\"18\"), []byte(MAddress[:])})\n\n\tif res_test2.Status != shim.OK {\n\t\tfmt.Println(\"Register token failed\", string(res_test2.Message))\n\t\tt.FailNow()\n\t}\n\n\tres_test3 := stub.MockInvoke(\"1\", [][]byte{[]byte(\"issueToken\"), []byte(\"SSToken\"), []byte(\"250\"), []byte(\"18\"), []byte(MAddress[:])})\n\n\tif res_test3.Status != shim.OK {\n\t\tfmt.Println(\"Register token failed\", string(res_test3.Message))\n\t\tt.FailNow()\n\t}\n\tcheckQueryInfo(t, stub, [][]byte{[]byte(\"getTokenInfo\"), []byte(\"SSToken\")})\n\n\t////query token quantity\n\t//\tres1 := stub.MockInvoke(\"2\", [][]byte{[]byte(\"getBalance\"), []byte(MAddress[:]), []byte(\"SSToken\")});\n\t//\tif res1.Status != shim.OK {\n\t//\t\tfmt.Println(\"Query failed\", string(res1.Message))\n\t//\t\tt.FailNow()\n\t//\t}\n\t//\tamount,_ := strconv.Atoi(string(res1.Payload))\n\t//\tif amount != 250 {\n\t//\t\tfmt.Printf(\"Query result error! %v\", amount )\n\t//\t\tt.FailNow()\n\t//\t}\n\n\tfmt.Println(\"Test issueToken for a registered one Success!\")\n\n\tres_test4 := stub.MockInvoke(\"2\", [][]byte{[]byte(\"issueToken\"), []byte(\"MToken\"), []byte(\"888\"), []byte(\"20\"), []byte(testAddress[:])})\n\tif res_test4.Status != shim.OK {\n\t\tfmt.Println(\"Register token failed\", string(res_test3.Message))\n\t\tt.FailNow()\n\t}\n\tcheckQueryInfo(t, stub, [][]byte{[]byte(\"getTokenInfo\"), []byte(\"MToken\")})\n\n\t////query token quantity\n\t//res2 := stub.MockInvoke(\"2\", [][]byte{[]byte(\"getBalance\"), []byte(testAddress[:]), []byte(\"CMBToken\")});\n\t//if res1.Status != shim.OK {\n\t//\tfmt.Println(\"Query failed\", string(res2.Message))\n\t//\tt.FailNow()\n\t//}\n\t//amount2,_ := strconv.Atoi(string(res2.Payload))\n\t//if amount2 != 888 {\n\t//\tfmt.Printf(\"Query result error! %v\", amount2 )\n\t//\tt.FailNow()\n\t//}\n\n\tfmt.Println(\"Test issueToken for an un registered one Success!\")\n}", "func (m *MockisCryptoApiRequest_CryptoApiReq) Size() int {\n\tret := m.ctrl.Call(m, \"Size\")\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}", "func (m *MockSystemContract) Exec() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Exec\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func testTLSCertsAllocate(t *testing.T) {\n\tvar (\n\t\terr error\n\t)\n\n\ttestTLSCerts = &testTLSCertsStruct{}\n\n\ttestTLSCerts.caCertPEMBlock, testTLSCerts.caKeyPEMBlock, err = icertpkg.GenCACert(\n\t\ticertpkg.GenerateKeyAlgorithmEd25519,\n\t\tpkix.Name{\n\t\t\tOrganization: []string{\"Test Organization CA\"},\n\t\t\tCountry: []string{},\n\t\t\tProvince: []string{},\n\t\t\tLocality: []string{},\n\t\t\tStreetAddress: []string{},\n\t\t\tPostalCode: []string{},\n\t\t},\n\t\ttime.Hour,\n\t\t\"\",\n\t\t\"\")\n\tif nil != err {\n\t\tt.Fatalf(\"icertpkg.GenCACert() failed: %v\", err)\n\t}\n\n\ttestTLSCerts.endpointCertPEMBlock, testTLSCerts.endpointKeyPEMBlock, err = icertpkg.GenEndpointCert(\n\t\ticertpkg.GenerateKeyAlgorithmEd25519,\n\t\tpkix.Name{\n\t\t\tOrganization: []string{\"Test Organization Endpoint\"},\n\t\t\tCountry: []string{},\n\t\t\tProvince: []string{},\n\t\t\tLocality: []string{},\n\t\t\tStreetAddress: []string{},\n\t\t\tPostalCode: []string{},\n\t\t},\n\t\t[]string{},\n\t\t[]net.IP{net.ParseIP(\"127.0.0.1\")},\n\t\ttime.Hour,\n\t\ttestTLSCerts.caCertPEMBlock,\n\t\ttestTLSCerts.caKeyPEMBlock,\n\t\t\"\",\n\t\t\"\")\n\n\tif nil != err {\n\t\tt.Fatalf(\"icertpkg.genEndpointCert() failed: %v\", err)\n\t}\n\n\ttestTLSCerts.endpointTLSCert, err = tls.X509KeyPair(testTLSCerts.endpointCertPEMBlock, testTLSCerts.endpointKeyPEMBlock)\n\tif nil != err {\n\t\tt.Fatalf(\"tls.LoadX509KeyPair() failed: %v\", err)\n\t}\n}", "func TestPrivateData(t *testing.T) {\n\tsdk := mainSDK\n\n\torgsContext := setupMultiOrgContext(t, sdk)\n\terr := integration.EnsureChannelCreatedAndPeersJoined(t, sdk, orgChannelID, \"orgchannel.tx\", orgsContext)\n\trequire.NoError(t, err)\n\n\tcoll1 := \"collection1\"\n\tccID := integration.GenerateExamplePvtID(true)\n\tcollConfig, err := newCollectionConfig(coll1, \"OR('Org2MSP.member')\", 0, 2, 1000)\n\trequire.NoError(t, err)\n\n\tif metadata.CCMode == \"lscc\" {\n\t\terr = integration.InstallExamplePvtChaincode(orgsContext, ccID)\n\t\trequire.NoError(t, err)\n\t\terr = integration.InstantiateExamplePvtChaincode(orgsContext, orgChannelID, ccID, \"OR('Org1MSP.member','Org2MSP.member')\", collConfig)\n\t\trequire.NoError(t, err)\n\t} else {\n\t\terr := integration.InstantiatePvtExampleChaincodeLc(sdk, orgsContext, orgChannelID, ccID, \"OR('Org1MSP.member','Org2MSP.member')\", collConfig)\n\t\trequire.NoError(t, err)\n\t}\n\n\tctxProvider := sdk.ChannelContext(orgChannelID, fabsdk.WithUser(org1User), fabsdk.WithOrg(org1Name))\n\n\tchClient, err := channel.New(ctxProvider)\n\trequire.NoError(t, err)\n\n\tt.Run(\"Specified Invocation Chain\", func(t *testing.T) {\n\t\tresponse, err := chClient.Execute(\n\t\t\tchannel.Request{\n\t\t\t\tChaincodeID: ccID,\n\t\t\t\tFcn: \"putprivate\",\n\t\t\t\tArgs: [][]byte{[]byte(coll1), []byte(\"key\"), []byte(\"value\")},\n\t\t\t\tInvocationChain: []*fab.ChaincodeCall{\n\t\t\t\t\t{ID: ccID, Collections: []string{coll1}},\n\t\t\t\t},\n\t\t\t},\n\t\t\tchannel.WithRetry(retry.TestRetryOpts),\n\t\t)\n\t\trequire.NoError(t, err)\n\t\tt.Logf(\"Got %d response(s)\", len(response.Responses))\n\t\trequire.NotEmptyf(t, response.Responses, \"expecting at least one response\")\n\t})\n\n\tt.Run(\"Auto-detect Invocation Chain\", func(t *testing.T) {\n\t\tresponse, err := chClient.Execute(\n\t\t\tchannel.Request{\n\t\t\t\tChaincodeID: ccID,\n\t\t\t\tFcn: \"putprivate\",\n\t\t\t\tArgs: [][]byte{[]byte(coll1), []byte(\"key\"), []byte(\"value\")},\n\t\t\t},\n\t\t\tchannel.WithRetry(retry.TestRetryOpts),\n\t\t)\n\t\trequire.NoError(t, err)\n\t\tt.Logf(\"Got %d response(s)\", len(response.Responses))\n\t\trequire.NotEmptyf(t, response.Responses, \"expecting at least one response\")\n\t})\n}", "func newMockKvCapabilityVerifier(t mockConstructorTestingTnewMockKvCapabilityVerifier) *mockKvCapabilityVerifier {\n\tmock := &mockKvCapabilityVerifier{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "func newTestContext() (tc *testContext, err error) {\n\ttc = new(testContext)\n\n\tconst genesisHash = \"0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206\"\n\tif tc.netParams, err = tc.createNetParams(genesisHash); err != nil {\n\t\treturn\n\t}\n\n\tconst block1Hex = \"0000002006226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910fadbb20ea41a8423ea937e76e8151636bf6093b70eaff942930d20576600521fdc30f9858ffff7f20000000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03510101ffffffff0100f2052a010000001976a9143ca33c2e4446f4a305f23c80df8ad1afdcf652f988ac00000000\"\n\tif tc.block1, err = blockFromHex(block1Hex); err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized block: %v\", err)\n\t\treturn\n\t}\n\n\tconst fundingInputPrivKeyHex = \"6bd078650fcee8444e4e09825227b801a1ca928debb750eb36e6d56124bb20e8\"\n\ttc.fundingInputPrivKey, err = privkeyFromHex(fundingInputPrivKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized privkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst localFundingPrivKeyHex = \"30ff4956bbdd3222d44cc5e8a1261dab1e07957bdac5ae88fe3261ef321f3749\"\n\ttc.localFundingPrivKey, err = privkeyFromHex(localFundingPrivKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized privkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst localPaymentPrivKeyHex = \"bb13b121cdc357cd2e608b0aea294afca36e2b34cf958e2e6451a2f274694491\"\n\ttc.localPaymentPrivKey, err = privkeyFromHex(localPaymentPrivKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized privkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst localFundingPubKeyHex = \"023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb\"\n\ttc.localFundingPubKey, err = pubkeyFromHex(localFundingPubKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst remoteFundingPubKeyHex = \"030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c1\"\n\ttc.remoteFundingPubKey, err = pubkeyFromHex(remoteFundingPubKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst localRevocationPubKeyHex = \"0212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b19\"\n\ttc.localRevocationPubKey, err = pubkeyFromHex(localRevocationPubKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst localPaymentPubKeyHex = \"030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e7\"\n\ttc.localPaymentPubKey, err = pubkeyFromHex(localPaymentPubKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst remotePaymentPubKeyHex = \"0394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b\"\n\ttc.remotePaymentPubKey, err = pubkeyFromHex(remotePaymentPubKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst localDelayPubKeyHex = \"03fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c\"\n\ttc.localDelayPubKey, err = pubkeyFromHex(localDelayPubKeyHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst commitmentPointHex = \"025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486\"\n\ttc.commitmentPoint, err = pubkeyFromHex(commitmentPointHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst localPaymentBasePointHex = \"034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa\"\n\ttc.localPaymentBasePoint, err = pubkeyFromHex(localPaymentBasePointHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst remotePaymentBasePointHex = \"032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991\"\n\ttc.remotePaymentBasePoint, err = pubkeyFromHex(remotePaymentBasePointHex)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized pubkey: %v\", err)\n\t\treturn\n\t}\n\n\tconst fundingChangeAddressStr = \"bcrt1qgyeqfmptyh780dsk32qawsvdffc2g5q5sxamg0\"\n\ttc.fundingChangeAddress, err = btcutil.DecodeAddress(\n\t\tfundingChangeAddressStr, tc.netParams)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse address: %v\", err)\n\t\treturn\n\t}\n\n\ttc.fundingInputUtxo, tc.fundingInputTxOut, err = tc.extractFundingInput()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconst fundingTxHex = \"0200000001adbb20ea41a8423ea937e76e8151636bf6093b70eaff942930d20576600521fd000000006b48304502210090587b6201e166ad6af0227d3036a9454223d49a1f11839c1a362184340ef0240220577f7cd5cca78719405cbf1de7414ac027f0239ef6e214c90fcaab0454d84b3b012103535b32d5eb0a6ed0982a0479bbadc9868d9836f6ba94dd5a63be16d875069184ffffffff028096980000000000220020c015c4a6be010e21657068fc2e6a9d02b27ebe4d490a25846f7237f104d1a3cd20256d29010000001600143ca33c2e4446f4a305f23c80df8ad1afdcf652f900000000\"\n\tif tc.fundingTx, err = txFromHex(fundingTxHex); err != nil {\n\t\terr = fmt.Errorf(\"Failed to parse serialized tx: %v\", err)\n\t\treturn\n\t}\n\n\ttc.fundingOutpoint = wire.OutPoint{\n\t\tHash: *tc.fundingTx.Hash(),\n\t\tIndex: 0,\n\t}\n\n\ttc.shortChanID = lnwire.ShortChannelID{\n\t\tBlockHeight: 1,\n\t\tTxIndex: 0,\n\t\tTxPosition: 0,\n\t}\n\n\thtlcData := []struct {\n\t\tincoming bool\n\t\tamount lnwire.MilliSatoshi\n\t\texpiry uint32\n\t\tpreimage string\n\t}{\n\t\t{\n\t\t\tincoming: true,\n\t\t\tamount: 1000000,\n\t\t\texpiry: 500,\n\t\t\tpreimage: \"0000000000000000000000000000000000000000000000000000000000000000\",\n\t\t},\n\t\t{\n\t\t\tincoming: true,\n\t\t\tamount: 2000000,\n\t\t\texpiry: 501,\n\t\t\tpreimage: \"0101010101010101010101010101010101010101010101010101010101010101\",\n\t\t},\n\t\t{\n\t\t\tincoming: false,\n\t\t\tamount: 2000000,\n\t\t\texpiry: 502,\n\t\t\tpreimage: \"0202020202020202020202020202020202020202020202020202020202020202\",\n\t\t},\n\t\t{\n\t\t\tincoming: false,\n\t\t\tamount: 3000000,\n\t\t\texpiry: 503,\n\t\t\tpreimage: \"0303030303030303030303030303030303030303030303030303030303030303\",\n\t\t},\n\t\t{\n\t\t\tincoming: true,\n\t\t\tamount: 4000000,\n\t\t\texpiry: 504,\n\t\t\tpreimage: \"0404040404040404040404040404040404040404040404040404040404040404\",\n\t\t},\n\t}\n\n\ttc.htlcs = make([]channeldb.HTLC, len(htlcData))\n\tfor i, htlc := range htlcData {\n\t\tpreimage, decodeErr := hex.DecodeString(htlc.preimage)\n\t\tif decodeErr != nil {\n\t\t\terr = fmt.Errorf(\"Failed to decode HTLC preimage: %v\", decodeErr)\n\t\t\treturn\n\t\t}\n\n\t\ttc.htlcs[i].RHash = sha256.Sum256(preimage)\n\t\ttc.htlcs[i].Amt = htlc.amount\n\t\ttc.htlcs[i].RefundTimeout = htlc.expiry\n\t\ttc.htlcs[i].Incoming = htlc.incoming\n\t}\n\n\ttc.localCsvDelay = 144\n\ttc.fundingAmount = 10000000\n\ttc.dustLimit = 546\n\ttc.feePerKW = 15000\n\n\treturn\n}", "func mockPasswordHasher(x string) *crypto.PasswordHasher {\n\treturn &crypto.PasswordHasher{\n\t\tSwapper: passwap.NewSwapper(plainHasher{x: x}),\n\t\tPrefixes: []string{\"$plain$\"},\n\t}\n}", "func (m *MockSessionProvider) Exec(arg0 ...string) ([]byte, []byte, error) {\n\tvarargs := []interface{}{}\n\tfor _, a := range arg0 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Exec\", varargs...)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].([]byte)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "func TestGetOrder(t *testing.T) {\n\n // ...\n\n}", "func (m *MockAuthorizer) HashKey() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"HashKey\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func TestSIFTLib2(t *testing.T) { TestingT(t) }", "func (m *MockSessionRunner) Add(arg0 protocol.ConnectionID, arg1 packetHandler) [16]byte {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Add\", arg0, arg1)\n\tret0, _ := ret[0].([16]byte)\n\treturn ret0\n}", "func useUtilsSetupSuite(t *testing.T, name string) (string, string, string, func(t *testing.T)) {\n\t_, ca, err := utils.GenerateCA(name, name)\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\tcertKey, cert, err := utils.GenerateCert(name, name, []string{name}, []string{name})\n\tif err != nil {\n\t\tt.Error(err.Error())\n\t}\n\n\treturn ca, certKey, cert, func(t *testing.T) {\n\t\tdefer os.Remove(ca)\n\t\tdefer os.Remove(certKey)\n\t\tdefer os.Remove(cert)\n\t}\n}", "func TestService_Handle_Invitee(t *testing.T) {\n\tprotocolStateStore := mockstorage.NewMockStoreProvider()\n\tstore := mockstorage.NewMockStoreProvider()\n\tk := newKMS(t, store)\n\tprov := &protocol.MockProvider{\n\t\tStoreProvider: store,\n\t\tProtocolStateStoreProvider: protocolStateStore,\n\t\tServiceMap: map[string]interface{}{\n\t\t\tmediator.Coordination: &mockroute.MockMediatorSvc{},\n\t\t},\n\t\tCustomKMS: k,\n\t\tKeyTypeValue: kms.ED25519Type,\n\t\tKeyAgreementTypeValue: kms.X25519ECDHKWType,\n\t}\n\n\tctx := &context{\n\t\toutboundDispatcher: prov.OutboundDispatcher(),\n\t\tcrypto: &tinkcrypto.Crypto{},\n\t\tkms: k,\n\t\tkeyType: kms.ED25519Type,\n\t\tkeyAgreementType: kms.X25519ECDHKWType,\n\t}\n\n\tverPubKey, encPubKey := newSigningAndEncryptionDIDKeys(t, ctx)\n\n\tctx.vdRegistry = &mockvdr.MockVDRegistry{CreateValue: createDIDDocWithKey(verPubKey, encPubKey)}\n\n\tconnRec, err := connection.NewRecorder(prov)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, connRec)\n\n\tctx.connectionRecorder = connRec\n\n\tdoc, err := ctx.vdRegistry.Create(testMethod, nil)\n\trequire.NoError(t, err)\n\n\ts, err := New(prov)\n\trequire.NoError(t, err)\n\n\ts.ctx.vdRegistry = &mockvdr.MockVDRegistry{ResolveValue: doc.DIDDocument}\n\tactionCh := make(chan service.DIDCommAction, 10)\n\terr = s.RegisterActionEvent(actionCh)\n\trequire.NoError(t, err)\n\n\tstatusCh := make(chan service.StateMsg, 10)\n\terr = s.RegisterMsgEvent(statusCh)\n\trequire.NoError(t, err)\n\n\trequestedCh := make(chan string)\n\tcompletedCh := make(chan struct{})\n\n\tgo handleMessagesInvitee(statusCh, requestedCh, completedCh)\n\n\tgo func() { service.AutoExecuteActionEvent(actionCh) }()\n\n\tinvitation := &Invitation{\n\t\tType: InvitationMsgType,\n\t\tID: randomString(),\n\t\tLabel: \"Bob\",\n\t\tRecipientKeys: []string{verPubKey},\n\t\tServiceEndpoint: \"http://alice.agent.example.com:8081\",\n\t}\n\n\terr = ctx.connectionRecorder.SaveInvitation(invitation.ID, invitation)\n\trequire.NoError(t, err)\n\t// Alice receives an invitation from Bob\n\tpayloadBytes, err := json.Marshal(invitation)\n\trequire.NoError(t, err)\n\n\tdidMsg, err := service.ParseDIDCommMsgMap(payloadBytes)\n\trequire.NoError(t, err)\n\n\t_, err = s.HandleInbound(didMsg, service.EmptyDIDCommContext())\n\trequire.NoError(t, err)\n\n\tvar connID string\n\tselect {\n\tcase connID = <-requestedCh:\n\tcase <-time.After(2 * time.Second):\n\t\trequire.Fail(t, \"didn't receive post event requested\")\n\t}\n\n\t// Alice automatically sends a Request to Bob and is now in REQUESTED state.\n\tconnRecord, err := s.connectionRecorder.GetConnectionRecord(connID)\n\trequire.NoError(t, err)\n\trequire.Equal(t, (&requested{}).Name(), connRecord.State)\n\trequire.Equal(t, invitation.ID, connRecord.InvitationID)\n\trequire.Equal(t, invitation.RecipientKeys, connRecord.RecipientKeys)\n\trequire.Equal(t, invitation.ServiceEndpoint, connRecord.ServiceEndPoint)\n\n\tdidKey, err := ctx.getVerKey(invitation.ID)\n\trequire.NoError(t, err)\n\n\tdocAttach, err := ctx.didDocAttachment(doc.DIDDocument, didKey)\n\trequire.NoError(t, err)\n\n\t// Bob replies with a Response\n\tpayloadBytes, err = json.Marshal(\n\t\t&Response{\n\t\t\tType: ResponseMsgType,\n\t\t\tID: randomString(),\n\t\t\tDID: doc.DIDDocument.ID,\n\t\t\tDocAttach: docAttach,\n\t\t\tThread: &decorator.Thread{\n\t\t\t\tID: connRecord.ThreadID,\n\t\t\t},\n\t\t},\n\t)\n\trequire.NoError(t, err)\n\n\tdidMsg, err = service.ParseDIDCommMsgMap(payloadBytes)\n\trequire.NoError(t, err)\n\n\t_, err = s.HandleInbound(didMsg, service.EmptyDIDCommContext())\n\trequire.NoError(t, err)\n\n\t// Alice automatically sends an ACK to Bob\n\t// Alice must now be in COMPLETED state\n\tselect {\n\tcase <-completedCh:\n\tcase <-time.After(2 * time.Second):\n\t\trequire.Fail(t, \"didn't receive post event complete\")\n\t}\n\n\tvalidateState(t, s, connRecord.ThreadID, findNamespace(ResponseMsgType), (&completed{}).Name())\n}", "func testInMemoryDataStore() IDataStore {\n return NewInMemoryDataStore();\n}", "func TestGetAllOrders(t *testing.T) {\n\n // ...\n\n}", "func (m *MockisKey_KeyInfo) Size() int {\n\tret := m.ctrl.Call(m, \"Size\")\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}", "func TestAesEnDecrytion(t *testing.T) {\n\t//需要16的倍数\n\tpriKey := randStr(32)\n\toriStr := randStr(32)\n\tfmt.Println(\"original: \", oriStr)\n\tencrypted, err := AesEncrypt([]byte(oriStr), []byte(priKey))\n\tif err != nil {\n\t\tt.Errorf(\"encrypt err: %s\\n\", err.Error())\n\t}\n\tfmt.Println(\"encryptd: \", encrypted)\n\n\toriginal, err := AesDecrypt(encrypted, []byte(priKey))\n\tif err != nil {\n\t\tt.Errorf(\"decrypt err: %s\\n\", err.Error())\n\t}\n\tfmt.Println(\"decryptd: \", original)\n\tif original != oriStr {\n\t\tt.Errorf(\"Decryption Error, old: %s, new: %s\", oriStr, original)\n\t}\n}", "func (m *MockisIpsecCbKeyHandle_KeyOrHandle) Size() int {\n\tret := m.ctrl.Call(m, \"Size\")\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}", "func TestEmptyCommit4A(t *testing.T) {\n}", "func TestCiphering(t *testing.T) {\n\tpb, _ := hex.DecodeString(\"fe38240982f313ae5afb3e904fb8215fb11af1200592b\" +\n\t\t\"fca26c96c4738e4bf8f\")\n\tprivkey, _ := PrivKeyFromBytes(S256(), pb)\n\n\tin := []byte(\"This is just a test.\")\n\tout, _ := hex.DecodeString(\"b0d66e5adaa5ed4e2f0ca68e17b8f2fc02ca002009e3\" +\n\t\t\"3487e7fa4ab505cf34d98f131be7bd258391588ca7804acb30251e71a04e0020ecf\" +\n\t\t\"df0f84608f8add82d7353af780fbb28868c713b7813eb4d4e61f7b75d7534dd9856\" +\n\t\t\"9b0ba77cf14348fcff80fee10e11981f1b4be372d93923e9178972f69937ec850ed\" +\n\t\t\"6c3f11ff572ddd5b2bedf9f9c0b327c54da02a28fcdce1f8369ffec\")\n\n\tdec, err := Decrypt(privkey, out)\n\tif err != nil {\n\t\tt.Fatal(\"failed to decrypt:\", err)\n\t}\n\n\tif !bytes.Equal(in, dec) {\n\t\tt.Error(\"decrypted data doesn't match original\")\n\t}\n}", "func TestKyberTradingTestSuite(t *testing.T) {\n\tfmt.Println(\"Starting entry point for Kyber test suite...\")\n\n\ttradingSuite := new(TradingTestSuite)\n\tsuite.Run(t, tradingSuite)\n\n\tkyberTradingSuite := NewKyberTradingTestSuite(tradingSuite)\n\tsuite.Run(t, kyberTradingSuite)\n\n\tfmt.Println(\"Finishing entry point for 0x test suite...\")\n}", "func (m *MockisTlsCbKeyHandle_KeyOrHandle) Size() int {\n\tret := m.ctrl.Call(m, \"Size\")\n\tret0, _ := ret[0].(int)\n\treturn ret0\n}" ]
[ "0.6349443", "0.6250889", "0.61085963", "0.61015576", "0.609855", "0.5863399", "0.5833078", "0.5814647", "0.5803716", "0.57591796", "0.57540137", "0.57426", "0.57124424", "0.56994677", "0.56921124", "0.56864023", "0.56789786", "0.5662635", "0.5635828", "0.5629587", "0.5623318", "0.5584721", "0.5577739", "0.5574427", "0.55540407", "0.55523044", "0.55254585", "0.5515649", "0.55040234", "0.5493469", "0.5479536", "0.54750586", "0.5463222", "0.5454088", "0.5421137", "0.5418974", "0.5416784", "0.5407748", "0.5406221", "0.5395352", "0.53897595", "0.5369998", "0.53658", "0.5357557", "0.5345857", "0.5343158", "0.53374296", "0.533544", "0.5332733", "0.53317606", "0.53283614", "0.532031", "0.5311461", "0.5305934", "0.5283849", "0.5282254", "0.5281123", "0.5280674", "0.5262361", "0.5255106", "0.5240867", "0.52387685", "0.5234365", "0.5234103", "0.5228845", "0.5228581", "0.52209884", "0.5220208", "0.52201873", "0.5210762", "0.52090526", "0.52047503", "0.5202487", "0.5199722", "0.5197068", "0.5187813", "0.51866055", "0.51864123", "0.5176831", "0.5172813", "0.5166115", "0.51649743", "0.516155", "0.5159019", "0.51552755", "0.51531726", "0.5146844", "0.5146327", "0.51453596", "0.51434356", "0.51394904", "0.5138214", "0.5135526", "0.5134479", "0.5132012", "0.51314443", "0.51242816", "0.51215434", "0.51164895", "0.5115589" ]
0.61201334
2
CryptoSuite indicates an expected call of CryptoSuite
func (mr *MockProvidersMockRecorder) CryptoSuite() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CryptoSuite", reflect.TypeOf((*MockProviders)(nil).CryptoSuite)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (mr *MockClientMockRecorder) CryptoSuite() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CryptoSuite\", reflect.TypeOf((*MockClient)(nil).CryptoSuite))\n}", "func (pc *MockProviderContext) CryptoSuite() apicryptosuite.CryptoSuite {\n\treturn pc.cryptoSuite\n}", "func TestCorePkg_CreateCryptoSuiteProvider(t *testing.T) {\n\tpkg := newCorePkg()\n\trequire.NotNil(t, pkg)\n\n\tp, err := pkg.CreateCryptoSuiteProvider(nil)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, p)\n}", "func (c *Provider) CryptoSuite() core.CryptoSuite {\n\treturn c.cryptoSuite\n}", "func Test_Crypto(t *testing.T) {\n\trequire := require.New(t)\n\n\tc := &sm2.Driver{}\n\n\tpriv, err := c.GenKey()\n\trequire.Nil(err)\n\tt.Logf(\"priv:%X, len:%d\", priv.Bytes(), len(priv.Bytes()))\n\n\tpub := priv.PubKey()\n\trequire.NotNil(pub)\n\tt.Logf(\"pub:%X, len:%d\", pub.Bytes(), len(pub.Bytes()))\n\n\tmsg := []byte(\"hello world\")\n\tsignature := priv.Sign(msg)\n\tt.Logf(\"sign:%X, len:%d\", signature.Bytes(), len(signature.Bytes()))\n\n\tok := pub.VerifyBytes(msg, signature)\n\trequire.Equal(true, ok)\n}", "func CipherSuiteName(suite uint16) string {\n\tswitch suite {\n\tcase tls.TLS_RSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_RSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_RSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_RSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_AES_128_GCM_SHA256:\n\t\treturn \"TLS_AES_128_GCM_SHA256\"\n\tcase tls.TLS_AES_256_GCM_SHA384:\n\t\treturn \"TLS_AES_256_GCM_SHA384\"\n\tcase tls.TLS_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_FALLBACK_SCSV:\n\t\treturn \"TLS_FALLBACK_SCSV\"\n\t}\n\n\treturn \"Unknown\"\n}", "func (tradingSuite *KyberTradingTestSuite) SetupSuite() {\n\tfmt.Println(\"Setting up the suite...\")\n\t// Kovan env\n\ttradingSuite.EtherAddressStrKyber = \"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\"\n\n\ttradingSuite.IncKBNTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000082\"\n\ttradingSuite.IncSALTTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000081\"\n\ttradingSuite.IncOMGTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000072\"\n\ttradingSuite.IncSNTTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000071\"\n\ttradingSuite.KBNAddressStr = \"0xad67cB4d63C9da94AcA37fDF2761AaDF780ff4a2\" // kovan\n\ttradingSuite.SALTAddressStr = \"0x6fEE5727EE4CdCBD91f3A873ef2966dF31713A04\" // kovan\n\ttradingSuite.OMGAddressStr = \"0xdB7ec4E4784118D9733710e46F7C83fE7889596a\" // kovan\n\ttradingSuite.SNTAddressStr = \"0x4c99B04682fbF9020Fcb31677F8D8d66832d3322\" // kovan\n\ttradingSuite.KyberTradeDeployedAddr = common.HexToAddress(\"0x38A3cE5d944ff3de96401ddBFA9971D656222F89\") //kovan\n\ttradingSuite.KyberMultiTradeDeployedAddr = common.HexToAddress(\"0x8E7050E23A42052C75cdCE2d919f5e4F89afaD0a\") //kovan\n\ttradingSuite.DepositingEther = float64(0.05)\n\ttradingSuite.KyberContractAddr = common.HexToAddress(\"0x692f391bCc85cefCe8C237C01e1f636BbD70EA4D\") // kovan\n}", "func TestEncrypt() {\n\n}", "func TestPionE2ELossy(t *testing.T) {\n\t// Check for leaking routines\n\treport := transportTest.CheckRoutines(t)\n\tdefer report()\n\n\ttype runResult struct {\n\t\tdtlsConn *dtls.Conn\n\t\terr error\n\t}\n\n\tserverCert, err := selfsign.GenerateSelfSigned()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tclientCert, err := selfsign.GenerateSelfSigned()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfor _, test := range []struct {\n\t\tLossChanceRange int\n\t\tDoClientAuth bool\n\t\tCipherSuites []dtls.CipherSuiteID\n\t\tMTU int\n\t}{\n\t\t{\n\t\t\tLossChanceRange: 0,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 10,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 20,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 50,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 0,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 10,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 20,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 50,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 0,\n\t\t\tCipherSuites: []dtls.CipherSuiteID{dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 10,\n\t\t\tCipherSuites: []dtls.CipherSuiteID{dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 20,\n\t\t\tCipherSuites: []dtls.CipherSuiteID{dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 50,\n\t\t\tCipherSuites: []dtls.CipherSuiteID{dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 10,\n\t\t\tMTU: 100,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 20,\n\t\t\tMTU: 100,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 50,\n\t\t\tMTU: 100,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t} {\n\t\tname := fmt.Sprintf(\"Loss%d_MTU%d\", test.LossChanceRange, test.MTU)\n\t\tif test.DoClientAuth {\n\t\t\tname += \"_WithCliAuth\"\n\t\t}\n\t\tfor _, ciph := range test.CipherSuites {\n\t\t\tname += \"_With\" + ciph.String()\n\t\t}\n\t\ttest := test\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\t// Limit runtime in case of deadlocks\n\t\t\tlim := transportTest.TimeOut(lossyTestTimeout + time.Second)\n\t\t\tdefer lim.Stop()\n\n\t\t\trand.Seed(time.Now().UTC().UnixNano())\n\t\t\tchosenLoss := rand.Intn(9) + test.LossChanceRange //nolint:gosec\n\t\t\tserverDone := make(chan runResult)\n\t\t\tclientDone := make(chan runResult)\n\t\t\tbr := transportTest.NewBridge()\n\n\t\t\tif err = br.SetLossChance(chosenLoss); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\tgo func() {\n\t\t\t\tcfg := &dtls.Config{\n\t\t\t\t\tFlightInterval: flightInterval,\n\t\t\t\t\tCipherSuites: test.CipherSuites,\n\t\t\t\t\tInsecureSkipVerify: true,\n\t\t\t\t\tMTU: test.MTU,\n\t\t\t\t}\n\n\t\t\t\tif test.DoClientAuth {\n\t\t\t\t\tcfg.Certificates = []tls.Certificate{clientCert}\n\t\t\t\t}\n\n\t\t\t\tclient, startupErr := dtls.Client(dtlsnet.PacketConnFromConn(br.GetConn0()), br.GetConn0().RemoteAddr(), cfg)\n\t\t\t\tclientDone <- runResult{client, startupErr}\n\t\t\t}()\n\n\t\t\tgo func() {\n\t\t\t\tcfg := &dtls.Config{\n\t\t\t\t\tCertificates: []tls.Certificate{serverCert},\n\t\t\t\t\tFlightInterval: flightInterval,\n\t\t\t\t\tMTU: test.MTU,\n\t\t\t\t}\n\n\t\t\t\tif test.DoClientAuth {\n\t\t\t\t\tcfg.ClientAuth = dtls.RequireAnyClientCert\n\t\t\t\t}\n\n\t\t\t\tserver, startupErr := dtls.Server(dtlsnet.PacketConnFromConn(br.GetConn1()), br.GetConn1().RemoteAddr(), cfg)\n\t\t\t\tserverDone <- runResult{server, startupErr}\n\t\t\t}()\n\n\t\t\ttestTimer := time.NewTimer(lossyTestTimeout)\n\t\t\tvar serverConn, clientConn *dtls.Conn\n\t\t\tdefer func() {\n\t\t\t\tif serverConn != nil {\n\t\t\t\t\tif err = serverConn.Close(); err != nil {\n\t\t\t\t\t\tt.Error(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif clientConn != nil {\n\t\t\t\t\tif err = clientConn.Close(); err != nil {\n\t\t\t\t\t\tt.Error(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tfor {\n\t\t\t\tif serverConn != nil && clientConn != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tbr.Tick()\n\t\t\t\tselect {\n\t\t\t\tcase serverResult := <-serverDone:\n\t\t\t\t\tif serverResult.err != nil {\n\t\t\t\t\t\tt.Errorf(\"Fail, serverError: clientComplete(%t) serverComplete(%t) LossChance(%d) error(%v)\", clientConn != nil, serverConn != nil, chosenLoss, serverResult.err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tserverConn = serverResult.dtlsConn\n\t\t\t\tcase clientResult := <-clientDone:\n\t\t\t\t\tif clientResult.err != nil {\n\t\t\t\t\t\tt.Errorf(\"Fail, clientError: clientComplete(%t) serverComplete(%t) LossChance(%d) error(%v)\", clientConn != nil, serverConn != nil, chosenLoss, clientResult.err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tclientConn = clientResult.dtlsConn\n\t\t\t\tcase <-testTimer.C:\n\t\t\t\t\tt.Errorf(\"Test expired: clientComplete(%t) serverComplete(%t) LossChance(%d)\", clientConn != nil, serverConn != nil, chosenLoss)\n\t\t\t\t\treturn\n\t\t\t\tcase <-time.After(10 * time.Millisecond):\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func cipherSuiteName(id uint16) string {\n\tswitch id {\n\tcase 0x0005:\n\t\treturn \"TLS_RSA_WITH_RC4_128_SHA\"\n\tcase 0x000a:\n\t\treturn \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase 0x002f:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA\"\n\tcase 0x0035:\n\t\treturn \"TLS_RSA_WITH_AES_256_CBC_SHA\"\n\tcase 0x003c:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase 0x009c:\n\t\treturn \"TLS_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase 0x009d:\n\t\treturn \"TLS_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase 0xc007:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\"\n\tcase 0xc009:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\"\n\tcase 0xc00a:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\"\n\tcase 0xc011:\n\t\treturn \"TLS_ECDHE_RSA_WITH_RC4_128_SHA\"\n\tcase 0xc012:\n\t\treturn \"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase 0xc013:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\"\n\tcase 0xc014:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\"\n\tcase 0xc023:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\"\n\tcase 0xc027:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase 0xc02f:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase 0xc02b:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\"\n\tcase 0xc030:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase 0xc02c:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\"\n\tcase 0xcca8:\n\t\treturn \"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase 0xcca9:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase 0x1301:\n\t\treturn \"TLS_AES_128_GCM_SHA256\"\n\tcase 0x1302:\n\t\treturn \"TLS_AES_256_GCM_SHA384\"\n\tcase 0x1303:\n\t\treturn \"TLS_CHACHA20_POLY1305_SHA256\"\n\tcase 0x5600:\n\t\treturn \"TLS_FALLBACK_SCSV\"\n\t}\n\treturn fmt.Sprintf(\"0x%04X\", id)\n}", "func ProviderTestKOSeal() (configstore.ItemList, error) {\n\tret := configstore.ItemList{\n\t\tItems: []configstore.Item{\n\t\t\tconfigstore.NewItem(\n\t\t\t\tkeyloader.EncryptionKeyConfigName,\n\t\t\t\t`{\"key\":\"5fdb8af280b007a46553dfddb3f42bc10619dcabca8d4fdf5239b09445ab1a41\",\"identifier\":\"test\",\"sealed\":false,\"timestamp\":10,\"cipher\":\"aes-gcm\"}`,\n\t\t\t\t1,\n\t\t\t),\n\t\t\tconfigstore.NewItem(\n\t\t\t\tkeyloader.EncryptionKeyConfigName,\n\t\t\t\t`{\"key\":\"QXdDW4N/jmJzpMu7i1zu4YF1opTn7H+eOk9CLFGBSFg=\",\"identifier\":\"test\",\"sealed\":true,\"timestamp\":1,\"cipher\":\"xchacha20-poly1305\"}`,\n\t\t\t\t1,\n\t\t\t),\n\t\t},\n\t}\n\treturn ret, nil\n}", "func TestPagarmeEncryptCard(t *testing.T) {\n\t\n\tCard := new(pagarme.Card)\n\tPagarme := pagarme.NewPagarme(\"pt-BR\", ApiKey, CryptoKey)\n Pagarme.SetDebug()\n\n\tpagarmeFillCard(Card)\n\n\tresult, err := Pagarme.EncryptCard(Card)\n\n if err != nil {\n \tt.Errorf(\"Erro ao encrypt card: %v\", err)\n return\n }\n\n if len(result.Hash) == 0 {\n t.Errorf(\"card hash is expected\")\n return\n }\n}", "func TestSignContractFailure(t *testing.T) {\n\tsignatureHelper(t, true)\n}", "func TestInitAessiv(t *testing.T) {\n\tdir := test_helpers.InitFS(t, \"-aessiv\")\n\t_, c, err := configfile.LoadAndDecrypt(dir+\"/\"+configfile.ConfDefaultName, testPw)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !c.IsFeatureFlagSet(configfile.FlagAESSIV) {\n\t\tt.Error(\"AESSIV flag should be set but is not\")\n\t}\n}", "func (s *SignSuite) TearDownSuite(c *C) {\n}", "func CipherSuiteString(value uint16) string {\n\tif str, found := tlsCipherSuiteString[value]; found {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"TLS_CIPHER_SUITE_UNKNOWN_%d\", value)\n}", "func CipherSuiteName(id uint16) string", "func TestCompliancetestDemo(t *testing.T) {\n\t// Register new Vendor account\n\tvendor := utils.CreateNewAccount(auth.AccountRoles{auth.Vendor}, testconstants.VID)\n\n\t// Register new TestHouse account\n\ttestHouse := utils.CreateNewAccount(auth.AccountRoles{auth.TestHouse}, 0)\n\n\t// Register new TestHouse account\n\tsecondTestHouse := utils.CreateNewAccount(auth.AccountRoles{auth.TestHouse}, 0)\n\n\t// Publish model info\n\tmodel := utils.NewMsgAddModel(vendor.Address, testconstants.VID)\n\t_, _ = utils.AddModel(model, vendor)\n\t// Publish modelVersion\n\tmodelVersion := utils.NewMsgAddModelVersion(model.VID, model.PID,\n\t\ttestconstants.SoftwareVersion, testconstants.SoftwareVersionString, vendor.Address)\n\t_, _ = utils.AddModelVersion(modelVersion, vendor)\n\n\t// Publish first testing result using Sign and Broadcast AddTestingResult message\n\tfirstTestingResult := utils.NewMsgAddTestingResult(model.VID, model.PID,\n\t\tmodelVersion.SoftwareVersion, modelVersion.SoftwareVersionString, testHouse.Address)\n\tutils.SignAndBroadcastMessage(testHouse, firstTestingResult)\n\n\t// Check testing result is created\n\treceivedTestingResult, _ := utils.GetTestingResult(firstTestingResult.VID,\n\t\tfirstTestingResult.PID, firstTestingResult.SoftwareVersion)\n\trequire.Equal(t, receivedTestingResult.VID, firstTestingResult.VID)\n\trequire.Equal(t, receivedTestingResult.PID, firstTestingResult.PID)\n\trequire.Equal(t, receivedTestingResult.SoftwareVersion, firstTestingResult.SoftwareVersion)\n\trequire.Equal(t, 1, len(receivedTestingResult.Results))\n\trequire.Equal(t, receivedTestingResult.Results[0].TestResult, firstTestingResult.TestResult)\n\trequire.Equal(t, receivedTestingResult.Results[0].TestDate, firstTestingResult.TestDate)\n\trequire.Equal(t, receivedTestingResult.Results[0].Owner, firstTestingResult.Signer)\n\n\t// Publish second model info\n\tsecondModel := utils.NewMsgAddModel(vendor.Address, testconstants.VID)\n\t_, _ = utils.AddModel(secondModel, vendor)\n\t// Publish second modelVersion\n\tsecondModelVersion := utils.NewMsgAddModelVersion(secondModel.VID, secondModel.PID,\n\t\ttestconstants.SoftwareVersion, testconstants.SoftwareVersionString, vendor.Address)\n\t_, _ = utils.AddModelVersion(secondModelVersion, vendor)\n\n\t// Publish second testing result using POST\n\tsecondTestingResult := utils.NewMsgAddTestingResult(secondModel.VID, secondModel.PID,\n\t\tsecondModelVersion.SoftwareVersion, secondModelVersion.SoftwareVersionString, testHouse.Address)\n\t_, _ = utils.PublishTestingResult(secondTestingResult, testHouse)\n\n\t// Check testing result is created\n\treceivedTestingResult, _ = utils.GetTestingResult(secondTestingResult.VID,\n\t\tsecondTestingResult.PID, secondTestingResult.SoftwareVersion)\n\trequire.Equal(t, receivedTestingResult.VID, secondTestingResult.VID)\n\trequire.Equal(t, receivedTestingResult.PID, secondTestingResult.PID)\n\trequire.Equal(t, receivedTestingResult.SoftwareVersion, secondTestingResult.SoftwareVersion)\n\trequire.Equal(t, 1, len(receivedTestingResult.Results))\n\trequire.Equal(t, receivedTestingResult.Results[0].TestResult, secondTestingResult.TestResult)\n\trequire.Equal(t, receivedTestingResult.Results[0].TestDate, secondTestingResult.TestDate)\n\trequire.Equal(t, receivedTestingResult.Results[0].Owner, secondTestingResult.Signer)\n\n\t// Publish new testing result for second model\n\tthirdTestingResult := utils.NewMsgAddTestingResult(secondModel.VID, secondModel.PID,\n\t\tsecondModelVersion.SoftwareVersion, secondModelVersion.SoftwareVersionString, secondTestHouse.Address)\n\t_, _ = utils.PublishTestingResult(thirdTestingResult, secondTestHouse)\n\n\t// Check testing result is created\n\treceivedTestingResult, _ = utils.GetTestingResult(secondTestingResult.VID,\n\t\tsecondTestingResult.PID, secondTestingResult.SoftwareVersion)\n\trequire.Equal(t, 2, len(receivedTestingResult.Results))\n\trequire.Equal(t, receivedTestingResult.Results[0].Owner, secondTestingResult.Signer)\n\trequire.Equal(t, receivedTestingResult.Results[0].TestResult, secondTestingResult.TestResult)\n\trequire.Equal(t, receivedTestingResult.Results[1].Owner, thirdTestingResult.Signer)\n\trequire.Equal(t, receivedTestingResult.Results[1].TestResult, thirdTestingResult.TestResult)\n}", "func TestChallenge11Cbc(test *testing.T) {\n\tmode, err := unsafeaes.DetectMode(cbcOracle{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif mode != \"CBC\" {\n\t\ttest.Errorf(\"expected AES mode CBC to be detected but instead detected %s\", mode)\n\t}\n}", "func cipherSuiteScan(addr, hostname string) (grade Grade, output Output, err error) {\n\tvar cvList cipherVersionList\n\tallCiphers := allCiphersIDs()\n\n\tvar vers uint16\n\tfor vers = tls.VersionTLS12; vers >= tls.VersionSSL30; vers-- {\n\t\tciphers := make([]uint16, len(allCiphers))\n\t\tcopy(ciphers, allCiphers)\n\t\tfor len(ciphers) > 0 {\n\t\t\tvar cipherIndex int\n\t\t\tcipherIndex, _, _, err = sayHello(addr, hostname, ciphers, nil, vers, nil)\n\t\t\tif err != nil {\n\t\t\t\tif err == errHelloFailed {\n\t\t\t\t\terr = nil\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif vers == tls.VersionSSL30 {\n\t\t\t\tgrade = Warning\n\t\t\t}\n\t\t\tcipherID := ciphers[cipherIndex]\n\n\t\t\t// If this is an EC cipher suite, do a second scan for curve support\n\t\t\tvar supportedCurves []tls.CurveID\n\t\t\tif tls.CipherSuites[cipherID].EllipticCurve {\n\t\t\t\tsupportedCurves, err = doCurveScan(addr, hostname, vers, cipherID, ciphers)\n\t\t\t\tif len(supportedCurves) == 0 {\n\t\t\t\t\terr = errors.New(\"couldn't negotiate any curves\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor i, c := range cvList {\n\t\t\t\tif cipherID == c.cipherID {\n\t\t\t\t\tcvList[i].data = append(c.data, cipherDatum{vers, supportedCurves})\n\t\t\t\t\tgoto exists\n\t\t\t\t}\n\t\t\t}\n\t\t\tcvList = append(cvList, cipherVersions{cipherID, []cipherDatum{{vers, supportedCurves}}})\n\t\texists:\n\t\t\tciphers = append(ciphers[:cipherIndex], ciphers[cipherIndex+1:]...)\n\t\t}\n\t}\n\n\tif len(cvList) == 0 {\n\t\terr = errors.New(\"couldn't negotiate any cipher suites\")\n\t\treturn\n\t}\n\n\tif grade != Warning {\n\t\tgrade = Good\n\t}\n\n\toutput = cvList\n\treturn\n}", "func TestVigenereCipher(t *testing.T) {\n\tvar vigenere Vigenere\n\n\tcases := []struct {\n\t\tcaseString string\n\t\tcaseKey string\n\t\texpected string\n\t\t// Tells if a case is of success or fail\n\t\tsuccess bool\n\t}{\n\t\t{\n\t\t\tcaseString: \"Deus e bom, o tempo todo\",\n\t\t\tcaseKey: \"UnB\",\n\t\t\texpected: \"Xrvm r ciz, p nrnjb uiqp\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"Fim de semestre eh assim\",\n\t\t\tcaseKey: \"hard\",\n\t\t\texpected: \"Mid gl svplskul ey dzszp\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"this year was a tragic year\",\n\t\t\tcaseKey: \"corona\",\n\t\t\texpected: \"vvzg lecf nof a vfruvc asrf\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"die Kunst des Rechnens\",\n\t\t\tcaseKey: \"GOLANG\",\n\t\t\texpected: \"jwp Khtyh oef Xkqsnrty\",\n\t\t\tsuccess: true,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"a chave de codificacao eh restrita\",\n\t\t\tcaseKey: \"%\",\n\t\t\texpected: \"? a,?:) () a3(-*-a?a?3 ), 6)786-8?\",\n\t\t\tsuccess: false,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"somente caracteres alfabeticos da ascii podem ser utilizados\",\n\t\t\tcaseKey: \"123\",\n\t\t\texpected: \"c@?5?f5 43b25d6d5d 3<7326f94ac 53 1d59: b?57= d7b ff9=;j26?d\",\n\t\t\tsuccess: false,\n\t\t},\n\n\t\t{\n\t\t\tcaseString: \"Porem, tanto faz Usar MaIUsCUlo ou MINUSculo\",\n\t\t\tcaseKey: \"GOisNice\",\n\t\t\texpected: \"Vczwz, bcrzc nsm Cuex AiAHaEYrc wm ZQPYYqcdb\",\n\t\t\tsuccess: true,\n\t\t},\n\t}\n\tfor _, c := range cases {\n\t\tif c.success {\n\t\t\t// Success cases\n\t\t\tt.Logf(\"Vigenere testing: %s <key: %s> -> %s\", c.caseString, c.caseKey, c.expected)\n\t\t\tresult, err := vigenere.Cipher(c.caseString, c.caseKey)\n\n\t\t\tif err != nil {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected: %s; got ERROR: %s\", c.caseString, c.caseKey, c.expected, err)\n\t\t\t}\n\n\t\t\tif result != c.expected {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected: %s; got: %s\", c.caseString, c.caseKey, c.expected, result)\n\t\t\t}\n\t\t} else {\n\t\t\t// Fail cases\n\t\t\tt.Logf(\"Vigenere testing: %s <key: %s> -> expected err\", c.caseString, c.caseKey)\n\t\t\tresult, err := vigenere.Cipher(c.caseString, c.caseKey)\n\n\t\t\tif err == nil {\n\t\t\t\tt.Errorf(\"Vigenere FAILED: %s <key: %s> -> expected error, but got: %s\", c.caseString, c.caseKey, result)\n\t\t\t}\n\t\t}\n\t}\n}", "func TestCipheringBasic(t *testing.T) {\n\tprivkey, err := NewPrivateKey(S256())\n\tif err != nil {\n\t\tt.Fatal(\"failed to generate private key\")\n\t}\n\n\tin := []byte(\"Hey there dude. How are you doing? This is a test.\")\n\n\tout, err := Encrypt(privkey.PubKey(), in)\n\tif err != nil {\n\t\tt.Fatal(\"failed to encrypt:\", err)\n\t}\n\n\tdec, err := Decrypt(privkey, out)\n\tif err != nil {\n\t\tt.Fatal(\"failed to decrypt:\", err)\n\t}\n\n\tif !bytes.Equal(in, dec) {\n\t\tt.Error(\"decrypted data doesn't match original\")\n\t}\n}", "func (mr *MockisCryptoApiRequest_CryptoApiReqMockRecorder) isCryptoApiRequest_CryptoApiReq() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"isCryptoApiRequest_CryptoApiReq\", reflect.TypeOf((*MockisCryptoApiRequest_CryptoApiReq)(nil).isCryptoApiRequest_CryptoApiReq))\n}", "func InsecureCipherSuites() []*tls.CipherSuite", "func TestPionE2ELossy(t *testing.T) {\n\tserverCert, serverKey, err := dtls.GenerateSelfSigned()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tclientCert, clientKey, err := dtls.GenerateSelfSigned()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfor _, test := range []struct {\n\t\tLossChanceRange int\n\t\tDoClientAuth bool\n\t\tCipherSuites []dtls.CipherSuiteID\n\t}{\n\t\t{\n\t\t\tLossChanceRange: 0,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 10,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 20,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 50,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 0,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 10,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 20,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 50,\n\t\t\tDoClientAuth: true,\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 0,\n\t\t\tCipherSuites: []dtls.CipherSuiteID{dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 10,\n\t\t\tCipherSuites: []dtls.CipherSuiteID{dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 20,\n\t\t\tCipherSuites: []dtls.CipherSuiteID{dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\n\t\t},\n\t\t{\n\t\t\tLossChanceRange: 50,\n\t\t\tCipherSuites: []dtls.CipherSuiteID{dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA},\n\t\t},\n\t} {\n\t\trand.Seed(time.Now().UTC().UnixNano())\n\t\tchosenLoss := rand.Intn(9) + test.LossChanceRange\n\t\tserverDone := make(chan error)\n\t\tclientDone := make(chan error)\n\t\tbr := transportTest.NewBridge()\n\t\tif err := br.SetLossChance(chosenLoss); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tgo func() {\n\t\t\tcfg := &dtls.Config{\n\t\t\t\tFlightInterval: flightInterval,\n\t\t\t\tCipherSuites: test.CipherSuites,\n\t\t\t}\n\t\t\tif test.DoClientAuth {\n\t\t\t\tcfg.Certificate = clientCert\n\t\t\t\tcfg.PrivateKey = clientKey\n\t\t\t}\n\n\t\t\tif _, err := dtls.Client(br.GetConn0(), cfg); err != nil {\n\t\t\t\tclientDone <- err\n\t\t\t} else {\n\t\t\t\tclose(clientDone)\n\t\t\t}\n\t\t}()\n\n\t\tgo func() {\n\t\t\tcfg := &dtls.Config{\n\t\t\t\tCertificate: serverCert,\n\t\t\t\tPrivateKey: serverKey,\n\t\t\t\tFlightInterval: flightInterval,\n\t\t\t}\n\t\t\tif test.DoClientAuth {\n\t\t\t\tcfg.ClientAuth = dtls.RequireAnyClientCert\n\n\t\t\t}\n\n\t\t\tif _, err := dtls.Server(br.GetConn1(), cfg); err != nil {\n\t\t\t\tserverDone <- err\n\t\t\t} else {\n\t\t\t\tclose(serverDone)\n\t\t\t}\n\t\t}()\n\n\t\ttestTimer := time.NewTimer(lossyTestTimeout)\n\t\tvar serverComplete, clientComplete bool\n\t\tfor {\n\t\t\tif serverComplete && clientComplete {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tbr.Tick()\n\t\t\tselect {\n\t\t\tcase err, ok := <-serverDone:\n\t\t\t\tif ok {\n\t\t\t\t\tt.Fatalf(\"Fail, serverError: clientComplete(%t) serverComplete(%t) LossChance(%d) error(%v)\", clientComplete, serverComplete, chosenLoss, err)\n\t\t\t\t}\n\n\t\t\t\tserverComplete = true\n\t\t\tcase err, ok := <-clientDone:\n\t\t\t\tif ok {\n\t\t\t\t\tt.Fatalf(\"Fail, clientError: clientComplete(%t) serverComplete(%t) LossChance(%d) error(%v)\", clientComplete, serverComplete, chosenLoss, err)\n\t\t\t\t}\n\n\t\t\t\tclientComplete = true\n\t\t\tcase <-testTimer.C:\n\t\t\t\tt.Fatalf(\"Test expired: clientComplete(%t) serverComplete(%t) LossChance(%d)\", clientComplete, serverComplete, chosenLoss)\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}\n\n}", "func TestRequestAttestationReport(t *testing.T) {\n\n\tias := NewIAS()\n\tverifier := VerifierImpl{}\n\n\tquoteAsBytes, err := base64.StdEncoding.DecodeString(quote)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\" Can not parse quoteBase64 string: \" + err.Error() + \" \\\"}\"\n\t\tt.Errorf(jsonResp)\n\t}\n\n\t// send quote to intel for verification\n\tattestationReport, err := ias.RequestAttestationReport(apiKey, quoteAsBytes)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\" Error while retrieving attestation report: \" + err.Error() + \"\\\"}\"\n\t\tt.Errorf(jsonResp)\n\t}\n\n\tverificationPK, err := ias.GetIntelVerificationKey()\n\tif err != nil {\n\t\tt.Errorf(\"Can not parse verifiaction key: %s\", err)\n\t}\n\n\t// verify attestation report\n\tisValid, err := verifier.VerifyAttestionReport(verificationPK, attestationReport)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\" Error while attestation report verification: \" + err.Error() + \"\\\"}\"\n\t\tt.Errorf(jsonResp)\n\t}\n\tif !isValid {\n\t\tjsonResp := \"{\\\"Error\\\":\\\" Attestation report is not valid \\\"}\"\n\t\tt.Errorf(jsonResp)\n\t}\n\n}", "func AssertCertificateHasClientAuthUsage(t *testing.T, cert *x509.Certificate) {\n\tfor i := range cert.ExtKeyUsage {\n\t\tif cert.ExtKeyUsage[i] == x509.ExtKeyUsageClientAuth {\n\t\t\treturn\n\t\t}\n\t}\n\tt.Error(\"cert has not ClientAuth usage as expected\")\n}", "func (s *SignSuite) SetUpTest(c *C) {\n}", "func (suite *EmailTests) SetUpSuite(c *C) {\n}", "func TestSecretsShouldBeEnveloped(t *testing.T) {\n\tvar testCases = []struct {\n\t\ttransformerConfigContent string\n\t\ttransformerPrefix string\n\t\tunSealFunc unSealSecret\n\t}{\n\t\t{aesGCMConfigYAML, aesGCMPrefix, unSealWithGCMTransformer},\n\t\t{aesCBCConfigYAML, aesCBCPrefix, unSealWithCBCTransformer},\n\t\t// TODO: add secretbox\n\t}\n\tfor _, tt := range testCases {\n\t\trunEnvelopeTest(t, tt.unSealFunc, tt.transformerConfigContent, tt.transformerPrefix)\n\t}\n}", "func TestAckInstalledApplicationListDuplicateRegression(t *testing.T) {\n\n}", "func (mr *MockisCryptoAsymApiReqSetupPrivateKeyEx_KeyMockRecorder) isCryptoAsymApiReqSetupPrivateKeyEx_Key() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"isCryptoAsymApiReqSetupPrivateKeyEx_Key\", reflect.TypeOf((*MockisCryptoAsymApiReqSetupPrivateKeyEx_Key)(nil).isCryptoAsymApiReqSetupPrivateKeyEx_Key))\n}", "func TestAuthorise(t *testing.T) {\n\tt.Parallel()\n\n\tinstance := getTestInstance()\n\n\tauthRequest := &Authorise{\n\t\tCard: &Card{\n\t\t\tNumber: \"4111111111111111\",\n\t\t\tExpireMonth: \"08\",\n\t\t\tExpireYear: \"2018\",\n\t\t\tCvc: \"737\",\n\t\t\tHolderName: \"John Smith\",\n\t\t},\n\t\tAmount: &Amount{\n\t\t\tValue: 1000,\n\t\t\tCurrency: \"EUR\",\n\t\t},\n\t\tReference: \"DE-TEST-1\" + randomString(10),\n\t\tMerchantAccount: os.Getenv(\"ADYEN_ACCOUNT\"),\n\t}\n\n\tresponse, err := instance.Payment().Authorise(authRequest)\n\n\tknownError, ok := err.(APIError)\n\tif ok {\n\t\tt.Errorf(\"Response should be succesfull. Known API Error: Code - %s, Message - %s, Type - %s\", knownError.ErrorCode, knownError.Message, knownError.ErrorType)\n\t}\n\n\tif err != nil {\n\t\tt.Errorf(\"Response should be succesfull, error - %s\", err.Error())\n\t}\n\n\tresponseBytes, err := json.Marshal(response)\n\n\tif err != nil {\n\t\tt.Error(\"Response can't be converted to JSON\")\n\t}\n\n\tif response.PspReference == \"\" {\n\t\tt.Errorf(\"Response should contain PSP Reference. Response - %s\", string(responseBytes))\n\t}\n\n\tif response.ResultCode != \"Authorised\" {\n\t\tt.Errorf(\"Response resultCode should be Authorised, Response - %s\", string(responseBytes))\n\t}\n}", "func TestMain(m *testing.M) {\n\tconfigImp = mocks.NewMockConfig(caServerURL)\n\tcryptoSuiteProvider, _ = cryptosuiteimpl.GetSuiteByConfig(configImp)\n\tif cryptoSuiteProvider == nil {\n\t\tpanic(\"Failed initialize cryptoSuiteProvider\")\n\t}\n\t// Start Http Server\n\tgo mocks.StartFabricCAMockServer(strings.TrimPrefix(caServerURL, \"http://\"))\n\t// Allow HTTP server to start\n\ttime.Sleep(1 * time.Second)\n\tos.Exit(m.Run())\n}", "func (s *TestSuite) setup() {\n\t// The first few keys from the following well-known mnemonic used by 0x:\n\t//\tconcert load couple harbor equip island argue ramp clarify fence smart topic\n\tkeys := []string{\n\t\t\"f2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d\",\n\t\t\"5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72\",\n\t\t\"df02719c4df8b9b8ac7f551fcb5d9ef48fa27eef7a66453879f4d8fdc6e78fb1\",\n\t\t\"ff12e391b79415e941a94de3bf3a9aee577aed0731e297d5cfa0b8a1e02fa1d0\",\n\t\t\"752dd9cf65e68cfaba7d60225cbdbc1f4729dd5e5507def72815ed0d8abc6249\",\n\t\t\"efb595a0178eb79a8df953f87c5148402a224cdf725e88c0146727c6aceadccd\",\n\t}\n\ts.account = make([]account, len(keys))\n\tfor i, key := range keys {\n\t\tb, err := hex.DecodeString(key)\n\t\ts.Require().NoError(err)\n\t\ts.account[i].key, err = crypto.ToECDSA(b)\n\t\ts.Require().NoError(err)\n\t}\n\ts.signer = signer(s.account[0])\n}", "func testBatchCTXServiceClassCodeEquality(t testing.TB) {\n\tmockBatch := mockBatchCTX(t)\n\tmockBatch.GetControl().ServiceClassCode = MixedDebitsAndCredits\n\terr := mockBatch.Validate()\n\tif !base.Match(err, NewErrBatchHeaderControlEquality(220, MixedDebitsAndCredits)) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "func (suite *SmsTests) SetUpSuite(c *C) {\n}", "func (suite *AWSSecurityGroupManagerTestSuite) SetupSuite() {\n\tsuite.Prov = GetProvider()\n}", "func StandardCrypto() {\n\n}", "func TestEmptyCommit4A(t *testing.T) {\n}", "func CipherSuites() []*tls.CipherSuite", "func (mr *MockisCryptoAsymApiRespSetupPrivateKey_KeyInfoMockRecorder) isCryptoAsymApiRespSetupPrivateKey_KeyInfo() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"isCryptoAsymApiRespSetupPrivateKey_KeyInfo\", reflect.TypeOf((*MockisCryptoAsymApiRespSetupPrivateKey_KeyInfo)(nil).isCryptoAsymApiRespSetupPrivateKey_KeyInfo))\n}", "func defaultCipherSuite() []uint16 {\n\treturn []uint16{\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,\n\t\ttls.TLS_RSA_WITH_AES_128_GCM_SHA256,\n\t\ttls.TLS_RSA_WITH_AES_256_GCM_SHA384,\n\t\ttls.TLS_RSA_WITH_AES_128_CBC_SHA,\n\t\ttls.TLS_RSA_WITH_AES_256_CBC_SHA,\n\t}\n}", "func BoringCrypto() {\n\n}", "func (suite *iamTestSuite) SetupSuite() {\n\tvar err error\n\terr = ioutil.WriteFile(testKeyFile, []byte(testKeyPemRaw), 0600)\n\tsuite.Require().NoErrorf(err, \"cannot create private key file %s: %v\", testKeyFile, err)\n\terr = generateBadPrivateKeyPEM(testBadKeyFile)\n\tsuite.Require().NoErrorf(err, \"cannot create private key file %s: %v\", testBadKeyFile, err)\n}", "func TestCiphering(t *testing.T) {\n\tpb, _ := hex.DecodeString(\"fe38240982f313ae5afb3e904fb8215fb11af1200592b\" +\n\t\t\"fca26c96c4738e4bf8f\")\n\tprivkey, _ := PrivKeyFromBytes(S256(), pb)\n\n\tin := []byte(\"This is just a test.\")\n\tout, _ := hex.DecodeString(\"b0d66e5adaa5ed4e2f0ca68e17b8f2fc02ca002009e3\" +\n\t\t\"3487e7fa4ab505cf34d98f131be7bd258391588ca7804acb30251e71a04e0020ecf\" +\n\t\t\"df0f84608f8add82d7353af780fbb28868c713b7813eb4d4e61f7b75d7534dd9856\" +\n\t\t\"9b0ba77cf14348fcff80fee10e11981f1b4be372d93923e9178972f69937ec850ed\" +\n\t\t\"6c3f11ff572ddd5b2bedf9f9c0b327c54da02a28fcdce1f8369ffec\")\n\n\tdec, err := Decrypt(privkey, out)\n\tif err != nil {\n\t\tt.Fatal(\"failed to decrypt:\", err)\n\t}\n\n\tif !bytes.Equal(in, dec) {\n\t\tt.Error(\"decrypted data doesn't match original\")\n\t}\n}", "func TestAESCMAC2(t *testing.T) {\n\ttests := []struct {\n\t\tkey, plain, mac string\n\t}{\n\t\t// 0\n\t\t{\n\t\t\tkey: \"2b7e151628aed2a6abf7158809cf4f3c\",\n\t\t\tplain: \"\",\n\t\t\tmac: \"bb1d6929e95937287fa37d129b756746\",\n\t\t},\n\t\t{\n\t\t\tkey: \"2b7e151628aed2a6abf7158809cf4f3c\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172a\",\n\t\t\tmac: \"070a16b46b4d4144f79bdd9dd04a287c\",\n\t\t},\n\t\t{\n\t\t\tkey: \"2b7e151628aed2a6abf7158809cf4f3c\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411\",\n\t\t\tmac: \"dfa66747de9ae63030ca32611497c827\",\n\t\t},\n\t\t{\n\t\t\tkey: \"2b7e151628aed2a6abf7158809cf4f3c\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710\",\n\t\t\tmac: \"51f0bebf7e3b9d92fc49741779363cfe\",\n\t\t},\n\t\t{\n\t\t\tkey: \"8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b\",\n\t\t\tplain: \"\",\n\t\t\tmac: \"d17ddf46adaacde531cac483de7a9367\",\n\t\t},\n\t\t// 5\n\t\t{\n\t\t\tkey: \"8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172a\",\n\t\t\tmac: \"9e99a7bf31e710900662f65e617c5184\",\n\t\t},\n\t\t{\n\t\t\tkey: \"8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411\",\n\t\t\tmac: \"8a1de5be2eb31aad089a82e6ee908b0e\",\n\t\t},\n\t\t{\n\t\t\tkey: \"8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710\",\n\t\t\tmac: \"a1d5df0eed790f794d77589659f39a11\",\n\t\t},\n\t\t{\n\t\t\tkey: \"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4\",\n\t\t\tplain: \"\",\n\t\t\tmac: \"028962f61b7bf89efc6b551f4667d983\",\n\t\t},\n\t\t{\n\t\t\tkey: \"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172a\",\n\t\t\tmac: \"28a7023f452e8f82bd4bf28d8c37c35c\",\n\t\t},\n\t\t// 10\n\t\t{\n\t\t\tkey: \"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411\",\n\t\t\tmac: \"aaf3d8f1de5640c232f5b169b9c911e6\",\n\t\t},\n\t\t{\n\t\t\tkey: \"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4\",\n\t\t\tplain: \"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710\",\n\t\t\tmac: \"e1992190549f6ed5696a2c056c315410\",\n\t\t},\n\t}\n\n\tfor i, test := range tests {\n\t\trefKey, _ := hex.DecodeString(test.key)\n\t\tplain, _ := hex.DecodeString(test.plain)\n\t\trefMac, _ := hex.DecodeString(test.mac)\n\t\tcm, err := New(aes.NewCipher, refKey)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tcm.Reset()\n\t\tn, err := cm.Write(plain)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"unexpected error: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif len(plain) != n {\n\t\t\tt.Errorf(\"got len %d, expected %d for test %d\", n, len(plain), i)\n\t\t\tcontinue\n\t\t}\n\t\tif !Equal(cm.Sum(nil), refMac) {\n\t\t\tt.Errorf(\"mac mismatch for test %d\", i)\n\t\t}\n\t}\n}", "func TestCirclHpkeKemAlgorithmMismatchError(t *testing.T) {\n\tkem := hpke.KEM_P256_HKDF_SHA256\n\tkdf := hpke.KDF_HKDF_SHA256\n\taead := hpke.AEAD_AES128GCM\n\tsuite := hpke.NewSuite(kem, kdf, aead)\n\t_, sk, err := kem.Scheme().GenerateKeyPair()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tincorrectKEM := hpke.KEM_X25519_HKDF_SHA256\n\tincorrectSuite := hpke.NewSuite(incorrectKEM, kdf, aead)\n\tincorrectPK, _, err := incorrectKEM.Scheme().GenerateKeyPair()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Generate an encapsulated key share with the incorrect KEM algorithm.\n\tincorrectSender, err := incorrectSuite.NewSender(incorrectPK, []byte(\"some info string\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tincorrectEnc, _, err := incorrectSender.Setup(rand.Reader)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Attempt to parse an encapsulated key generated using the incorrect KEM\n\t// algorithm.\n\treceiver, err := suite.NewReceiver(sk, []byte(\"some info string\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\texpectedErrorString := \"hpke: invalid KEM public key\"\n\tif _, err := receiver.Setup(incorrectEnc); err == nil {\n\t\tt.Errorf(\"expected error; got success\")\n\t} else if err.Error() != expectedErrorString {\n\t\tt.Errorf(\"incorrect error string: got '%s'; want '%s'\", err, expectedErrorString)\n\t}\n}", "func TestBatchCTXValidTranCodeForServiceClassCode(t *testing.T) {\n\tmockBatch := mockBatchCTX(t)\n\tmockBatch.GetHeader().ServiceClassCode = DebitsOnly\n\terr := mockBatch.Create()\n\tif !base.Match(err, NewErrBatchServiceClassTranCode(DebitsOnly, 22)) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "func TestHandshakeCoreData(t *testing.T) {\n\n\t// node 1\n\tport := crypto.GetRandomUserPort()\n\taddress := fmt.Sprintf(\"0.0.0.0:%d\", port)\n\n\tnode1Local, err := NewNodeIdentity(address, nodeconfig.ConfigValues, false)\n\n\tif err != nil {\n\t\tt.Error(\"failed to create local node1\", err)\n\t}\n\n\t// this will be node 2 view of node 1\n\tnode1Remote, _ := NewRemoteNode(node1Local.String(), address)\n\n\t// node 2\n\tport1 := crypto.GetRandomUserPort()\n\taddress1 := fmt.Sprintf(\"0.0.0.0:%d\", port1)\n\n\tnode2Local, err := NewNodeIdentity(address1, nodeconfig.ConfigValues, false)\n\n\tif err != nil {\n\t\tt.Error(\"failed to create local node2\", err)\n\t}\n\n\t// this will be node1 view of node 2\n\tnode2Remote, _ := NewRemoteNode(node2Local.String(), address1)\n\n\t// STEP 1: Node1 generates handshake data and sends it to node2 ....\n\tdata, session, err := generateHandshakeRequestData(node1Local, node2Remote)\n\n\tassert.NoErr(t, err, \"expected no error\")\n\tassert.NotNil(t, session, \"expected session\")\n\tassert.NotNil(t, data, \"expected session\")\n\n\tlog.Info(\"Node 1 session data: Id:%s, AES-KEY:%s\", hex.EncodeToString(session.ID()), hex.EncodeToString(session.KeyE()))\n\n\tassert.False(t, session.IsAuthenticated(), \"Expected session to be not authenticated yet\")\n\n\t// STEP 2: Node2 gets handshake data from node 1 and processes it to establish a session with a shared AES key\n\n\tresp, session1, err := processHandshakeRequest(node2Local, node1Remote, data)\n\n\tassert.NoErr(t, err, \"expected no error\")\n\tassert.NotNil(t, session1, \"expected session\")\n\tassert.NotNil(t, resp, \"expected resp data\")\n\n\tlog.Info(\"Node 2 session data: Id:%s, AES-KEY:%s\", hex.EncodeToString(session1.ID()), hex.EncodeToString(session1.KeyE()))\n\n\tassert.Equal(t, string(session.ID()), string(session1.ID()), \"expected agreed Id\")\n\tassert.Equal(t, string(session.KeyE()), string(session1.KeyE()), \"expected same shared AES enc key\")\n\tassert.Equal(t, string(session.KeyM()), string(session1.KeyM()), \"expected same shared AES mac key\")\n\tassert.Equal(t, string(session.PubKey()), string(session1.PubKey()), \"expected same shared secret\")\n\n\tassert.True(t, session1.IsAuthenticated(), \"expected session1 to be authenticated\")\n\n\t// STEP 3: Node2 sends data1 back to node1.... Node 1 validates the data and sets its network session to authenticated\n\terr = processHandshakeResponse(node1Local, node2Remote, session, resp)\n\n\tassert.True(t, session.IsAuthenticated(), \"expected session to be authenticated\")\n\tassert.NoErr(t, err, \"failed to authenticate or process response\")\n\n\t// test session sym enc / dec\n\n\tconst msg = \"hello spacemesh - hello spacemesh - hello spacemesh :-)\"\n\tcipherText, err := session.Encrypt([]byte(msg))\n\tassert.NoErr(t, err, \"expected no error\")\n\n\tclearText, err := session1.Decrypt(cipherText)\n\tassert.NoErr(t, err, \"expected no error\")\n\tassert.True(t, bytes.Equal(clearText, []byte(msg)), \"Expected enc/dec to work\")\n\n\tnode1Local.Shutdown()\n\tnode2Local.Shutdown()\n}", "func TestCMPreIssuedCert(t *testing.T) {\n\tvar b64Chain = []string{\n\t\t\"MIID+jCCAuKgAwIBAgIHBWW7shJizTANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJHQjEPMA0GA1UEBwwGTG9uZG9uMTowOAYDVQQKDDFHb29nbGUgQ2VydGlmaWNhdGUgVHJhbnNwYXJlbmN5IChQcmVjZXJ0IFNpZ25pbmcpMRkwFwYDVQQFExAxNTE5MjMxNzA0MTczNDg3MB4XDTE4MDIyMTE2NDgyNFoXDTE4MTIwMTIwMzMyN1owYzELMAkGA1UEBhMCR0IxDzANBgNVBAcMBkxvbmRvbjEoMCYGA1UECgwfR29vZ2xlIENlcnRpZmljYXRlIFRyYW5zcGFyZW5jeTEZMBcGA1UEBRMQMTUxOTIzMTcwNDM5MjM5NzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKnKP9TP6hkEuD+d1rPeA8mxo5xFYffhCcEitP8PtTl7G2RqFrndPeAkzgvOxPB3Jrhx7LtMtg0IvS8y7Sy1qDqDou1/OrJgwCeWMc1/KSneuGP8GTX0Rqy4z8+LsiBN/tMDbt94RuiyCeltIAaHGmsNeYXV34ayD3vSIAQbtLUOD39KqrJWO0tQ//nshBuFlebiUrDP7rirPusYYW0stJKiCKeORhHvL3/I8mCYGNO0XIWMpASH2S9LGMwg+AQM13whC1KL65EGuVs4Ta0rO+Tl8Yi0is0RwdUmgdSGtl0evPTzyUXbA1n1BpkLcSQ5E3RxY3O6Ge9Whvtmg9vAJiMCAwEAAaOBoDCBnTATBgNVHSUEDDAKBggrBgEFBQcDATAjBgNVHREEHDAaghhmbG93ZXJzLXRvLXRoZS13b3JsZC5jb20wDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAWgBRKCM/Ajh0Fu6FFjJ9F4gVWK2oj/jAdBgNVHQ4EFgQUVjYl6wDey3DxvmTG2HL4vdiUt+MwEwYKKwYBBAHWeQIEAwEB/wQCBQAwDQYJKoZIhvcNAQELBQADggEBAAvyEFDIAWr0URsZzrJLZEL8p6FMTzVxY/MOvGP8QMXA6xNVElxYnDPF32JERAl+poR7syByhVFcEjrw7f2FTlMc04+hT/hsYzi8cMAmfX9KA36xUBVjyqvqwofxTwoWYdf+eGZW0EG8Yp1pM7iUy9bdlh3sgdOpmT9Z5XGCRwvdW1+mctv0JMKDdWzxBqYyNMnNjvjHBmkiuHeDDGFsV2zq+wV64RwJa2eVrnkMDMV1mscL6KzNRLPP2ZpNz/8H7SPock+fk4cZrdqj+0IzFt+6ixSoKyltyD+nkbWjRGY4iyboo/nPgTQ1IQCS2OPVHWw3NijFD8hqgAnYvz0Dn+k=\",\n\t\t\"MIIE4jCCAsqgAwIBAgIHBWW7sg8LrzANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEPMA0GA1UECAwGTG9uZG9uMRcwFQYDVQQKDA5Hb29nbGUgVUsgTHRkLjEhMB8GA1UECwwYQ2VydGlmaWNhdGUgVHJhbnNwYXJlbmN5MSMwIQYDVQQDDBpNZXJnZSBEZWxheSBJbnRlcm1lZGlhdGUgMTAeFw0xODAyMjExNjQ4MjRaFw0xODEyMDEyMDM0MjdaMHUxCzAJBgNVBAYTAkdCMQ8wDQYDVQQHDAZMb25kb24xOjA4BgNVBAoMMUdvb2dsZSBDZXJ0aWZpY2F0ZSBUcmFuc3BhcmVuY3kgKFByZWNlcnQgU2lnbmluZykxGTAXBgNVBAUTEDE1MTkyMzE3MDQxNzM0ODcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCKWlc3A43kJ9IzmkCPXcsGwTxlIvtl9sNYBWlx9qqHa1i6tU6rZuH9uXAb3wsn39fqY22HzF/yrx9pd05doFfRq6dvvm4eHNFfFm4cJur1kmPe8vLKpSI/P2DPx4/mRzrHnPAI8Jo9QgKcj91AyYeB689ZFzH30ay32beo6PxQvtoJkzl+dzf9Hs1ezavS7nDCuqDnu1V1Og7J5xTHZeNyTKgD5Kx28ukmIp2wGOvg3omuInABg/ew0VxnG/txKV+69zfV9dhclU3m16L81e3RkJ8Kg4RLb0mh9X3EMn90SpJ9yw0j8FF0Esk6wxuYeUGLShUji8BPnnbactY9B6ORAgMBAAGjbTBrMBgGA1UdJQEB/wQOMAwGCisGAQQB1nkCBAQwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTpPAThgC/ChBMtJnCe8v0az6r+xjAdBgNVHQ4EFgQUSgjPwI4dBbuhRYyfReIFVitqI/4wDQYJKoZIhvcNAQEFBQADggIBAEep2uWAFsdq1nLtLWLGh7DfVPc/K+1lcqNx64ucjpVZbDnMnYKFagf2Z9rHEWqR7kwuLac5xW8woSlLa/NHmJmdg18HGUhlS+x8iMPv7dK6hfNsRFdjLZkZOFneuf9j1b0dV+rXoRvyY+Oq+lomC98bEr+g9zq+M7wJ4wS/KeaNHpPw1pBeTtCdw+1c4ZgRTOEa2OUUpkpueJ+9psD/hbp6HLF+WYijWQ0/iYSxJ4TbjTC+omKRsGhvxSLbP8cSMt3X1pJgrFK1BvH4lqqEXGDNEiVNoPCHraEa8JtMZIo47/Af13lDfp6sBdZ0lvLAVDduWgg/2RkWCbHefAe81h+cYdDS775TF2TCMTwsR6GsM9sVCbfPvHXI/pUzamRn0i0CrhyccBBdPrUhj+cXuc9kqSkLegun9D8EBDMM9va5wb1HM0ruSno+YuLtfhCdBRHr/RG2BKJi7uUDjJ8goHov/EUJmHjAIARKz74IPWRkxMrnOvGhnNa2Hz+da3hpusz0Mj4rsqv1EKTC2wbCs6Rk2MRPSxdRbywdWLSmGn249SMfXK4An+dqoRk1fwKqdXc4swoUvxnGUi5ajBaRtc6631zBTmvmSFQnvGmS42aF7q2PjfvWPIuO+d//m8KgN6o2YyjrdPDDslI2RZUE5ngOR+JynvhjYrrB7Bat1EY7\",\n\t\t\"MIIFyDCCA7CgAwIBAgICEAEwDQYJKoZIhvcNAQEFBQAwfTELMAkGA1UEBhMCR0IxDzANBgNVBAgMBkxvbmRvbjEXMBUGA1UECgwOR29vZ2xlIFVLIEx0ZC4xITAfBgNVBAsMGENlcnRpZmljYXRlIFRyYW5zcGFyZW5jeTEhMB8GA1UEAwwYTWVyZ2UgRGVsYXkgTW9uaXRvciBSb290MB4XDTE0MDcxNzEyMjYzMFoXDTE5MDcxNjEyMjYzMFowfzELMAkGA1UEBhMCR0IxDzANBgNVBAgMBkxvbmRvbjEXMBUGA1UECgwOR29vZ2xlIFVLIEx0ZC4xITAfBgNVBAsMGENlcnRpZmljYXRlIFRyYW5zcGFyZW5jeTEjMCEGA1UEAwwaTWVyZ2UgRGVsYXkgSW50ZXJtZWRpYXRlIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDB6HT+/5ru8wO7+mNFOIH6r43BwiwJZB2vQwOB8zvBV79sTIqNV7Grx5KFnSDyGRUJxZfEN7FGc96lr0vqFDlt1DbcYgVV15U+Dt4B9/+0Tz/3zeZO0kVjTg3wqvzpw6xetj2N4dlpysiFQZVAOp+dHUw9zu3xNR7dlFdDvFSrdFsgT7Uln+Pt9pXCz5C4hsSP9oC3RP7CaRtDRSQrMcNvMRi3J8XeXCXsGqMKTCRhxRGe9ruQ2Bbm5ExbmVW/ou00Fr9uSlPJL6+sDR8Li/PTW+DU9hygXSj8Zi36WI+6PuA4BHDAEt7Z5Ru/Hnol76dFeExJ0F6vjc7gUnNh7JExJgBelyz0uGORT4NhWC7SRWP/ngPFLoqcoyZMVsGGtOxSt+aVzkKuF+x64CVxMeHb9I8t3iQubpHqMEmIE1oVSCsF/AkTVTKLOeWG6N06SjoUy5fu9o+faXKMKR8hldLM5z1K6QhFsb/F+uBAuU/DWaKVEZgbmWautW06fF5I+OyoFeW+hrPTbmon4OLE3ubjDxKnyTa4yYytWSisojjfw5z58sUkbLu7KAy2+Z60m/0deAiVOQcsFkxwgzcXRt7bxN7By5Q5Bzrz8uYPjFBfBnlhqMU5RU/FNBFY7Mx4Uy8+OcMYfJQ5/A/4julXEx1HjfBj3VCyrT/noHDpBeOGiwIDAQABo1AwTjAdBgNVHQ4EFgQU6TwE4YAvwoQTLSZwnvL9Gs+q/sYwHwYDVR0jBBgwFoAU8197dUnjeEE5aiC2fGtMXMk9WEEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAgEACFjL1UXy6S4JkGrDnz1VwTYHplFDY4bG6Q8Sh3Og6z9HJdivNft/iAQ2tIHyz0eAGCXeVPE/j1kgvz2RbnUxQd5eWdLeu/w/wiZyHxWhbTt6RhjqBVFjnx0st7n6rRt+Bw8jpugZfD11SbumVT/V20Gc45lHf2oEgbkPUcnTB9gssFz5Z4KKGs5lIHz4a20WeSJF3PJLTBefkRhHNufi/LhjpLXImwrC82g5ChBZS5XIVuJZx3VkMWiYz4emgX0YWF/JdtaB2dUQ7yrTforQ5J9b1JnJ7H/o9DsX3/ubfQ39gwDBxTicnqC+Q3Dcv3i9PvwjCNJQuGa7ygMcDEn/d6elQg2qHxtqRE02ZlOXTC0XnDAJhx7myJFA/Knv3yO9S4jG6665KG9Y88/CHkh08YLR7NYFiRmwOxjbe3lb6csl/FFmqUXvjhEzzWAxKjI09GSd9hZkB8u17Mg46eEYwF3ufIlqmYdlWufjSc2BZuaNNN6jtK6JKp8jhQUycehgtUK+NlBQOXTzu28miDdasoSH2mdR0PLDo1547+MLGdV4COvqLERTmQrYHrliicD5nFCA+CCSvGEjo0DGOmF/O8StwSmNiKJ4ppPvk2iGEdO07e0LbQI+2fbC6og2SDGXUlsbG85wqQw0A7CU1fQSqhFBuZZauDFMUvdy3v/BAIw=\",\n\t\t\"MIIFzTCCA7WgAwIBAgIJAJ7TzLHRLKJyMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAkdCMQ8wDQYDVQQIDAZMb25kb24xFzAVBgNVBAoMDkdvb2dsZSBVSyBMdGQuMSEwHwYDVQQLDBhDZXJ0aWZpY2F0ZSBUcmFuc3BhcmVuY3kxITAfBgNVBAMMGE1lcmdlIERlbGF5IE1vbml0b3IgUm9vdDAeFw0xNDA3MTcxMjA1NDNaFw00MTEyMDIxMjA1NDNaMH0xCzAJBgNVBAYTAkdCMQ8wDQYDVQQIDAZMb25kb24xFzAVBgNVBAoMDkdvb2dsZSBVSyBMdGQuMSEwHwYDVQQLDBhDZXJ0aWZpY2F0ZSBUcmFuc3BhcmVuY3kxITAfBgNVBAMMGE1lcmdlIERlbGF5IE1vbml0b3IgUm9vdDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKoWHPIgXtgaxWVIPNpCaj2y5Yj9t1ixe5PqjWhJXVNKAbpPbNHA/AoSivecBm3FTD9DfgW6J17mHb+cvbKSgYNzgTk5e2GJrnOP7yubYJpt2OCw0OILJD25NsApzcIiCvLA4aXkqkGgBq9FiVfisReNJxVu8MtxfhbVQCXZf0PpkW+yQPuF99V5Ri+grHbHYlaEN1C/HM3+t2yMR4hkd2RNXsMjViit9qCchIi/pQNt5xeQgVGmtYXyc92ftTMrmvduj7+pHq9DEYFt3ifFxE8v0GzCIE1xR/d7prFqKl/KRwAjYUcpU4vuazywcmRxODKuwWFVDrUBkGgCIVIjrMJWStH5i7WTSSTrVtOD/HWYvkXInZlSgcDvsNIG0pptJaEKSP4jUzI3nFymnoNZn6pnfdIII/XISpYSVeyl1IcdVMod8HdKoRew9CzW6f2n6KSKU5I8X5QEM1NUTmRLWmVi5c75/CvS/PzOMyMzXPf+fE2Dwbf4OcR5AZLTupqp8yCTqo7ny+cIBZ1TjcZjzKG4JTMaqDZ1Sg0T3mO/ZbbiBE3N8EHxoMWpw8OP50z1dtRRwj6qUZ2zLvngOb2EihlMO15BpVZC3Cg929c9Hdl65pUd4YrYnQBQB/rn6IvHo8zot8zElgOg22fHbViijUt3qnRggB40N30MXkYGwuJbAgMBAAGjUDBOMB0GA1UdDgQWBBTzX3t1SeN4QTlqILZ8a0xcyT1YQTAfBgNVHSMEGDAWgBTzX3t1SeN4QTlqILZ8a0xcyT1YQTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4ICAQB3HP6jRXmpdSDYwkI9aOzQeJH4x/HDi/PNMOqdNje/xdNzUy7HZWVYvvSVBkZ1DG/ghcUtn/wJ5m6/orBn3ncnyzgdKyXbWLnCGX/V61PgIPQpuGo7HzegenYaZqWz7NeXxGaVo3/y1HxUEmvmvSiioQM1cifGtz9/aJsJtIkn5umlImenKKEV1Ly7R3Uz3Cjz/Ffac1o+xU+8NpkLF/67fkazJCCMH6dCWgy6SL3AOB6oKFIVJhw8SD8vptHaDbpJSRBxifMtcop/85XUNDCvO4zkvlB1vPZ9ZmYZQdyL43NA+PkoKy0qrdaQZZMq1Jdp+Lx/yeX255/zkkILp43jFyd44rZ+TfGEQN1WHlp4RMjvoGwOX1uGlfoGkRSgBRj7TBn514VYMbXu687RS4WY2v+kny3PUFv/ZBfYSyjoNZnU4Dce9kstgv+gaKMQRPcyL+4vZU7DV8nBIfNFilCXKMN/VnNBKtDV52qmtOsVghgai+QE09w15x7dg+44gIfWFHxNhvHKys+s4BBN8fSxAMLOsb5NGFHE8x58RAkmIYWHjyPM6zB5AUPw1b2A0sDtQmCqoxJZfZUKrzyLz8gS2aVujRYN13KklHQ3EKfkeKBG2KXVBe5rjMN/7Anf1MtXxsTY6O8qIuHZ5QlXhSYzE41yIlPlG6d7AGnTiBIgeg==\",\n\t}\n\trawChain := make([][]byte, len(b64Chain))\n\tfor i, b64Data := range b64Chain {\n\t\tvar err error\n\t\trawChain[i], err = base64.StdEncoding.DecodeString(b64Data)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"failed to base64.Decode(chain[%d]): %v\", i, err)\n\t\t}\n\t}\n\n\troot, err := x509.ParseCertificate(rawChain[len(rawChain)-1])\n\tif err != nil {\n\t\tt.Fatalf(\"failed to parse root cert: %v\", err)\n\t}\n\tcmRoot := x509util.NewPEMCertPool()\n\tcmRoot.AddCert(root)\n\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\teku []x509.ExtKeyUsage\n\t}{\n\t\t{\n\t\t\tdesc: \"no EKU specified\",\n\t\t}, {\n\t\t\tdesc: \"EKU ServerAuth\",\n\t\t\teku: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\t},\n\t} {\n\t\tt.Run(tc.desc, func(t *testing.T) {\n\t\t\topts := CertValidationOpts{\n\t\t\t\ttrustedRoots: cmRoot,\n\t\t\t\textKeyUsages: tc.eku,\n\t\t\t}\n\t\t\tchain, err := ValidateChain(rawChain, opts)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"failed to ValidateChain: %v\", err)\n\t\t\t}\n\t\t\tfor i, c := range chain {\n\t\t\t\tt.Logf(\"chain[%d] = \\n%s\", i, x509util.CertificateToString(c))\n\t\t\t}\n\t\t})\n\t}\n}", "func TestVerifySignedMessage(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tdesc string\n\t\tsettings *crypt.PkiSettings\n\t\tsetup func(mdb *mocks.MockDepsBundle, setupDone *bool) error\n\t\tmessageToSign string\n\t\tbase64Signature string\n\t\tPEMPublicKey string\n\t\texpectedError *testtools.ErrorSpec\n\t\texpectedValidity bool\n\t}{\n\t\t{\n\t\t\tdesc: \"invalid base64 signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"@#$^&*()_\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"base64.CorruptInputError\",\n\t\t\t\tMessage: \"illegal base64 data at input byte 0\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"empty PEM key\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"No PEM data was found\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"bad key data\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN INVALID DATA-----\\n\" +\n\t\t\t\t\"MTIzNDU2Nzg5MGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6\\n\" +\n\t\t\t\t\"-----END INVALID DATA-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.StructuralError\",\n\t\t\t\tMessage: \"asn1: structure \" +\n\t\t\t\t\t\"error: tags don't match (16 vs {class:0 \" +\n\t\t\t\t\t\"tag:17 \" +\n\t\t\t\t\t\"length:50 \" +\n\t\t\t\t\t\"isCompound:true}) {optional:false \" +\n\t\t\t\t\t\"explicit:false \" +\n\t\t\t\t\t\"application:false \" +\n\t\t\t\t\t\"defaultValue:<nil> \" +\n\t\t\t\t\t\"tag:<nil> \" +\n\t\t\t\t\t\"stringType:0 \" +\n\t\t\t\t\t\"timeType:0 \" +\n\t\t\t\t\t\"set:false \" +\n\t\t\t\t\t\"omitEmpty:false} publicKeyInfo @2\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"invalid signature\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"abcdefgh\",\n\t\t\tPEMPublicKey: \"-----BEGIN ECDSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END ECDSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"asn1.SyntaxError\",\n\t\t\t\tMessage: \"asn1: syntax error: truncated tag or length\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"ecdsa key for rsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.RSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"N3SuIdWI7XlXDteTmcOZUd2OBacyUWY+/+A8SC4QUBz9rXnldBqXha6YyGwnTuizxuy6quQ2QDFdtW16dj7EQk3lozfngskyhc2r86q3AUbdFDvrQVphMQhzsgBhHVoMjCL/YRfvtzCTWhBxegjVMLraLDCBb8IZTIqcMYafYyeJTvAnjBuntlZ+14TDuTt14Uqz85T04CXxBEqlIXMMKpTc01ST4Jsxz5HLO+At1htXp5eHOUFtQSilm3G7iO8ynhgPcXHDWfMAWu6VySUoHWCG70pJaCq6ehF7223t0UFOCqAyDyyQyP9yeUHj8F75SPSxfJm8iKXGx2LND/qLYw==\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7WzVjtn9Gk+WHr5xbv8XMvooqU25\\n\" +\n\t\t\t\t\"BhgNjZ/vHZLBdVtCOjk4KxjS1UBfQm0c3TRxWBl3hj2AmnJbCrnGofMHBQ==\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *rsa.PublicKey, but encountered a *ecdsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t\t{\n\t\t\tdesc: \"rsa key for ecdsa mode\",\n\t\t\tsettings: &crypt.PkiSettings{\n\t\t\t\tAlgorithm: x509.ECDSA,\n\t\t\t\tPrivateKeyPath: \".prog/ecdsa_priv.key\",\n\t\t\t\tPublicKeyPath: \".prog/ecdsa.pub\",\n\t\t\t},\n\t\t\tsetup: func(mdb *mocks.MockDepsBundle, setupDone *bool) error {\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tmessageToSign: \"some other message\",\n\t\t\tbase64Signature: \"MEYCIQDPM0fc/PFauoZzpltH3RpWtlaqRnL0gFk5WFiLMrFqrwIhAIDvlBozU6Ky2UC9xOSq3YZ5iFuO356t9RnHOElaaXFJ\",\n\t\t\tPEMPublicKey: \"-----BEGIN RSA PUBLIC KEY-----\\n\" +\n\t\t\t\t\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzCTTFKQBHfTN8jW6q8PT\\n\" +\n\t\t\t\t\"HNZKWnRPxSt9kpgWmyqFaZnEUipgoKGAxSIsVrl2PJSm5OlgkVzx+MY+LWM64VKM\\n\" +\n\t\t\t\t\"bRpUUGJR3zdMNhwZQX0hjOpLpVJvUwD78utVs8vijrU7sH48usFiaZQYjy4m4hQh\\n\" +\n\t\t\t\t\"63/x4h3KVz7YqUnlRMzYJFT43+AwYzYuEpzWRxtW7IObJPtjtmYVoqva98fF6aj5\\n\" +\n\t\t\t\t\"uHAsvaAgZGBalHXmCiPzKiGU/halzXSPvyJ2Cqz2aUqMHgwi/2Ip4z/mrfX+mUTa\\n\" +\n\t\t\t\t\"S+LyBy7GgqJ5vbkGArMagJIc0eARF60r6Uf483xh17oniABdLJy4qlLf6PcEU+ut\\n\" +\n\t\t\t\t\"EwIDAQAB\\n\" +\n\t\t\t\t\"-----END RSA PUBLIC KEY-----\\n\",\n\t\t\texpectedError: &testtools.ErrorSpec{\n\t\t\t\tType: \"*errors.errorString\",\n\t\t\t\tMessage: \"Expecting a *ecdsa.PublicKey, but encountered a *rsa.PublicKey instead\",\n\t\t\t},\n\t\t\texpectedValidity: false,\n\t\t},\n\t} {\n\t\tt.Run(fmt.Sprintf(\"Subtest: %s\", tc.desc), func(tt *testing.T) {\n\t\t\tmockDepsBundle := mocks.NewDefaultMockDeps(\"\", []string{\"progname\"}, \"/home/user\", nil)\n\t\t\treturnedNormally := false\n\t\t\tvar tooling *crypt.CryptoTooling\n\t\t\tvar actualErr error\n\t\t\tvar actualValidity bool\n\t\t\terr := mockDepsBundle.InvokeCallInMockedEnv(func() error {\n\t\t\t\tsetupComplete := false\n\t\t\t\tinnerErr := tc.setup(mockDepsBundle, &setupComplete)\n\t\t\t\tif innerErr != nil {\n\t\t\t\t\treturn innerErr\n\t\t\t\t}\n\t\t\t\tvar toolingErr error\n\t\t\t\ttooling, toolingErr = crypt.GetCryptoTooling(mockDepsBundle.Deps, tc.settings)\n\t\t\t\tif toolingErr != nil {\n\t\t\t\t\treturn toolingErr\n\t\t\t\t}\n\t\t\t\tsetupComplete = true\n\t\t\t\tactualValidity, actualErr = tooling.VerifySignedMessage(tc.messageToSign, tc.base64Signature, tc.PEMPublicKey)\n\t\t\t\treturnedNormally = true\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\ttt.Errorf(\"Unexpected error calling mockDepsBundle.InvokeCallInMockedEnv(): %s\", err.Error())\n\t\t\t}\n\t\t\tif exitStatus := mockDepsBundle.GetExitStatus(); (exitStatus != 0) || !returnedNormally {\n\t\t\t\ttt.Error(\"EncodeAndSaveKey() should not have paniced or called os.Exit.\")\n\t\t\t}\n\t\t\tif (mockDepsBundle.OutBuf.String() != \"\") || (mockDepsBundle.ErrBuf.String() != \"\") {\n\t\t\t\ttt.Errorf(\"EncodeAndSaveKey() should not have output any data. Saw stdout:\\n%s\\nstderr:\\n%s\", mockDepsBundle.OutBuf.String(), mockDepsBundle.ErrBuf.String())\n\t\t\t}\n\t\t\tif err := tc.expectedError.EnsureMatches(actualErr); err != nil {\n\t\t\t\ttt.Error(err.Error())\n\t\t\t}\n\t\t\tif tc.expectedError == nil {\n\t\t\t\tif actualValidity != tc.expectedValidity {\n\t\t\t\t\ttt.Errorf(\"Signature is %#v when %#v expected\", actualValidity, tc.expectedValidity)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif tc.expectedValidity {\n\t\t\t\t\ttt.Error(\"TEST CASE INVALID. Should not expect \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t\tif actualValidity {\n\t\t\t\t\ttt.Error(\"Error was expected. Should not report \\\"valid\\\".\")\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\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 TestAccountSupported(t *testing.T) {\n\t// From mnemonic: wisdom minute home employ west tail liquid mad deal catalog narrow mistake\n\trootKey := mustXKey(\"xprv9s21ZrQH143K3gie3VFLgx8JcmqZNsBcBc6vAdJrsf4bPRhx69U8qZe3EYAyvRWyQdEfz7ZpyYtL8jW2d2Lfkfh6g2zivq8JdZPQqxoxLwB\")\n\tkeystoreHelper := software.NewKeystore(rootKey)\n\n\tfingerprint := []byte{0x55, 0x055, 0x55, 0x55}\n\tbb02Multi := &keystoremock.KeystoreMock{\n\t\tRootFingerprintFunc: func() ([]byte, error) {\n\t\t\treturn fingerprint, nil\n\t\t},\n\t\tSupportsAccountFunc: func(coin coinpkg.Coin, meta interface{}) bool {\n\t\t\tswitch coin.(type) {\n\t\t\tcase *btc.Coin:\n\t\t\t\tscriptType := meta.(signing.ScriptType)\n\t\t\t\treturn scriptType != signing.ScriptTypeP2PKH\n\t\t\tdefault:\n\t\t\t\treturn true\n\t\t\t}\n\t\t},\n\t\tSupportsUnifiedAccountsFunc: func() bool {\n\t\t\treturn true\n\t\t},\n\t\tSupportsMultipleAccountsFunc: func() bool {\n\t\t\treturn true\n\t\t},\n\t\tExtendedPublicKeyFunc: keystoreHelper.ExtendedPublicKey,\n\t}\n\tbb02BtcOnly := &keystoremock.KeystoreMock{\n\t\tRootFingerprintFunc: func() ([]byte, error) {\n\t\t\treturn fingerprint, nil\n\t\t},\n\t\tSupportsAccountFunc: func(coin coinpkg.Coin, meta interface{}) bool {\n\t\t\tswitch coin.(type) {\n\t\t\tcase *btc.Coin:\n\t\t\t\tscriptType := meta.(signing.ScriptType)\n\t\t\t\treturn coin.Code() == coinpkg.CodeBTC && scriptType != signing.ScriptTypeP2PKH\n\t\t\tdefault:\n\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\t\tSupportsUnifiedAccountsFunc: func() bool {\n\t\t\treturn true\n\t\t},\n\t\tSupportsMultipleAccountsFunc: func() bool {\n\t\t\treturn true\n\t\t},\n\t\tExtendedPublicKeyFunc: keystoreHelper.ExtendedPublicKey,\n\t}\n\n\tb := newBackend(t, testnetDisabled, regtestDisabled)\n\tdefer b.Close()\n\n\t// Registering a new keystore persists a set of initial default accounts.\n\tb.registerKeystore(bb02Multi)\n\trequire.Len(t, b.Accounts(), 3)\n\trequire.Len(t, b.Config().AccountsConfig().Accounts, 3)\n\n\tb.DeregisterKeystore()\n\t// Registering a Bitcoin-only like keystore loads only the Bitcoin account, even though altcoins\n\t// were persisted previously.\n\tb.registerKeystore(bb02BtcOnly)\n\trequire.Len(t, b.Accounts(), 1)\n\trequire.Len(t, b.Config().AccountsConfig().Accounts, 3)\n}", "func TestCMAC(t *testing.T) {\n\tkey := \"2b7e151628aed2a6abf7158809cf4f3c\"\n\tk1 := \"fbeed618357133667c85e08f7236a8de\"\n\tk2 := \"f7ddac306ae266ccf90bc11ee46d513b\"\n\n\tkeyBytes, _ := hex.DecodeString(key)\n\tk1Bytes, _ := hex.DecodeString(k1)\n\tk2Bytes, _ := hex.DecodeString(k2)\n\n\t_, err := New(aes.NewCipher, nil)\n\tif err == nil {\n\t\tt.Fatal(\"unexpeced nil error\")\n\t}\n\n\tcm, err := New(aes.NewCipher, keyBytes)\n\tif err != nil {\n\t\tt.Fatal(\"unexpected error: \", err)\n\t}\n\ttmp := cm.(*cmac)\n\tif !bytes.Equal(tmp.k1, k1Bytes) {\n\t\tt.Errorf(\"k1 mismatch, got \\n %+v\\nexpected\\n %+v\", tmp.k1, k1)\n\t}\n\tif !bytes.Equal(tmp.k2, k2Bytes) {\n\t\tt.Errorf(\"k2 mismatch, got \\n %+v\\nexpected\\n %+v\", tmp.k2, k2)\n\t}\n\n\tif !Equal(keyBytes, keyBytes) {\n\t\tt.Errorf(\"got equal false, expected true\")\n\t}\n\tif Equal(keyBytes, k1Bytes) {\n\t\tt.Errorf(\"got equal true, expected false\")\n\t}\n\tif Equal(keyBytes, k1Bytes[:5]) {\n\t\tt.Errorf(\"got equal true, expected false\")\n\t}\n\n\tif cm.Size() != len(keyBytes) {\n\t\tt.Fatalf(\"expected Size %d, got %d\", len(keyBytes), cm.Size())\n\t}\n\n\tif cm.Size() != cm.BlockSize() {\n\t\tt.Fatalf(\"expected same Size and BlockSize\")\n\t}\n\n\ttests := []struct {\n\t\tmsg, mac string\n\t}{\n\t\t{\n\t\t\tmsg: \"\",\n\t\t\tmac: \"bb1d6929e95937287fa37d129b756746\",\n\t\t},\n\t\t{\n\t\t\tmsg: \"6bc1bee22e409f96e93d7e117393172a\",\n\t\t\tmac: \"070a16b46b4d4144f79bdd9dd04a287c\",\n\t\t},\n\t\t{\n\t\t\tmsg: \"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411\",\n\t\t\tmac: \"dfa66747de9ae63030ca32611497c827\",\n\t\t},\n\t\t{\n\t\t\tmsg: \"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710\",\n\t\t\tmac: \"51f0bebf7e3b9d92fc49741779363cfe\",\n\t\t},\n\t}\n\tfor i, test := range tests {\n\t\tcm.Reset()\n\t\tmsgBytes, _ := hex.DecodeString(test.msg)\n\t\tn, err := cm.Write(msgBytes)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%2d: unexpected error: %s\", i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif len(msgBytes) != n {\n\t\t\tt.Errorf(\"%2d: expect len %d, got %d\", i, len(msgBytes), n)\n\t\t\tcontinue\n\t\t}\n\t\tmacBytes, _ := hex.DecodeString(test.mac)\n\t\tif !Equal(cm.Sum(nil), macBytes) {\n\t\t\tt.Errorf(\"%2d: mac mismatch\", i)\n\t\t}\n\t}\n}", "func testBatchCTXStandardEntryClassCode(t testing.TB) {\n\tmockBatch := mockBatchCTX(t)\n\tmockBatch.Header.StandardEntryClassCode = WEB\n\terr := mockBatch.Create()\n\tif !base.Match(err, ErrBatchSECType) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "func (t Ticker) IsCrypto() bool {\r\n\treturn strings.Compare(t.Exchange, \"CURRENCY\") == 0\r\n}", "func TestCheck(t *testing.T) {\n\t// Valid OCSP Must Staple Extension.\n\tvalidExtension := pkix.Extension{\n\t\tId: extensionOid,\n\t\tValue: expectedExtensionValue,\n\t\tCritical: false,\n\t}\n\t// Invalid OCSP Must Staple Extension: Critical field set to `true`.\n\tcriticalExtension := pkix.Extension{\n\t\tId: extensionOid,\n\t\tValue: expectedExtensionValue,\n\t\tCritical: true,\n\t}\n\t// Invalid OCSP Must Staple Extension: Wrong value.\n\twrongValueExtension := pkix.Extension{\n\t\tId: extensionOid,\n\t\tValue: []uint8{0xC0, 0xFF, 0xEE},\n\t\tCritical: false,\n\t}\n\t// Invalid OCSP Must Staple Extension: Wrong value, Critical field set to\n\t// `true`\n\twrongValueExtensionCritical := pkix.Extension{\n\t\tId: extensionOid,\n\t\tValue: []uint8{0xC0, 0xFF, 0xEE},\n\t\tCritical: true,\n\t}\n\n\ttestCases := []struct {\n\t\tName string\n\t\tInputEx pkix.Extension\n\t\tCertType string\n\t\tExpectedErrors []string\n\t}{\n\t\t{\n\t\t\tName: \"Valid: DV cert type\",\n\t\t\tInputEx: validExtension,\n\t\t\tCertType: \"DV\",\n\t\t\tExpectedErrors: []string{},\n\t\t},\n\t\t{\n\t\t\tName: \"Valid: OV cert type\",\n\t\t\tInputEx: validExtension,\n\t\t\tCertType: \"DV\",\n\t\t\tExpectedErrors: []string{},\n\t\t},\n\t\t{\n\t\t\tName: \"Valid: EV cert type\",\n\t\t\tInputEx: validExtension,\n\t\t\tCertType: \"DV\",\n\t\t\tExpectedErrors: []string{},\n\t\t},\n\t\t{\n\t\t\tName: \"Valid: CA cert type\",\n\t\t\tInputEx: validExtension,\n\t\t\tCertType: \"CA\",\n\t\t\tExpectedErrors: []string{},\n\t\t},\n\t\t{\n\t\t\tName: \"Invalid: OCSP cert type\",\n\t\t\tInputEx: validExtension,\n\t\t\tCertType: \"OCSP\",\n\t\t\tExpectedErrors: []string{\n\t\t\t\tcertTypeErr,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"Invalid: critical extension\",\n\t\t\tInputEx: criticalExtension,\n\t\t\tCertType: \"DV\",\n\t\t\tExpectedErrors: []string{critExtErr},\n\t\t},\n\t\t{\n\t\t\tName: \"Invalid: critical extension, OCSP cert type\",\n\t\t\tInputEx: criticalExtension,\n\t\t\tCertType: \"OCSP\",\n\t\t\tExpectedErrors: []string{\n\t\t\t\tcertTypeErr, critExtErr,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"Invalid: wrong extension value\",\n\t\t\tInputEx: wrongValueExtension,\n\t\t\tCertType: \"DV\",\n\t\t\tExpectedErrors: []string{\n\t\t\t\textValueErr,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"Invalid: wrong extension value, critical extension, OCSP cert type\",\n\t\t\tInputEx: wrongValueExtensionCritical,\n\t\t\tCertType: \"OCSP\",\n\t\t\tExpectedErrors: []string{\n\t\t\t\tcertTypeErr, critExtErr, extValueErr,\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tc := range testCases {\n\t\tt.Run(tc.Name, func(t *testing.T) {\n\t\t\tcertData := &certdata.Data{\n\t\t\t\tType: tc.CertType,\n\t\t\t}\n\t\t\t// Run the OCSP Must Staple check on the test data\n\t\t\terrors := Check(tc.InputEx, certData)\n\t\t\t// Collect the returned errors into a list\n\t\t\terrList := errors.List()\n\t\t\t// Verify the expected number of errors are in the list\n\t\t\tif len(tc.ExpectedErrors) != len(errList) {\n\t\t\t\tt.Errorf(\"wrong number of Check errors: expected %d, got %d\\n\",\n\t\t\t\t\tlen(tc.ExpectedErrors), len(errList))\n\t\t\t} else {\n\t\t\t\t// Match the error list to the expected error list\n\t\t\t\tfor i, err := range errList {\n\t\t\t\t\tif errMsg := err.Error(); errMsg != tc.ExpectedErrors[i] {\n\t\t\t\t\t\tt.Errorf(\"expected error %q at index %d, got %q\",\n\t\t\t\t\t\t\ttc.ExpectedErrors[i], i, errMsg)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func TestCryptoSignerInterfaceBehavior(t *testing.T) {\n\tcs := NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.EmptyCryptoServiceInterfaceBehaviorTests(t, cs)\n\tinterfaces.CreateGetKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.CreateListKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.AddGetKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n\n\tcs = NewCryptoService(trustmanager.NewKeyMemoryStore(passphraseRetriever))\n\tinterfaces.AddListKeyCryptoServiceInterfaceBehaviorTests(t, cs, data.ECDSAKey)\n}", "func weakCipherSuites(details scan.LabsEndpointDetails) string {\n\t//Will require update as more vulnerabilities discovered, display results for TLS v1.2\n\t//https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Best-Practices#23-use-secure-cipher-suites\n\tvar vulnSuites string\n\tfor _, suite := range details.Suites {\n\t\tfor _, suiteList := range suite.List {\n\t\t\tif !strings.Contains(suiteList.Name, \"DHE_\") {\n\t\t\t\tif suite.Protocol == 771 {\n\t\t\t\t\tvulnSuites += suiteList.Name + \"\\n\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn (vulnSuites)\n}", "func TestLicensingLogic(privKey, pubKey string) error {\n\tfmt.Println(\"*** TestLicensingLogic ***\")\n\n\texpDate := time.Date(2017, 7, 16, 0, 0, 0, 0, time.UTC)\n\tlicInfo := LicenseInfo{Name: \"Chathura Colombage\", Expiration: expDate}\n\n\tjsonLicInfo, err := json.Marshal(licInfo)\n\tif err != nil {\n\t\tfmt.Println(\"Error marshalling json data:\", err)\n\t\treturn err\n\t}\n\n\trsaPrivKey, err := ReadPrivateKeyFromFile(privKey)\n\tif err != nil {\n\t\tfmt.Println(\"Error reading private key:\", err)\n\t\treturn err\n\t}\n\n\tsignedData, err := Sign(rsaPrivKey, jsonLicInfo)\n\tif err != nil {\n\t\tfmt.Println(\"Error signing data:\", err)\n\t\treturn err\n\t}\n\n\tsignedDataBase64 := encodeKey(signedData)\n\tfmt.Println(\"Signed data:\", signedDataBase64)\n\n\t// rsaPrivKey.Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts)\n\n\t// we need to sign jsonLicInfo using private key\n\n\tlicData := LicenseData{Info: licInfo, Key: signedDataBase64}\n\n\tjsonLicData, err := json.MarshalIndent(licData, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Println(\"Error marshalling json data:\", err)\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"License: \\n%s\\n\", jsonLicData)\n\n\tbackFromBase64, err := decodeKey(signedDataBase64)\n\tif err != nil {\n\t\tfmt.Println(\"Error decoding base64\")\n\t\treturn err\n\t}\n\n\t// Now we need to check whether we can verify this data or not\n\tpublicKey, err := ReadPublicKeyFromFile(pubKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := Unsign(publicKey, backFromBase64, signedData); err != nil {\n\t\tfmt.Println(\"Couldn't Sign!\")\n\t}\n\n\treturn nil\n}", "func RunChallenge11() {\n\tutil.PrintChallengeHeader(2, 11)\n\n\tplaintext := \"DUPLICATEBLOCKS!DUPLICATEBLOCKS!DUPLICATEBLOCKS!\"\n\tfor i := 0; i < 10; i++ {\n\t\tciphertext, _ := aes.EncryptRandom([]byte(plaintext))\n\t\tfmt.Println(hex.EncodeToString(ciphertext))\n\t\taesMode := aes.DetectAesMode(ciphertext, 16)\n\t\tswitch aesMode {\n\t\tcase aes.ECB:\n\t\t\tprintln(\"Probably AES ECB\")\n\t\tcase aes.CBC:\n\t\t\tprintln(\"Probably AES CBC\")\n\t\t}\n\t}\n}", "func TestDelegation(t *testing.T) {\n\tcsp, cleanup := newProvider(t, defaultOptions())\n\tdefer cleanup()\n\n\tk, err := csp.KeyGen(&bccsp.AES256KeyGenOpts{})\n\trequire.NoError(t, err)\n\n\tt.Run(\"KeyGen\", func(t *testing.T) {\n\t\tk, err := csp.KeyGen(&bccsp.AES256KeyGenOpts{})\n\t\trequire.NoError(t, err)\n\t\trequire.True(t, k.Private())\n\t\trequire.True(t, k.Symmetric())\n\t})\n\n\tt.Run(\"KeyDeriv\", func(t *testing.T) {\n\t\tk, err := csp.KeyDeriv(k, &bccsp.HMACDeriveKeyOpts{Arg: []byte{1}})\n\t\trequire.NoError(t, err)\n\t\trequire.True(t, k.Private())\n\t})\n\n\tt.Run(\"KeyImport\", func(t *testing.T) {\n\t\traw := make([]byte, 32)\n\t\t_, err := rand.Read(raw)\n\t\trequire.NoError(t, err)\n\n\t\tk, err := csp.KeyImport(raw, &bccsp.AES256ImportKeyOpts{})\n\t\trequire.NoError(t, err)\n\t\trequire.True(t, k.Private())\n\t})\n\n\tt.Run(\"GetKey\", func(t *testing.T) {\n\t\tk, err := csp.GetKey(k.SKI())\n\t\trequire.NoError(t, err)\n\t\trequire.True(t, k.Private())\n\t})\n\n\tt.Run(\"Hash\", func(t *testing.T) {\n\t\tdigest, err := csp.Hash([]byte(\"message\"), &bccsp.SHA3_384Opts{})\n\t\trequire.NoError(t, err)\n\t\trequire.NotEmpty(t, digest)\n\t})\n\n\tt.Run(\"GetHash\", func(t *testing.T) {\n\t\th, err := csp.GetHash(&bccsp.SHA256Opts{})\n\t\trequire.NoError(t, err)\n\t\trequire.Equal(t, sha256.New(), h)\n\t})\n\n\tt.Run(\"Sign\", func(t *testing.T) {\n\t\t_, err := csp.Sign(k, []byte(\"message\"), nil)\n\t\trequire.EqualError(t, err, \"Unsupported 'SignKey' provided [*sw.aesPrivateKey]\")\n\t})\n\n\tt.Run(\"Verify\", func(t *testing.T) {\n\t\t_, err := csp.Verify(k, []byte(\"signature\"), []byte(\"digest\"), nil)\n\t\trequire.Error(t, err)\n\t\trequire.Contains(t, err.Error(), \"Unsupported 'VerifyKey' provided\")\n\t})\n\n\tt.Run(\"EncryptDecrypt\", func(t *testing.T) {\n\t\tmsg := []byte(\"message\")\n\t\tct, err := csp.Encrypt(k, msg, &bccsp.AESCBCPKCS7ModeOpts{})\n\t\trequire.NoError(t, err)\n\n\t\tpt, err := csp.Decrypt(k, ct, &bccsp.AESCBCPKCS7ModeOpts{})\n\t\trequire.NoError(t, err)\n\t\trequire.Equal(t, msg, pt)\n\t})\n}", "func TestCommitMultipleKeys4A(t *testing.T) {\n}", "func (v2 *UniswapTestSuite) SetupSuite() {\n\tfmt.Println(\"Setting up the suite...\")\n\tvar err error\n\tv2.WETH = common.HexToAddress(\"0xd0a1e359811322d97991e03f863a0c30c2cf029c\")\n\tv2.EtherAddress = common.HexToAddress(\"0x0000000000000000000000000000000000000000\")\n\tv2.ETHUniswapRouterAddress = common.HexToAddress(\"0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\")\n\tv2.DAIAddress = common.HexToAddress(\"0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa\")\n\tv2.MRKAddressStr = common.HexToAddress(\"0xef13c0c8abcaf5767160018d268f9697ae4f5375\")\n\tv2.EthPrivateKey = \"B8DB29A7A43FB88AD520F762C5FDF6F1B0155637FA1E5CB2C796AFE9E5C04E31\"\n\tv2.VaultAddress = common.HexToAddress(\"0xF92c6bb5206BEFD3c8305ddd64d554322cC22aFc\")\n\tv2.EthHost = \"https://kovan.infura.io/v3/93fe721349134964aa71071a713c5cef\"\n\tv2.UniswapProxy = common.HexToAddress(\"0xc7724A86ced6D95573d36fc4B98f9C0414B907a1\")\n\tv2.IncAddr = common.HexToAddress(\"0xf295681641c170359E04Bbe2EA3985BaA4CF0baf\")\n\tv2.connectToETH()\n\tv2.c = getFixedCommittee()\n\tv2.auth = bind.NewKeyedTransactor(v2.ETHPrivKey)\n\tv2.v, err = vault.NewVault(v2.VaultAddress, v2.ETHClient)\n\trequire.Equal(v2.T(), nil, err)\n\n\t// uncomment to deploy new one on kovan\n\t// incAddr, tx, _, err := incognito_proxy.DeployIncognitoProxy(v2.auth, v2.ETHClient, v2.auth.From, v2.c.beacons, v2.c.bridges)\n\t// require.Equal(v2.T(), nil, err)\n\t// // Wait until tx is confirmed\n\t// err = wait(v2.ETHClient, tx.Hash())\n\t// require.Equal(v2.T(), nil, err)\n\t// v2.IncAddr = incAddr\n\t// fmt.Printf(\"Proxy address: %s\\n\", v2.IncAddr.Hex())\n\n\t// delegatorAddr, tx, _, err := vault.DeployVault(v2.auth, v2.ETHClient)\n\t// require.Equal(v2.T(), nil, err)\n\t// err = wait(v2.ETHClient, tx.Hash())\n\t// require.Equal(v2.T(), nil, err)\n\t// fmt.Printf(\"delegatorAddr address: %s\\n\", delegatorAddr.Hex())\n\n\t// vaultAbi, _ := abi.JSON(strings.NewReader(vault.VaultABI))\n\t// input, _ := vaultAbi.Pack(\"initialize\", common.Address{})\t\n\n\t// v2.VaultAddress, tx, _, err = vaultproxy.DeployVaultproxy(v2.auth, v2.ETHClient, delegatorAddr, common.HexToAddress(\"0x0000000000000000000000000000000000000001\"), v2.IncAddr, input)\n\t// require.Equal(v2.T(), nil, err)\n\t// err = wait(v2.ETHClient, tx.Hash())\n\t// require.Equal(v2.T(), nil, err)\n\t// fmt.Printf(\"vault proxy address: %s\\n\", v2.VaultAddress.Hex())\n\n\t// v2.UniswapProxy, tx, _, err = uniswap.DeployUniswapV2Trade(v2.auth, v2.ETHClient, v2.ETHUniswapRouterAddress)\n\t// require.Equal(v2.T(), nil, err)\n\t// err = wait(v2.ETHClient, tx.Hash())\n\t// require.Equal(v2.T(), nil, err)\n\t// fmt.Printf(\"Uniswap proxy address: %s\\n\", v2.UniswapProxy.Hex())\n}", "func TestAesEnDecrytion(t *testing.T) {\n\t//需要16的倍数\n\tpriKey := randStr(32)\n\toriStr := randStr(32)\n\tfmt.Println(\"original: \", oriStr)\n\tencrypted, err := AesEncrypt([]byte(oriStr), []byte(priKey))\n\tif err != nil {\n\t\tt.Errorf(\"encrypt err: %s\\n\", err.Error())\n\t}\n\tfmt.Println(\"encryptd: \", encrypted)\n\n\toriginal, err := AesDecrypt(encrypted, []byte(priKey))\n\tif err != nil {\n\t\tt.Errorf(\"decrypt err: %s\\n\", err.Error())\n\t}\n\tfmt.Println(\"decryptd: \", original)\n\tif original != oriStr {\n\t\tt.Errorf(\"Decryption Error, old: %s, new: %s\", oriStr, original)\n\t}\n}", "func (mr *MockInternalServerMockRecorder) CryptoApiInvoke(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CryptoApiInvoke\", reflect.TypeOf((*MockInternalServer)(nil).CryptoApiInvoke), arg0, arg1)\n}", "func TestCreateValidBCCSPOptsForNewFabricClient(t *testing.T) {\n\tmockCtrl := gomock.NewController(t)\n\tdefer mockCtrl.Finish()\n\tmockConfig := mock_apiconfig.NewMockConfig(mockCtrl)\n\tclientMockObject := &config.ClientConfig{Organization: \"org1\", Logging: config.LoggingType{Level: \"info\"}, CryptoConfig: config.CCType{Path: \"test/path\"}}\n\n\tmockConfig.EXPECT().CAConfig(org1).Return(&config.CAConfig{}, nil)\n\tmockConfig.EXPECT().CAServerCertPaths(org1).Return([]string{\"test\"}, nil)\n\tmockConfig.EXPECT().CAClientCertPath(org1).Return(\"\", nil)\n\tmockConfig.EXPECT().CAClientKeyPath(org1).Return(\"\", nil)\n\tmockConfig.EXPECT().CAKeyStorePath().Return(os.TempDir())\n\tmockConfig.EXPECT().Client().Return(clientMockObject, nil)\n\tmockConfig.EXPECT().SecurityProvider().Return(\"SW\")\n\tmockConfig.EXPECT().SecurityAlgorithm().Return(\"SHA2\")\n\tmockConfig.EXPECT().SecurityLevel().Return(256)\n\tmockConfig.EXPECT().KeyStorePath().Return(\"/tmp/msp\")\n\tmockConfig.EXPECT().Ephemeral().Return(false)\n\n\tnewCryptosuiteProvider, err := cryptosuiteimpl.GetSuiteByConfig(mockConfig)\n\n\tif err != nil {\n\t\tt.Fatalf(\"Expected fabric client ryptosuite to be created with SW BCCS provider, but got %v\", err.Error())\n\t}\n\n\t_, err = NewFabricCAClient(org1, mockConfig, newCryptosuiteProvider)\n\tif err != nil {\n\t\tt.Fatalf(\"Expected fabric client to be created with SW BCCS provider, but got %v\", err.Error())\n\t}\n}", "func AssertCertificateHasServerAuthUsage(t *testing.T, cert *x509.Certificate) {\n\tfor i := range cert.ExtKeyUsage {\n\t\tif cert.ExtKeyUsage[i] == x509.ExtKeyUsageServerAuth {\n\t\t\treturn\n\t\t}\n\t}\n\tt.Error(\"cert is not a ServerAuth\")\n}", "func TestEnvelope(t *testing.T) {\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\trequire.NoError(t, err)\n\tpublicKey := &privateKey.PublicKey\n\n\t// Create a new Envelope with a payload\n\tpayload := &protocol.Payload{\n\t\tIdentity: &anypb.Any{},\n\t}\n\tidentity := &ivms101.LegalPerson{\n\t\tName: &ivms101.LegalPersonName{\n\t\t\tNameIdentifiers: []*ivms101.LegalPersonNameId{\n\t\t\t\t{\n\t\t\t\t\tLegalPersonName: \"John Doe\",\n\t\t\t\t\tLegalPersonNameIdentifierType: ivms101.LegalPersonLegal,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tanypb.MarshalFrom(payload.Identity, identity, proto.MarshalOptions{})\n\tenvelope := handler.New(\"\", payload, nil)\n\trequire.NotNil(t, envelope)\n\trequire.NotEmpty(t, envelope.ID)\n\trequire.NotNil(t, envelope.Payload)\n\trequire.NotNil(t, envelope.Cipher)\n\n\t// Fail to seal the envelope with an unsupported key type\n\t_, err = envelope.Seal(nil)\n\trequire.Error(t, err)\n\t_, err = envelope.Seal(privateKey)\n\trequire.Error(t, err)\n\n\t// Seal the envelope with an RSA key\n\tsecure, err := envelope.Seal(publicKey)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, secure)\n\trequire.Equal(t, envelope.ID, secure.Id)\n\trequire.Equal(t, envelope.Cipher.EncryptionAlgorithm(), secure.EncryptionAlgorithm)\n\trequire.Equal(t, envelope.Cipher.SignatureAlgorithm(), secure.HmacAlgorithm)\n\trequire.NotEmpty(t, secure.Payload)\n\trequire.NotEmpty(t, secure.Hmac)\n\trequire.NotEmpty(t, secure.EncryptionKey)\n\trequire.NotEmpty(t, secure.HmacSecret)\n\n\t// Fail to open a nil envelope\n\t_, err = handler.Open(nil, privateKey)\n\trequire.Error(t, err)\n\n\t// Fail to open an envelope with an invalid encryption algorithm\n\tsecure.EncryptionAlgorithm = \"invalid\"\n\t_, err = handler.Open(secure, privateKey)\n\trequire.Error(t, err)\n\n\t// Fail to open an envelope with an invalid hmac algorithm\n\tsecure.EncryptionAlgorithm = envelope.Cipher.EncryptionAlgorithm()\n\tsecure.HmacAlgorithm = \"invalid\"\n\t_, err = handler.Open(secure, privateKey)\n\trequire.Error(t, err)\n\n\t// Fail to open an envelope with an unsupported key type\n\tsecure.EncryptionAlgorithm = envelope.Cipher.EncryptionAlgorithm()\n\tsecure.HmacAlgorithm = envelope.Cipher.SignatureAlgorithm()\n\t_, err = handler.Open(secure, nil)\n\trequire.Error(t, err)\n\t_, err = handler.Open(secure, publicKey)\n\trequire.Error(t, err)\n\n\t// Fail to open the envelope using the wrong key\n\twrongKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\trequire.NoError(t, err)\n\t_, err = handler.Open(secure, wrongKey)\n\trequire.Error(t, err)\n\n\t// Successfully opening an envelope\n\topened, err := handler.Open(secure, privateKey)\n\trequire.NoError(t, err)\n\trequire.NotNil(t, opened)\n\trequire.Equal(t, envelope.ID, opened.ID)\n\trequire.Equal(t, envelope.Cipher, opened.Cipher)\n\trequire.True(t, proto.Equal(envelope.Payload, opened.Payload), \"unexpected payload in opened envelope\")\n}", "func testBatchXCKCreditsOnly(t testing.TB) {\n\tmockBatch := mockBatchXCK(t)\n\tmockBatch.Header.ServiceClassCode = CreditsOnly\n\terr := mockBatch.Validate()\n\tif !base.Match(err, NewErrBatchHeaderControlEquality(CreditsOnly, 225)) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "func TestSSHAuditorE2E(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipping test in short mode.\")\n\t}\n\tfor _, tt := range authTestCases {\n\t\tt.Run(fmt.Sprintf(\"TestSSHAuditorE2E(%q, %q, %q) => %q\", tt.hostport, tt.user, tt.password, tt.expected), func(t *testing.T) {\n\t\t\tstore, err := NewSQLiteStore(\":memory:\")\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\terr = store.Init()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\tcred := Credential{\n\t\t\t\tUser: tt.user,\n\t\t\t\tPassword: tt.password,\n\t\t\t\tScanInterval: 1,\n\t\t\t}\n\t\t\t_, err = store.AddCredential(cred)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\tauditor := New(store)\n\t\t\tsc, ipport, err := makeScanConfig(tt.hostport)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\terr = auditor.Discover(sc)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tar, err := auditor.Scan(sc)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tif ar.totalCount != 1 {\n\t\t\t\tt.Errorf(\"totalCount != 1: %#v\", ar.totalCount)\n\t\t\t}\n\t\t\tvulns, err := auditor.Vulnerabilities()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\tif tt.expected != \"\" {\n\t\t\t\tif ar.posCount != 1 {\n\t\t\t\t\tt.Errorf(\"posCount != 1: %#v\", ar.posCount)\n\t\t\t\t}\n\t\t\t\tif ar.negCount != 0 {\n\t\t\t\t\tt.Errorf(\"negCount != 0: %#v\", ar.negCount)\n\t\t\t\t}\n\t\t\t\tif len(vulns) != 1 {\n\t\t\t\t\tt.Fatalf(\"len(vulns) != 1: %#v\", vulns)\n\t\t\t\t}\n\t\t\t\tif vulns[0].Host.Hostport != ipport {\n\t\t\t\t\tt.Errorf(\"vuln[0].hostport != %#v: %#v\", ipport, vulns)\n\t\t\t\t}\n\t\t\t\tif vulns[0].HostCredential.Result != tt.expected {\n\t\t\t\t\tt.Errorf(\"vuln[0].HostCredential.Result != %#v: %#v\", tt.expected, vulns)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ar.posCount != 0 {\n\t\t\t\t\tt.Errorf(\"posCount != 0: %#v\", ar.posCount)\n\t\t\t\t}\n\t\t\t\tif ar.negCount != 1 {\n\t\t\t\t\tt.Errorf(\"negCount != 1: %#v\", ar.negCount)\n\t\t\t\t}\n\t\t\t\tif len(vulns) != 0 {\n\t\t\t\t\tt.Errorf(\"len(vulns) != 0: %#v\", vulns)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func (me TxsdPaymentMechanism) IsCs() bool { return me.String() == \"CS\" }", "func testBatchXCKMixedCreditsAndDebits(t testing.TB) {\n\tmockBatch := mockBatchXCK(t)\n\tmockBatch.Header.ServiceClassCode = MixedDebitsAndCredits\n\terr := mockBatch.Validate()\n\tif !base.Match(err, NewErrBatchHeaderControlEquality(MixedDebitsAndCredits, 225)) {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n}", "func TestCheckTicketExhaustion(t *testing.T) {\n\t// Hardcoded values expected by the tests so they remain valid if network\n\t// parameters change.\n\tconst (\n\t\tcoinbaseMaturity = 16\n\t\tticketMaturity = 16\n\t\tticketsPerBlock = 5\n\t\tstakeEnabledHeight = coinbaseMaturity + ticketMaturity\n\t\tstakeValidationHeight = 144\n\t)\n\n\t// Create chain params based on regnet params with the specific values\n\t// overridden.\n\tparams := chaincfg.RegNetParams()\n\tparams.CoinbaseMaturity = coinbaseMaturity\n\tparams.TicketMaturity = ticketMaturity\n\tparams.TicketsPerBlock = ticketsPerBlock\n\tparams.StakeEnabledHeight = stakeEnabledHeight\n\tparams.StakeValidationHeight = stakeValidationHeight\n\n\t// ticketInfo is used to control the tests by specifying the details about\n\t// how many fake blocks to create with the specified number of tickets.\n\ttype ticketInfo struct {\n\t\tnumNodes uint32 // number of fake blocks to create\n\t\ttickets uint8 // number of tickets to buy in each block\n\t}\n\n\ttests := []struct {\n\t\tname string // test description\n\t\tticketInfo []ticketInfo // num blocks and tickets to construct\n\t\tnewBlockTix uint8 // num tickets in new block for check call\n\t\terr error // expected error\n\t}{{\n\t\t// Reach inevitable ticket exhaustion by not including any ticket\n\t\t// purchases up to and including the final possible block prior to svh\n\t\t// that can prevent it.\n\t\tname: \"guaranteed exhaustion prior to svh\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{126, 0}, // height: 126, 0 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 0, // extending height: 126, 0 live, 0 immature\n\t\terr: ErrTicketExhaustion,\n\t}, {\n\t\t// Reach inevitable ticket exhaustion by not including any ticket\n\t\t// purchases up to just before the final possible block prior to svh\n\t\t// that can prevent it and only include enough tickets in that final\n\t\t// block such that it is one short of the required amount.\n\t\tname: \"one ticket short in final possible block prior to svh\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{126, 0}, // height: 126, 0 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 4, // extending height: 126, 0 live, 4 immature\n\t\terr: ErrTicketExhaustion,\n\t}, {\n\t\t// Construct chain such that there are no ticket purchases up to just\n\t\t// before the final possible block prior to svh that can prevent ticket\n\t\t// exhaustion and that final block contains the exact amount of ticket\n\t\t// purchases required to prevent it.\n\t\tname: \"just enough in final possible block prior to svh\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{126, 0}, // height: 126, 0 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 5, // extending height: 126, 0 live, 5 immature\n\t\terr: nil,\n\t}, {\n\t\t// Reach inevitable ticket exhaustion with one live ticket less than\n\t\t// needed to prevent it at the first block which ticket exhaustion can\n\t\t// happen.\n\t\tname: \"one ticket short with live tickets at 1st possible exhaustion\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{16, 0}, // height: 16, 0 live, 0 immature\n\t\t\t{1, 4}, // height: 17, 0 live, 4 immature\n\t\t\t{109, 0}, // height: 126, 4 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 0, // extending height: 126, 4 live, 0 immature\n\t\terr: ErrTicketExhaustion,\n\t}, {\n\t\tname: \"just enough live tickets at 1st possible exhaustion\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{16, 0}, // height: 16, 0 live, 0 immature\n\t\t\t{1, 5}, // height: 17, 0 live, 5 immature\n\t\t\t{109, 0}, // height: 126, 5 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 0, // extending height: 126, 5 live, 0 immature\n\t\terr: nil,\n\t}, {\n\t\t// Reach inevitable ticket exhaustion in the second possible block that\n\t\t// it can happen. Notice this means it consumes the exact number of\n\t\t// live tickets in the first block that ticket exhaustion can happen.\n\t\tname: \"exhaustion at 2nd possible block, five tickets short\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{16, 0}, // height: 16, 0 live, 0 immature\n\t\t\t{1, 5}, // height: 17, 0 live, 5 immature\n\t\t\t{110, 0}, // height: 127, 5 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 0, // extending height: 127, 5 live, 0 immature\n\t\terr: ErrTicketExhaustion,\n\t}, {\n\t\t// Reach inevitable ticket exhaustion in the second possible block that\n\t\t// it can happen with one live ticket less than needed to prevent it.\n\t\tname: \"exhaustion at 2nd possible block, one ticket short\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{16, 0}, // height: 16, 0 live, 0 immature\n\t\t\t{1, 9}, // height: 17, 0 live, 9 immature\n\t\t\t{110, 0}, // height: 127, 9 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 0, // extending height: 127, 9 live, 0 immature\n\t\terr: ErrTicketExhaustion,\n\t}, {\n\t\t// Construct chain to one block before svh such that there are exactly\n\t\t// enough live tickets to prevent exhaustion.\n\t\tname: \"just enough to svh-1 with live tickets\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{36, 0}, // height: 36, 0 live, 0 immature\n\t\t\t{4, 20}, // height: 40, 0 live, 80 immature\n\t\t\t{1, 5}, // height: 41, 0 live, 85 immature\n\t\t\t{101, 0}, // height: 142, 85 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 0, // extending height: 142, 85 live, 0 immature\n\t\terr: nil,\n\t}, {\n\t\t// Construct chain to one block before svh such that there is a mix of\n\t\t// live and immature tickets that sum to exactly enough prevent\n\t\t// exhaustion.\n\t\tname: \"just enough to svh-1 with mix of live and immature tickets\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{36, 0}, // height: 36, 0 live, 0 immature\n\t\t\t{3, 20}, // height: 39, 0 live, 60 immature\n\t\t\t{1, 15}, // height: 40, 0 live, 75 immature\n\t\t\t{101, 0}, // height: 141, 75 live, 0 immature\n\t\t\t{1, 5}, // height: 142, 75 live, 5 immature\n\t\t},\n\t\tnewBlockTix: 5, // extending height: 142, 75 live, 10 immature\n\t\terr: nil,\n\t}, {\n\t\t// Construct chain to svh such that there are exactly enough live\n\t\t// tickets to prevent exhaustion.\n\t\tname: \"just enough to svh with live tickets\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{32, 0}, // height: 32, 0 live, 0 immature\n\t\t\t{4, 20}, // height: 36, 0 live, 80 immature\n\t\t\t{1, 10}, // height: 37, 0 live, 90 immature\n\t\t\t{106, 0}, // height: 143, 90 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 0, // extending height: 143, 90 live, 0 immature\n\t\terr: nil,\n\t}, {\n\t\t// Construct chain to svh such that there are exactly enough live\n\t\t// tickets just becoming mature to prevent exhaustion.\n\t\tname: \"just enough to svh with maturing\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{126, 0}, // height: 126, 0 live, 0 immature\n\t\t\t{16, 5}, // height: 142, 0 live, 80 immature\n\t\t\t{1, 5}, // height: 143, 5 live, 80 immature\n\t\t},\n\t\tnewBlockTix: 5, // extending height: 143, 5 live, 80 immature\n\t\terr: nil,\n\t}, {\n\t\t// Reach inevitable ticket exhaustion after creating a large pool of\n\t\t// live tickets and allowing the live ticket pool to dwindle due to\n\t\t// votes without buying more any more tickets.\n\t\tname: \"exhaustion due to dwindling live tickets w/o new purchases\",\n\t\tticketInfo: []ticketInfo{\n\t\t\t{126, 0}, // height: 126, 0 live, 0 immature\n\t\t\t{25, 20}, // height: 151, 140 live, 360 immature\n\t\t\t{75, 0}, // height: 226, 85 live, 0 immature\n\t\t},\n\t\tnewBlockTix: 0, // extending height: 226, 85 live, 0 immature\n\t\terr: ErrTicketExhaustion,\n\t}}\n\n\tfor _, test := range tests {\n\t\tbc := newFakeChain(params)\n\n\t\t// immatureTickets tracks which height the purchased tickets will mature\n\t\t// and thus be eligible for admission to the live ticket pool.\n\t\timmatureTickets := make(map[int64]uint8)\n\t\tvar poolSize uint32\n\t\tnode := bc.bestChain.Tip()\n\t\tblockTime := time.Unix(node.timestamp, 0)\n\t\tfor _, ticketInfo := range test.ticketInfo {\n\t\t\tfor i := uint32(0); i < ticketInfo.numNodes; i++ {\n\t\t\t\tblockTime = blockTime.Add(time.Second)\n\t\t\t\tnode = newFakeNode(node, 1, 1, 0, blockTime)\n\t\t\t\tnode.poolSize = poolSize\n\t\t\t\tnode.freshStake = ticketInfo.tickets\n\n\t\t\t\t// Update the pool size for the next header. Notice how tickets\n\t\t\t\t// that mature for this block do not show up in the pool size\n\t\t\t\t// until the next block. This is correct behavior.\n\t\t\t\tpoolSize += uint32(immatureTickets[node.height])\n\t\t\t\tdelete(immatureTickets, node.height)\n\t\t\t\tif node.height >= stakeValidationHeight {\n\t\t\t\t\tpoolSize -= ticketsPerBlock\n\t\t\t\t}\n\n\t\t\t\t// Track maturity height for new ticket purchases.\n\t\t\t\tmaturityHeight := node.height + ticketMaturity\n\t\t\t\timmatureTickets[maturityHeight] = ticketInfo.tickets\n\n\t\t\t\t// Add the new fake node to the block index and update the chain\n\t\t\t\t// to use it as the new best node.\n\t\t\t\tbc.index.AddNode(node)\n\t\t\t\tbc.bestChain.SetTip(node)\n\n\t\t\t\t// Ensure the test data does not have any invalid intermediate\n\t\t\t\t// states leading up to the final test condition.\n\t\t\t\tparentHash := &node.parent.hash\n\t\t\t\terr := bc.CheckTicketExhaustion(parentHash, ticketInfo.tickets)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"%q: unexpected err: %v\", test.name, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Ensure the expected result is returned from ticket exhaustion check.\n\t\terr := bc.CheckTicketExhaustion(&node.hash, test.newBlockTix)\n\t\tif !errors.Is(err, test.err) {\n\t\t\tt.Errorf(\"%q: mismatched err -- got %v, want %v\", test.name, err,\n\t\t\t\ttest.err)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "func (m *MockisCryptoAsymApiReqSetupPrivateKeyEx_Key) isCryptoAsymApiReqSetupPrivateKeyEx_Key() {\n\tm.ctrl.Call(m, \"isCryptoAsymApiReqSetupPrivateKeyEx_Key\")\n}", "func TestEncryptionEncryptByPassPhrase(t *testing.T) {\n\tpassPhrase := \"123\"\n\tplaintext := []byte{1, 2, 3, 4}\n\n\tciphertextStr, err := encryptByPassPhrase(passPhrase, plaintext)\n\tfmt.Println(\"ciphertextStr : \", ciphertextStr)\n\n\tassert.Equal(t, nil, err)\n\tassert.Greater(t, len(ciphertextStr), 0)\n\n\tplaintext2, err := decryptByPassPhrase(passPhrase, ciphertextStr)\n\tassert.Equal(t, plaintext, plaintext2)\n}", "func NewSuite(kemID KEM, kdfID KDF, aeadID AEAD) Suite {\n\ts := Suite{kemID, kdfID, aeadID}\n\tif !s.isValid() {\n\t\tpanic(ErrInvalidHPKESuite)\n\t}\n\treturn s\n}", "func TestSingleCommit4A(t *testing.T) {\n}", "func TestChallenge12(test *testing.T) {\n\t// Feed identical bytes of your-string to the function 1 at a time --- start with 1 byte (\"A\"),\n\t// then \"AA\", then \"AAA\" and so on. Discover the block size of the cipher. You know it, but do this step anyway.\n\toracle := challenge12Oracle{key(16)}\n\tblockSize, err := unsafeaes.DetectBlockSize(oracle)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif blockSize != 16 {\n\t\ttest.Errorf(\"Expected block size to be 16 but was %d\", blockSize)\n\t}\n\n\t// Detect that the function is using ECB. You already know, but do this step anyways.\n\tmode, err := unsafeaes.DetectMode(oracle)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif mode != \"ECB\" {\n\t\ttest.Errorf(\"Expected to detect AES mode ECB, but instead detected %s\", mode)\n\t}\n\n\t// Knowing the block size, craft an input block that is exactly 1 byte short (for instance, if the block size is\n\t// 8 bytes, make \"AAAAAAA\"). Think about what the oracle function is going to put in that last byte position.\n\tplaintextSize, err := findTextLength(oracle)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// round up to the nearest full block size, so we have enough capacity\n\t// in our chosen text to slurp up the target text char by char\n\tblocks := (plaintextSize / blockSize) + 1\n\tplaintext := make([]byte, 0, plaintextSize)\n\tattackSize := blocks * blockSize\n\n\tfor i := 1; i < plaintextSize; i++ {\n\t\tchosentext := make([]byte, attackSize-i)\n\t\t// Make a dictionary of every possible last byte by feeding different strings to the oracle; for instance, \"AAAAAAAA\",\n\t\t// \"AAAAAAAB\", \"AAAAAAAC\", remembering the first block of each invocation.\n\t\tlastbyte := make(map[string]byte)\n\n\t\tfor b := 0; b < 256; b++ {\n\t\t\tknowntext := append(chosentext, plaintext...)\n\t\t\ttesttext := append(knowntext, byte(b))\n\t\t\tciphertext, err := oracle.Encrypt(testtext)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tattackBlocks := ciphertext[:attackSize]\n\t\t\tlastbyte[encodings.BytesToHex(attackBlocks)] = byte(b)\n\t\t}\n\n\t\tciphertext, err := oracle.Encrypt(chosentext)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// Match the output of the one-byte-short input to one of the entries in your dictionary.\n\t\t// You've now discovered the first byte of unknown-string.\n\t\tattackBlocks := ciphertext[:attackSize]\n\t\tdecodedByte := lastbyte[encodings.BytesToHex(attackBlocks)]\n\t\tplaintext = append(plaintext, decodedByte)\n\t}\n\n\texpected := \"Rollin' in my 5.0\\n\" +\n\t\t\"With my rag-top down so my hair can blow\\n\" +\n\t\t\"The girlies on standby waving just to say hi\\n\" +\n\t\t\"Did you stop? No, I just drove by\"\n\tif string(plaintext) != expected {\n\t\ttest.Errorf(\"Expected:\\n%s\\nActual:\\n%s\\n\", expected, string(plaintext))\n\t}\n}", "func (s *SignSuite) TearDownTest(c *C) {\n}", "func (c CryptoServiceTester) TestSignNoMatchingKeys(t *testing.T) {\n\tcryptoService := c.cryptoServiceFactory()\n\n\tprivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err, c.errorMsg(\"error creating key\"))\n\n\t// Test Sign\n\t_, _, err = cryptoService.GetPrivateKey(privKey.ID())\n\trequire.Error(t, err, c.errorMsg(\"Should not have found private key\"))\n}", "func parseCipherSuite(ids []string) []uint16 {\n\tciphers := []uint16{}\n\n\tcorrespondenceMap := map[string]uint16{\n\t\t\"TLS_RSA_WITH_RC4_128_SHA\": tls.TLS_RSA_WITH_RC4_128_SHA,\n\t\t\"TLS_RSA_WITH_3DES_EDE_CBC_SHA\": tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,\n\t\t\"TLS_RSA_WITH_AES_128_CBC_SHA\": tls.TLS_RSA_WITH_AES_128_CBC_SHA,\n\t\t\"TLS_RSA_WITH_AES_256_CBC_SHA\": tls.TLS_RSA_WITH_AES_256_CBC_SHA,\n\t\t\"TLS_RSA_WITH_AES_128_CBC_SHA256\": tls.TLS_RSA_WITH_AES_128_CBC_SHA256,\n\t\t\"TLS_RSA_WITH_AES_128_GCM_SHA256\": tls.TLS_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\"TLS_RSA_WITH_AES_256_GCM_SHA384\": tls.TLS_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\": tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\": tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,\n\t\t\"TLS_ECDHE_RSA_WITH_RC4_128_SHA\": tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA,\n\t\t\"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\": tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\": tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\": tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\": tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\": tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\": tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305\": tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\t\"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305\": tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t}\n\n\tfor _, id := range ids {\n\t\tid = strings.ToUpper(id)\n\t\tif cipher, ok := correspondenceMap[id]; ok {\n\t\t\tciphers = append(ciphers, cipher)\n\t\t} else {\n\t\t\tlogger.Fatalf(\"unknown '%s' cipher\", id)\n\t\t}\n\t}\n\n\treturn ciphers\n}", "func (m *MockisCryptoApiRequest_CryptoApiReq) isCryptoApiRequest_CryptoApiReq() {\n\tm.ctrl.Call(m, \"isCryptoApiRequest_CryptoApiReq\")\n}", "func (m *MockProviders) CryptoSuite() core.CryptoSuite {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CryptoSuite\")\n\tret0, _ := ret[0].(core.CryptoSuite)\n\treturn ret0\n}", "func TestEncapsulateSanity(t *testing.T) {\n\tpacket := Packet6(relayForwBytes)\n\tstartXid, err := packet.XID()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to extract XId: %s\", err)\n\t}\n\n\tencapsulated := packet.Encapsulate(nil)\n\t// dhcp6message type should be SOLICIT\n\tmsg, err := encapsulated.dhcp6message()\n\tmsgType, _ := msg.Type()\n\tif msgType != Solicit {\n\t\tt.Fatalf(\"Expected type %s, got %s\", Solicit, msgType)\n\t}\n\t// XID should be the same after encapsulating\n\tencXid, err := encapsulated.XID()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to extract XId from encapsulated message\")\n\t}\n\tif startXid != encXid {\n\t\tt.Fatalf(\"Expected xid 0x%x but got 0x%x\", startXid, encXid)\n\t}\n}", "func (s *ServiceSuite) TestMacaroonPaperFig6FailsWithoutDischarges(c *gc.C) {\n\tlocator := bakery.NewThirdPartyStore()\n\tts := newBakery(\"ts-loc\", locator)\n\tfs := newBakery(\"fs-loc\", locator)\n\tnewBakery(\"as-loc\", locator)\n\n\t// ts creates a macaroon.\n\ttsMacaroon, err := ts.Oven.NewMacaroon(testContext, bakery.LatestVersion, ages, nil, bakery.LoginOp)\n\tc.Assert(err, gc.IsNil)\n\n\t// ts somehow sends the macaroon to fs which adds a third party caveat to be discharged by as.\n\terr = fs.Oven.AddCaveat(testContext, tsMacaroon, checkers.Caveat{Location: \"as-loc\", Condition: \"user==bob\"})\n\tc.Assert(err, gc.IsNil)\n\n\t// client makes request to ts\n\t_, err = ts.Checker.Auth(macaroon.Slice{tsMacaroon.M()}).Allow(testContext, bakery.LoginOp)\n\tc.Assert(err, gc.ErrorMatches, `verification failed: cannot find discharge macaroon for caveat .*`, gc.Commentf(\"%#v\", err))\n}", "func TestAuthenticateFail(t *testing.T) {\n\tfmt.Println(\"\\nRunning TestAuthenticateFail...\")\n\ttr := NewTestRunner(t)\n\n\tassert.NoError(t, useOCSMockDriver())\n\tassert.NoError(t, usePCRFMockDriver())\n\tdefer func() {\n\t\t// Clear hss, ocs, and pcrf\n\t\tassert.NoError(t, clearOCSMockDriver())\n\t\tassert.NoError(t, clearPCRFMockDriver())\n\t\tassert.NoError(t, tr.CleanUp())\n\t}()\n\n\tues, err := tr.ConfigUEs(2)\n\tassert.NoError(t, err)\n\n\t// ----- Gx CCR-I fail -> Authentication fails -----\n\timsi := ues[0].GetImsi()\n\tgxInitReq := protos.NewGxCCRequest(imsi, protos.CCRequestType_INITIAL)\n\tgxInitAns := protos.NewGxCCAnswer(diam.AuthenticationRejected)\n\tgxInitExpectation := protos.NewGxCreditControlExpectation().Expect(gxInitReq).Return(gxInitAns)\n\n\tdefaultGxAns := protos.NewGxCCAnswer(diam.AuthenticationRejected)\n\tassert.NoError(t, setPCRFExpectations([]*protos.GxCreditControlExpectation{gxInitExpectation}, defaultGxAns))\n\n\ttr.AuthenticateAndAssertFail(imsi)\n\ttr.AssertAllGxExpectationsMetNoError()\n\n\t// Since CCR/A-I failed, pipelined should see no rules installed\n\ttr.AssertPolicyEnforcementRecordIsNil(imsi)\n\n\t// ----- Gx CCR-I success && Gy CCR-I fail -> Authentication fails -----\n\timsi = ues[1].GetImsi()\n\tgxInitReq = protos.NewGxCCRequest(imsi, protos.CCRequestType_INITIAL)\n\tgxInitAns = protos.NewGxCCAnswer(diam.Success).\n\t\tSetDynamicRuleInstall(getPassAllRuleDefinition(\"rule1\", \"\", swag.Uint32(1), 0))\n\tgxInitExpectation = gxInitExpectation.Expect(gxInitReq).Return(gxInitAns)\n\tassert.NoError(t, setPCRFExpectations([]*protos.GxCreditControlExpectation{gxInitExpectation}, defaultGxAns))\n\t// Fail on Gy\n\tgyInitReq := protos.NewGyCCRequest(imsi, protos.CCRequestType_INITIAL)\n\tgyInitAns := protos.NewGyCCAnswer(diam.AuthenticationRejected)\n\tgyInitExpectation := protos.NewGyCreditControlExpectation().Expect(gyInitReq).Return(gyInitAns)\n\tdefaultGyAns := gyInitAns\n\tassert.NoError(t, setOCSExpectations([]*protos.GyCreditControlExpectation{gyInitExpectation}, defaultGyAns))\n\n\ttr.AuthenticateAndAssertFail(imsi)\n\t// assert gx & gy init was received\n\ttr.AssertAllGxExpectationsMetNoError()\n\ttr.AssertAllGyExpectationsMetNoError()\n\n\t// Since CCR/A-I failed, pipelined should see no rules installed\n\ttr.AssertPolicyEnforcementRecordIsNil(imsi)\n}", "func (mysuit *MySuite) TestSmcManager_DeployContract(c *check.C) {\n\tutest.Init(orgID)\n\tcontractOwner := utest.DeployContract(c, contractName, orgID, contractMethods, contractInterfaces)\n\ttest := NewTestObject(contractOwner)\n\torgID := test.obj.sdk.Helper().BlockChainHelper().CalcOrgID(\"testOrg\")\n\tnewOrganization := std.Organization{\n\t\tOrgID: orgID,\n\t\tName: \"testOrg\",\n\t\tOrgOwner: test.obj.sdk.Message().Sender().Address(),\n\t\tContractAddrList: []types.Address{},\n\t\tOrgCodeHash: []byte{},\n\t}\n\ttest.obj.sdk.Helper().StateHelper().Set(\"/organization/\"+orgID, &newOrganization)\n\ttest.obj.sdk.Helper().StateHelper().Set(\"/organization/\"+test.obj.sdk.Message().Contract().OrgID(), &std.Organization{\n\t\tOrgID: test.obj.sdk.Message().Contract().OrgID(),\n\t\tOrgOwner: test.obj.sdk.Message().Sender().Address(),\n\t})\n\n\t// 部署新的合约和基础组织部署或者升级合约\n\ttestCases := []struct {\n\t\tname string\n\t\tversion string\n\t\torgID string\n\t\tcodeHash types.Hash\n\t\tcodeData []byte\n\t\tcodeDevSig string\n\t\tcodeOrgSig string\n\t\teffectHeight int64\n\t\terr types.Error\n\t}{\n\t\t{\"testName\", \"v1.0\", orgID, []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 2, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"\", \"v1.0\", orgID, []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 3, types.Error{ErrorCode: types.ErrInvalidParameter}},\n\t\t{\"testName\", \"\", orgID, []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 3, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testNameA\", \"v1.0\", \"\", []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 3, types.Error{ErrorCode: types.ErrInvalidParameter}},\n\t\t{\"testNameB\", \"v1.0\", orgID, []byte{}, []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 3, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testNameC\", \"v1.0\", orgID, []byte(\"test\"), []byte{}, \"test\", \"test\", test.obj.sdk.Block().Height() + 3, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testNameD\", \"v1.0\", orgID, []byte(\"test\"), []byte(\"hello\"), \"\", \"test\", test.obj.sdk.Block().Height() + 3, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testNameE\", \"v1.0\", orgID, []byte(\"test\"), []byte(\"hello\"), \"test\", \"\", test.obj.sdk.Block().Height() + 3, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testNameF\", \"v1.0\", orgID, []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", 0, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testNameG\", \"v1.0\", orgID, []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() - 2, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testNameH\", \"v1.0\", orgID + \"test\", []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 50, types.Error{ErrorCode: types.ErrInvalidParameter}},\n\t\t{\"testNameI\", \"v1.0\", test.obj.sdk.Message().Contract().OrgID(), []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 100, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testName\", \"v1.0\", test.obj.sdk.Message().Contract().OrgID(), []byte(\"test\"), []byte(\"hello\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 200, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"testNameI\", \"v1.1\", test.obj.sdk.Message().Contract().OrgID(), []byte(\"testA\"), []byte(\"helloA\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 200, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t}\n\n\tfor i, v := range testCases {\n\t\tconAddr, err := test.run().setSender(contractOwner).DeployContract(v.name, v.version, v.orgID, v.codeHash, v.codeData, v.codeDevSig, v.codeOrgSig, v.effectHeight)\n\t\tfmt.Println(i)\n\t\tutest.AssertError(err, v.err.ErrorCode)\n\t\tif err.ErrorCode == types.CodeOK {\n\t\t\tutest.Assert(conAddr ==\n\t\t\t\ttest.obj.sdk.Helper().BlockChainHelper().CalcContractAddress(v.name, v.version, test.obj.sdk.Message().Contract().Owner().Address()))\n\n\t\t\tvar preFix string\n\t\t\tif v.orgID != test.obj.sdk.Message().Contract().OrgID() {\n\t\t\t\tpreFix = \"/\" + orgID + \"/\" + v.name\n\t\t\t} else {\n\t\t\t\tpreFix = \"\"\n\t\t\t}\n\t\t\t// 检查合约信息\n\t\t\tutest.AssertSDB(test.obj.sdk.Message().Contract().KeyPrefix()+\"/contract/\"+conAddr, std.Contract{\n\t\t\t\tAddress: conAddr,\n\t\t\t\tAccount: test.obj.sdk.Helper().BlockChainHelper().CalcAccountFromName(v.name, orgID),\n\t\t\t\tOwner: test.obj.sdk.Message().Contract().Owner().Address(),\n\t\t\t\tName: v.name,\n\t\t\t\tVersion: v.version,\n\t\t\t\tCodeHash: v.codeHash,\n\t\t\t\tEffectHeight: v.effectHeight,\n\t\t\t\tLoseHeight: 0,\n\t\t\t\tKeyPrefix: preFix,\n\t\t\t\tMethods: nil, // 与 build 返回一致\n\t\t\t\tInterfaces: nil,\n\t\t\t\tToken: \"\",\n\t\t\t\tOrgID: v.orgID,\n\t\t\t})\n\n\t\t\t// 检查合约元数据\n\t\t\tcodeDevSigBytes, _ := jsoniter.Marshal(v.codeDevSig)\n\t\t\tcodeOrgSigBytes, _ := jsoniter.Marshal(v.codeOrgSig)\n\t\t\tutest.AssertSDB(test.obj.sdk.Message().Contract().KeyPrefix()+\"/contract/code/\"+conAddr, std.ContractMeta{\n\t\t\t\tName: v.name,\n\t\t\t\tContractAddr: conAddr,\n\t\t\t\tOrgID: v.orgID,\n\t\t\t\tEffectHeight: v.effectHeight,\n\t\t\t\tLoseHeight: 0,\n\t\t\t\tCodeData: v.codeData,\n\t\t\t\tCodeHash: v.codeHash,\n\t\t\t\tCodeDevSig: codeDevSigBytes,\n\t\t\t\tCodeOrgSig: codeOrgSigBytes,\n\t\t\t})\n\n\t\t\t// 检查组织信息\n\t\t\torgInfo := test.obj.sdk.Helper().StateHelper().Get(\"/organization/\"+v.orgID, new(std.Organization)).(*std.Organization)\n\t\t\tfound := false\n\t\t\tfor _, addr := range orgInfo.ContractAddrList {\n\t\t\t\tif addr == conAddr {\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tutest.Assert(found)\n\n\t\t\t// 检查合约列表\n\t\t\tconList := test.obj.sdk.Helper().StateHelper().Get(\"/organization/\"+v.orgID, new(std.ContractVersionList)).(*std.ContractVersionList)\n\t\t\tfoundCon := false\n\t\t\tfor _, addr := range conList.ContractAddrList {\n\t\t\t\tif addr == conAddr {\n\t\t\t\t\tfoundCon = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tutest.Assert(foundCon)\n\n\t\t\t// 检查上一个合约的失效高度\n\t\t\tconVersionInfo := *test.obj.sdk.Helper().StateHelper().Get(\"/contract/\"+v.orgID+\"/\"+v.name, new(std.ContractVersionList)).(*std.ContractVersionList)\n\t\t\tif len(conVersionInfo.ContractAddrList) > 1 {\n\t\t\t\tlastCon := test.obj.sdk.Helper().StateHelper().Get(\n\t\t\t\t\t\"/contract/\"+conVersionInfo.ContractAddrList[len(conVersionInfo.ContractAddrList)-2], new(std.Contract)).(*std.Contract)\n\t\t\t\tutest.Assert(lastCon.LoseHeight == v.effectHeight)\n\t\t\t}\n\t\t}\n\t}\n\n\t// 升级合约\n\toldContract := &std.Contract{\n\t\tName: \"oldName\",\n\t\tAddress: \"oldContractAddr\",\n\t\tVersion: \"v1.1.1\",\n\t\tOrgID: orgID,\n\t\tToken: \"oldToken\",\n\t\tAccount: \"testAccount\",\n\t\tOwner: \"testOwner\",\n\t\tKeyPrefix: \"/oldName\",\n\t}\n\ttest.obj.sdk.Helper().StateHelper().Set(\"/contract/oldContractAddr\", oldContract)\n\n\ttest.obj.sdk.Helper().StateHelper().Set(\"/contract/\"+orgID+\"/\"+\"oldName\", &std.ContractVersionList{\n\t\tName: \"oldName\",\n\t\tContractAddrList: []types.Address{\"oldContractAddr\"},\n\t\tEffectHeights: []int64{5},\n\t})\n\n\t// 升级合约\n\ttestCasesForUpgrade := []struct {\n\t\tname string\n\t\tversion string\n\t\torgID string\n\t\tcodeHash types.Hash\n\t\tcodeData []byte\n\t\tcodeDevSig string\n\t\tcodeOrgSig string\n\t\teffectHeight int64\n\t\terr types.Error\n\t}{\n\t\t{\"oldName\", \"v1.1.2\", orgID, []byte(\"testA\"), []byte(\"helloA\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 20, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"oldName\", \"v1.1.2\", orgID, []byte(\"testA\"), []byte(\"helloB\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 21, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"oldName\", \"v1.2.4.1\", orgID, []byte(\"testA\"), []byte(\"helloB\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 22, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"oldName\", \"v1.2.4\", orgID, []byte(\"testA\"), []byte(\"helloB\"), \"test\", \"test\", test.obj.sdk.Block().Height(), types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t\t{\"oldName\", \"v1.2.2\", orgID + \"test\", []byte(\"testA\"), []byte(\"helloB\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 26, types.Error{ErrorCode: types.ErrInvalidParameter}},\n\t\t{\"oldName\", \"v1.0.2\", orgID, []byte(\"testA\"), []byte(\"helloB\"), \"test\", \"test\", test.obj.sdk.Block().Height() + 190, types.Error{ErrorCode: types.ErrNoAuthorization}},\n\t}\n\n\tfor _, v := range testCasesForUpgrade {\n\t\tconAddr, err := test.run().setSender(contractOwner).DeployContract(v.name, v.version, v.orgID, v.codeHash, v.codeData, v.codeDevSig, v.codeOrgSig, v.effectHeight)\n\t\tutest.AssertError(err, v.err.ErrorCode)\n\t\tif err.ErrorCode == types.CodeOK {\n\t\t\tutest.Assert(conAddr ==\n\t\t\t\ttest.obj.sdk.Helper().BlockChainHelper().CalcContractAddress(v.name, v.version, test.obj.sdk.Message().Contract().Owner().Address()))\n\t\t\tutest.AssertSDB(test.obj.sdk.Message().Contract().KeyPrefix()+\"/contract/\"+conAddr, std.Contract{\n\t\t\t\tAddress: conAddr,\n\t\t\t\tAccount: oldContract.Account,\n\t\t\t\tOwner: oldContract.Owner,\n\t\t\t\tName: v.name,\n\t\t\t\tVersion: v.version,\n\t\t\t\tCodeHash: v.codeHash,\n\t\t\t\tEffectHeight: v.effectHeight,\n\t\t\t\tLoseHeight: 0,\n\t\t\t\tKeyPrefix: \"/\" + v.name,\n\t\t\t\tMethods: nil, // 与 build 返回一致\n\t\t\t\tInterfaces: nil,\n\t\t\t\tToken: oldContract.Token,\n\t\t\t\tOrgID: v.orgID,\n\t\t\t})\n\n\t\t\t// 检查合约元数据\n\t\t\tcodeDevSigBytes, _ := jsoniter.Marshal(v.codeDevSig)\n\t\t\tcodeOrgSigBytes, _ := jsoniter.Marshal(v.codeOrgSig)\n\t\t\tutest.AssertSDB(test.obj.sdk.Message().Contract().KeyPrefix()+\"/contract/code/\"+conAddr, std.ContractMeta{\n\t\t\t\tName: v.name,\n\t\t\t\tContractAddr: conAddr,\n\t\t\t\tOrgID: v.orgID,\n\t\t\t\tEffectHeight: v.effectHeight,\n\t\t\t\tLoseHeight: 0,\n\t\t\t\tCodeData: v.codeData,\n\t\t\t\tCodeHash: v.codeHash,\n\t\t\t\tCodeDevSig: codeDevSigBytes,\n\t\t\t\tCodeOrgSig: codeOrgSigBytes,\n\t\t\t})\n\n\t\t\t// 检查组织信息\n\t\t\torgInfo := test.obj.sdk.Helper().StateHelper().Get(\"/organization/\"+v.orgID, new(std.Organization)).(*std.Organization)\n\t\t\tfound := false\n\t\t\tfor _, conAddr := range orgInfo.ContractAddrList {\n\t\t\t\tif conAddr == conAddr {\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tutest.Assert(found)\n\n\t\t\t// 检查合约列表\n\t\t\tconList := test.obj.sdk.Helper().StateHelper().Get(\"/organization/\"+v.orgID, new(std.ContractVersionList)).(*std.ContractVersionList)\n\t\t\tfoundCon := false\n\t\t\tfor _, addr := range conList.ContractAddrList {\n\t\t\t\tif addr == conAddr {\n\t\t\t\t\tfoundCon = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tutest.Assert(foundCon)\n\n\t\t\t// 检查上一个合约的失效高度\n\t\t\tconVersionInfo := *test.obj.sdk.Helper().StateHelper().Get(\"/contract/\"+v.orgID+\"/\"+v.name, new(std.ContractVersionList)).(*std.ContractVersionList)\n\t\t\tif len(conVersionInfo.ContractAddrList) > 1 {\n\t\t\t\tlastCon := test.obj.sdk.Helper().StateHelper().Get(\n\t\t\t\t\t\"/contract/\"+conVersionInfo.ContractAddrList[len(conVersionInfo.ContractAddrList)-2], new(std.Contract)).(*std.Contract)\n\t\t\t\tutest.Assert(lastCon.LoseHeight == v.effectHeight)\n\t\t\t}\n\t\t}\n\t}\n}", "func (pg *PortalIntegrationTestSuite) SetupSuite() {\n\tfmt.Println(\"Setting up the suite...\")\n\t// Kovan env\n\tpg.IncKBNTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000082\"\n\tpg.IncSALTTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000081\"\n\tpg.IncOMGTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000072\"\n\tpg.IncSNTTokenIDStr = \"0000000000000000000000000000000000000000000000000000000000000071\"\n\tpg.OMGAddressStr = \"0xdB7ec4E4784118D9733710e46F7C83fE7889596a\" // kovan\n\tpg.SNTAddressStr = \"0x4c99B04682fbF9020Fcb31677F8D8d66832d3322\" // kovan\n\tpg.DepositingEther = float64(5)\n\tpg.ETHPrivKeyStr = \"1ABA488300A9D7297A315D127837BE4219107C62C61966ECDF7A75431D75CC61\"\n\tpg.PortalAdminKey = \"B8DB29A7A43FB88AD520F762C5FDF6F1B0155637FA1E5CB2C796AFE9E5C04E31\"\n\tpg.ETHHost = \"http://localhost:8545\"\n\n\tvar err error\n\tfmt.Println(\"Pulling image if not exist, please wait...\")\n\t// remove container if already running\n\texec.Command(\"/bin/sh\", \"-c\", \"docker rm -f portalv3\").Output()\n\texec.Command(\"/bin/sh\", \"-c\", \"docker rm -f incognito\").Output()\n\t_, err = exec.Command(\"/bin/sh\", \"-c\", \"docker run -d -p 8545:8545 --name portalv3 trufflesuite/ganache-cli --account=\\\"0x1ABA488300A9D7297A315D127837BE4219107C62C61966ECDF7A75431D75CC61,10000000000000000000000000000000000,0xB8DB29A7A43FB88AD520F762C5FDF6F1B0155637FA1E5CB2C796AFE9E5C04E31,10000000000000000000000000000000000\\\"\").Output()\n\trequire.Equal(pg.T(), nil, err)\n\ttime.Sleep(10 * time.Second)\n\n\tETHPrivKey, ETHClient, err := ethInstance(pg.ETHPrivKeyStr, pg.ETHHost)\n\trequire.Equal(pg.T(), nil, err)\n\tpg.ETHClient = ETHClient\n\tpg.ETHPrivKey = ETHPrivKey\n\tpg.auth = bind.NewKeyedTransactor(ETHPrivKey)\n\n\t// admin key\n\tprivKey, err := crypto.HexToECDSA(pg.PortalAdminKey)\n\trequire.Equal(pg.T(), nil, err)\n\tadmin := bind.NewKeyedTransactor(privKey)\n\n\t//pg.Portalv3 = common.HexToAddress(\"0x8c13AFB7815f10A8333955854E6ec7503eD841B7\")\n\t//pg.portalV3Inst, err = portalv3.NewPortalv3(pg.Portalv3, pg.ETHClient)\n\t//require.Equal(pg.T(), nil, err)\n\t//incAddr := common.HexToAddress(\"0x2fe0423B148739CD9D0E49e07b5ca00d388A15ac\")\n\t//pg.incProxy, err = incognitoproxy.NewIncognitoproxy(incAddr, pg.ETHClient)\n\t//require.Equal(pg.T(), nil, err)\n\n\tc := getFixedCommittee()\n\tincAddr, _, _, err := incognitoproxy.DeployIncognitoproxy(pg.auth, pg.ETHClient, admin.From, c.beacons)\n\trequire.Equal(pg.T(), nil, err)\n\tfmt.Printf(\"Proxy address: %s\\n\", incAddr.Hex())\n\tportalv3Logic, _, _, err := portalv3.DeployPortalv3(pg.auth, pg.ETHClient)\n\trequire.Equal(pg.T(), nil, err)\n\tfmt.Printf(\"portalv3 address: %s\\n\", portalv3Logic.Hex())\n\n\tportalv3ABI, _ := abi.JSON(strings.NewReader(portalv3.Portalv3ABI))\n\tinput, _ := portalv3ABI.Pack(\"initialize\")\n\n\t//PortalV3\n\tpg.Portalv3, _, _, err = delegator.DeployDelegator(pg.auth, pg.ETHClient, portalv3Logic, admin.From, incAddr, input)\n\trequire.Equal(pg.T(), nil, err)\n\tfmt.Printf(\"delegator address: %s\\n\", pg.Portalv3.Hex())\n\tpg.portalV3Inst, err = portalv3.NewPortalv3(pg.Portalv3, pg.ETHClient)\n\trequire.Equal(pg.T(), nil, err)\n\tpg.incProxy, err = incognitoproxy.NewIncognitoproxy(incAddr, pg.ETHClient)\n\trequire.Equal(pg.T(), nil, err)\n\n\t// 0x54d28562271De782B261807a01d1D2fb97417912\n\tpg.USDTAddress, _, _, err = usdt.DeployUsdt(pg.auth, pg.ETHClient, big.NewInt(100000000000), \"Tether\", \"USDT\", big.NewInt(6))\n\trequire.Equal(pg.T(), nil, err)\n\tfmt.Printf(\"usdt address: %s\\n\", pg.USDTAddress.Hex())\n\n\t//get portalv3 ip\n\tipAddress, err := exec.Command(\"/bin/sh\", \"-c\", \"docker inspect -f \\\"{{ .NetworkSettings.IPAddress }}\\\" portalv3\").Output()\n\trequire.Equal(pg.T(), nil, err)\n\n\t// run incognito chaind\n\tincogitoWithArgument := fmt.Sprintf(\"docker run -d -p 9334:9334 -p 9338:9338 --name incognito -e GETH_NAME=%v -e PORTAL_CONTRACT=%v incognito\", string(ipAddress), pg.Portalv3.Hex())\n\tincogitoWithArgument = strings.Replace(incogitoWithArgument, \"\\n\", \"\", -1)\n\t_, err = exec.Command(\"/bin/sh\", \"-c\", incogitoWithArgument).Output()\n\trequire.Equal(pg.T(), nil, err)\n\n\tfor {\n\t\ttime.Sleep(5 * time.Second)\n\t\tif checkRepsonse(pg.IncBridgeHost) {\n\t\t\tbreak\n\t\t}\n\t}\n\ttime.Sleep(40 * time.Second)\n}", "func TestEncrypt(t *testing.T) {\n\tC, V, T, err := Secp256k1Encrypt(testString, secpPublicKey)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tplainText, err := Secp256k1Decrypt(C, V, T, secpPrivateKey)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif plainText != testString {\n\t\tt.Fatal(fmt.Sprintf(\"Failed to decrypt string, expects %s got %s\", testString, plainText))\n\t}\n}", "func TestGetSupportCoins(t *testing.T) {\n\tt.Parallel()\n\tif _, err := ok.GetSupportCoins(context.Background()); err != nil {\n\t\tt.Error(\"Okx GetSupportCoins() error\", err)\n\t}\n}", "func (mr *MockInternalClientMockRecorder) CryptoApiInvoke(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CryptoApiInvoke\", reflect.TypeOf((*MockInternalClient)(nil).CryptoApiInvoke), varargs...)\n}", "func TestBatchCTXStandardEntryClassCode(t *testing.T) {\n\ttestBatchCTXStandardEntryClassCode(t)\n}", "func (adminAPIOp) SkipVerification() bool { return true }", "func TestSignContractSuccess(t *testing.T) {\n\tsignatureHelper(t, false)\n}", "func (m *MockClient) CryptoSuite() core.CryptoSuite {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CryptoSuite\")\n\tret0, _ := ret[0].(core.CryptoSuite)\n\treturn ret0\n}", "func (mr *MockInternalServerMockRecorder) CryptoAsymKeyDelete(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CryptoAsymKeyDelete\", reflect.TypeOf((*MockInternalServer)(nil).CryptoAsymKeyDelete), arg0, arg1)\n}", "func TestTerminateSectors(t *testing.T) {\n\tctx := context.Background()\n\tv := vm.NewVMWithSingletons(ctx, t, ipld.NewBlockStoreInMemory())\n\taddrs := vm.CreateAccounts(ctx, t, v, 4, big.Mul(big.NewInt(10_000), vm.FIL), 93837778)\n\towner, verifier, unverifiedClient, verifiedClient := addrs[0], addrs[1], addrs[2], addrs[3]\n\tworker := owner\n\n\tminerBalance := big.Mul(big.NewInt(1_000), vm.FIL)\n\tsectorNumber := abi.SectorNumber(100)\n\tsealedCid := tutil.MakeCID(\"100\", &miner.SealedCIDPrefix)\n\tsealProof := abi.RegisteredSealProof_StackedDrg32GiBV1_1\n\n\t// create miner\n\tret := vm.ApplyOk(t, v, addrs[0], builtin.StoragePowerActorAddr, minerBalance, builtin.MethodsPower.CreateMiner, &power.CreateMinerParams{\n\t\tOwner: owner,\n\t\tWorker: worker,\n\t\tWindowPoStProofType: abi.RegisteredPoStProof_StackedDrgWindow32GiBV1,\n\t\tPeer: abi.PeerID(\"not really a peer id\"),\n\t})\n\tminerAddrs, ok := ret.(*power.CreateMinerReturn)\n\trequire.True(t, ok)\n\n\t//\n\t// publish verified and unverified deals\n\t//\n\n\t// register verifier then verified client\n\tvm.ApplyOk(t, v, vm.VerifregRoot, builtin.VerifiedRegistryActorAddr, big.Zero(), builtin.MethodsVerifiedRegistry.AddVerifier, &verifreg.AddVerifierParams{\n\t\tAddress: verifier,\n\t\tAllowance: abi.NewStoragePower(32 << 40),\n\t})\n\n\tvm.ApplyOk(t, v, verifier, builtin.VerifiedRegistryActorAddr, big.Zero(), builtin.MethodsVerifiedRegistry.AddVerifiedClient, &verifreg.AddVerifiedClientParams{\n\t\tAddress: verifiedClient,\n\t\tAllowance: abi.NewStoragePower(32 << 40),\n\t})\n\n\t// add market collateral for clients and miner\n\tcollateral := big.Mul(big.NewInt(3), vm.FIL)\n\tvm.ApplyOk(t, v, unverifiedClient, builtin.StorageMarketActorAddr, collateral, builtin.MethodsMarket.AddBalance, &unverifiedClient)\n\tvm.ApplyOk(t, v, verifiedClient, builtin.StorageMarketActorAddr, collateral, builtin.MethodsMarket.AddBalance, &verifiedClient)\n\tminerCollateral := big.Mul(big.NewInt(64), vm.FIL)\n\tvm.ApplyOk(t, v, worker, builtin.StorageMarketActorAddr, minerCollateral, builtin.MethodsMarket.AddBalance, &minerAddrs.IDAddress)\n\n\t// create 3 deals, some verified and some not\n\tdealIDs := []abi.DealID{}\n\tdealStart := v.GetEpoch() + miner.PreCommitChallengeDelay + 1\n\tdeals := publishDeal(t, v, worker, verifiedClient, minerAddrs.IDAddress, \"deal1\", 1<<30, true, dealStart, 181*builtin.EpochsInDay)\n\tdealIDs = append(dealIDs, deals.IDs...)\n\tdeals = publishDeal(t, v, worker, verifiedClient, minerAddrs.IDAddress, \"deal2\", 1<<32, true, dealStart, 200*builtin.EpochsInDay)\n\tdealIDs = append(dealIDs, deals.IDs...)\n\tdeals = publishDeal(t, v, worker, unverifiedClient, minerAddrs.IDAddress, \"deal3\", 1<<34, false, dealStart, 210*builtin.EpochsInDay)\n\tdealIDs = append(dealIDs, deals.IDs...)\n\n\tvm.ApplyOk(t, v, builtin.SystemActorAddr, builtin.CronActorAddr, big.Zero(), builtin.MethodsCron.EpochTick, nil)\n\tfor _, id := range dealIDs {\n\t\t// deals are pending and don't yet have deal states\n\t\t_, found := vm.GetDealState(t, v, id)\n\t\trequire.False(t, found)\n\t}\n\n\t//\n\t// Precommit, Prove, Verify and PoSt sector with deals\n\t//\n\n\t// precommit sector with deals\n\tvm.ApplyOk(t, v, addrs[0], minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.PreCommitSector, &miner.PreCommitSectorParams{\n\t\tSealProof: sealProof,\n\t\tSectorNumber: sectorNumber,\n\t\tSealedCID: sealedCid,\n\t\tSealRandEpoch: v.GetEpoch() - 1,\n\t\tDealIDs: dealIDs,\n\t\tExpiration: v.GetEpoch() + 220*builtin.EpochsInDay,\n\t\tReplaceCapacity: false,\n\t})\n\n\t// advance time to min seal duration\n\tproveTime := v.GetEpoch() + miner.PreCommitChallengeDelay + 1\n\tv, _ = vm.AdvanceByDeadlineTillEpoch(t, v, minerAddrs.IDAddress, proveTime)\n\n\t// Prove commit sector after max seal duration\n\tv, err := v.WithEpoch(proveTime)\n\trequire.NoError(t, err)\n\tvm.ApplyOk(t, v, worker, minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.ProveCommitSector, &miner.ProveCommitSectorParams{\n\t\tSectorNumber: sectorNumber,\n\t})\n\n\t// In the same epoch, trigger cron to validate prove commit\n\tvm.ApplyOk(t, v, builtin.SystemActorAddr, builtin.CronActorAddr, big.Zero(), builtin.MethodsCron.EpochTick, nil)\n\n\t// advance to proving period and submit post\n\tdlInfo, pIdx, v := vm.AdvanceTillProvingDeadline(t, v, minerAddrs.IDAddress, sectorNumber)\n\tvm.ApplyOk(t, v, worker, minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.SubmitWindowedPoSt, &miner.SubmitWindowedPoStParams{\n\t\tDeadline: dlInfo.Index,\n\t\tPartitions: []miner.PoStPartition{{\n\t\t\tIndex: pIdx,\n\t\t\tSkipped: bitfield.New(),\n\t\t}},\n\t\tProofs: []proof.PoStProof{{\n\t\t\tPoStProof: abi.RegisteredPoStProof_StackedDrgWindow32GiBV1,\n\t\t}},\n\t\tChainCommitEpoch: dlInfo.Challenge,\n\t\tChainCommitRand: []byte(vm.RandString),\n\t})\n\n\t// proving period cron adds miner power\n\tv, err = v.WithEpoch(dlInfo.Last())\n\trequire.NoError(t, err)\n\tvm.ApplyOk(t, v, builtin.SystemActorAddr, builtin.CronActorAddr, big.Zero(), builtin.MethodsCron.EpochTick, nil)\n\n\t// market cron updates deal states indicating deals are no longer pending.\n\tfor _, id := range dealIDs {\n\t\tstate, found := vm.GetDealState(t, v, id)\n\t\trequire.True(t, found)\n\t\t// non-zero\n\t\tassert.Greater(t, uint64(state.LastUpdatedEpoch), uint64(0))\n\t\t// deal has not been slashed\n\t\tassert.Equal(t, abi.ChainEpoch(-1), state.SlashEpoch)\n\t}\n\n\t//\n\t// Terminate Sector\n\t//\n\n\tv, err = v.WithEpoch(v.GetEpoch() + 1)\n\trequire.NoError(t, err)\n\n\tvm.ApplyOk(t, v, worker, minerAddrs.RobustAddress, big.Zero(), builtin.MethodsMiner.TerminateSectors, &miner.TerminateSectorsParams{\n\t\tTerminations: []miner.TerminationDeclaration{{\n\t\t\tDeadline: dlInfo.Index,\n\t\t\tPartition: pIdx,\n\t\t\tSectors: bitfield.NewFromSet([]uint64{uint64(sectorNumber)}),\n\t\t}},\n\t})\n\n\tnoSubinvocations := []vm.ExpectInvocation{}\n\tvm.ExpectInvocation{\n\t\tTo: minerAddrs.IDAddress,\n\t\tMethod: builtin.MethodsMiner.TerminateSectors,\n\t\tSubInvocations: []vm.ExpectInvocation{\n\t\t\t{To: builtin.RewardActorAddr, Method: builtin.MethodsReward.ThisEpochReward, SubInvocations: noSubinvocations},\n\t\t\t{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.CurrentTotalPower, SubInvocations: noSubinvocations},\n\t\t\t{To: builtin.BurntFundsActorAddr, Method: builtin.MethodSend, SubInvocations: noSubinvocations},\n\t\t\t{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.UpdatePledgeTotal, SubInvocations: noSubinvocations},\n\t\t\t{To: builtin.StorageMarketActorAddr, Method: builtin.MethodsMarket.OnMinerSectorsTerminate, SubInvocations: noSubinvocations},\n\t\t\t{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.UpdateClaimedPower, SubInvocations: noSubinvocations},\n\t\t},\n\t}.Matches(t, v.LastInvocation())\n\n\t// expect power, market and miner to be in base state\n\tminerBalances := vm.GetMinerBalances(t, v, minerAddrs.IDAddress)\n\tassert.Equal(t, big.Zero(), minerBalances.InitialPledge)\n\tassert.Equal(t, big.Zero(), minerBalances.PreCommitDeposit)\n\n\t// expect network stats to reflect power has been removed from sector\n\tstats := vm.GetNetworkStats(t, v)\n\tassert.Equal(t, int64(0), stats.MinerAboveMinPowerCount)\n\tassert.Equal(t, big.Zero(), stats.TotalRawBytePower)\n\tassert.Equal(t, big.Zero(), stats.TotalQualityAdjPower)\n\tassert.Equal(t, big.Zero(), stats.TotalBytesCommitted)\n\tassert.Equal(t, big.Zero(), stats.TotalQABytesCommitted)\n\tassert.Equal(t, big.Zero(), stats.TotalPledgeCollateral)\n\n\t// market cron slashes deals because sector has been terminated\n\tfor _, id := range dealIDs {\n\t\tstate, found := vm.GetDealState(t, v, id)\n\t\trequire.True(t, found)\n\t\t// non-zero\n\t\tassert.Greater(t, uint64(state.LastUpdatedEpoch), uint64(0))\n\t\t// deal has not been slashed\n\t\tassert.Equal(t, v.GetEpoch(), state.SlashEpoch)\n\n\t}\n\n\t// advance a proving period and run cron to complete processing of termination\n\tv, err = v.WithEpoch(v.GetEpoch() + 2880)\n\trequire.NoError(t, err)\n\tvm.ApplyOk(t, v, builtin.SystemActorAddr, builtin.CronActorAddr, big.Zero(), builtin.MethodsCron.EpochTick, nil)\n\n\t// Verified client should be able to withdraw all all deal collateral.\n\t// Client added 3 FIL balance and had 2 deals with 1 FIL collateral apiece.\n\t// Should only be able to withdraw the full 2 FIL only if deals have been slashed and balance was unlocked.\n\twithdrawal := big.Mul(big.NewInt(2), vm.FIL)\n\tvm.ApplyOk(t, v, verifiedClient, builtin.StorageMarketActorAddr, big.Zero(), builtin.MethodsMarket.WithdrawBalance, &market.WithdrawBalanceParams{\n\t\tProviderOrClientAddress: verifiedClient,\n\t\tAmount: withdrawal,\n\t})\n\n\tverifiedIDAddr, found := v.NormalizeAddress(verifiedClient)\n\trequire.True(t, found)\n\tvm.ExpectInvocation{\n\t\tTo: builtin.StorageMarketActorAddr,\n\t\tMethod: builtin.MethodsMarket.WithdrawBalance,\n\t\tSubInvocations: []vm.ExpectInvocation{\n\t\t\t{To: verifiedIDAddr, Method: builtin.MethodSend, Value: vm.ExpectAttoFil(withdrawal)},\n\t\t},\n\t}.Matches(t, v.LastInvocation())\n\n\t// Check that miner's collateral has been slashed by attempting to withdraw all funds\n\tvm.ApplyOk(t, v, owner, builtin.StorageMarketActorAddr, big.Zero(), builtin.MethodsMarket.WithdrawBalance, &market.WithdrawBalanceParams{\n\t\tProviderOrClientAddress: minerAddrs.IDAddress,\n\t\tAmount: minerCollateral,\n\t})\n\n\t// miner add 64 balance. Each of 3 deals required 2 FIL collateral, so provider collateral should have been\n\t// slashed by 6 FIL. Miner's remaining market balance should be 64 - 6 + payment, where payment is for storage\n\t// before the slash and should be << 1 FIL. Actual amount withdrawn should be between 58 and 59 FIL.\n\tvalueWithdrawn := vm.ValueForInvocation(t, v, len(v.Invocations())-1, 1)\n\tassert.True(t, big.Mul(big.NewInt(58), vm.FIL).LessThan(valueWithdrawn))\n\tassert.True(t, big.Mul(big.NewInt(59), vm.FIL).GreaterThan(valueWithdrawn))\n}", "func testKeyCanOnlyBeAddedOnce(t *testing.T, dbStore trustmanager.KeyStore) []data.PrivateKey {\n\texpectedKeys := make([]data.PrivateKey, 2)\n\tfor i := 0; i < len(expectedKeys); i++ {\n\t\ttestKey, err := utils.GenerateECDSAKey(rand.Reader)\n\t\trequire.NoError(t, err)\n\t\texpectedKeys[i] = testKey\n\t}\n\n\t// Test writing new key in database alone, not cache\n\terr := dbStore.AddKey(trustmanager.KeyInfo{Role: data.CanonicalTimestampRole, Gun: \"gun/ignored\"}, expectedKeys[0])\n\trequire.NoError(t, err)\n\t// Currently we ignore roles\n\trequireGetKeySuccess(t, dbStore, \"\", expectedKeys[0])\n\n\t// Test writing the same key in the database. Should fail.\n\terr = dbStore.AddKey(trustmanager.KeyInfo{Role: data.CanonicalTimestampRole, Gun: \"gun/ignored\"}, expectedKeys[0])\n\trequire.Error(t, err, \"failed to add private key to database:\")\n\n\t// Test writing new key succeeds\n\terr = dbStore.AddKey(trustmanager.KeyInfo{Role: data.CanonicalTimestampRole, Gun: \"gun/ignored\"}, expectedKeys[1])\n\trequire.NoError(t, err)\n\n\treturn expectedKeys\n}" ]
[ "0.630053", "0.5933194", "0.58964694", "0.5805351", "0.56914747", "0.5639266", "0.5618166", "0.5600513", "0.54475665", "0.5333737", "0.5328652", "0.5317787", "0.5312988", "0.5312179", "0.5296953", "0.5289792", "0.52888066", "0.5247725", "0.5241643", "0.52147925", "0.51980615", "0.519602", "0.51652133", "0.51597786", "0.51357126", "0.511932", "0.51117915", "0.50868255", "0.5078588", "0.5073254", "0.50711703", "0.5069908", "0.5064886", "0.50427777", "0.5020239", "0.4981148", "0.49495745", "0.49489176", "0.49467006", "0.4937625", "0.49331427", "0.49163124", "0.4916275", "0.49143907", "0.49049488", "0.4899263", "0.4890077", "0.48889837", "0.48877215", "0.48875684", "0.4885117", "0.48834342", "0.48767722", "0.48760572", "0.48696527", "0.4852551", "0.48412132", "0.483763", "0.48277125", "0.48194948", "0.4811907", "0.48081577", "0.48027405", "0.4795033", "0.4794897", "0.47871897", "0.47823307", "0.4781852", "0.47744355", "0.4774271", "0.47660655", "0.47483462", "0.47432873", "0.47428", "0.47410756", "0.47410482", "0.47382125", "0.47350523", "0.47197843", "0.47176132", "0.4705811", "0.47057328", "0.4702647", "0.47010335", "0.46987224", "0.46964392", "0.46961114", "0.4695446", "0.4695009", "0.4693663", "0.4692017", "0.4691233", "0.4681053", "0.46771207", "0.4676485", "0.46732014", "0.46721888", "0.46690765", "0.4664", "0.46531108" ]
0.6295867
1
EndpointConfig mocks base method
func (m *MockProviders) EndpointConfig() fab.EndpointConfig { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EndpointConfig") ret0, _ := ret[0].(fab.EndpointConfig) return ret0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *MockClient) EndpointConfig() fab.EndpointConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EndpointConfig\")\n\tret0, _ := ret[0].(fab.EndpointConfig)\n\treturn ret0\n}", "func (m *MockConfiguration) IntrospectionEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IntrospectionEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}", "func (m *MockAPIConfigFromFlags) MakeEndpoint() (http.Endpoint, error) {\n\tret := m.ctrl.Call(m, \"MakeEndpoint\")\n\tret0, _ := ret[0].(http.Endpoint)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockConfiguration) UserinfoEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UserinfoEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}", "func TestEndpointCase45(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://example.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *MockConfiguration) TokenEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"TokenEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}", "func (m *MockProvider) ServiceEndpoint() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServiceEndpoint\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func TestEndpointCase1(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"ap-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.ap-east-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase2(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"ap-northeast-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.ap-northeast-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase44(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://example.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *MockConfiguration) AuthorizationEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AuthorizationEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}", "func Endpoint(url string, configureFunc func()) {\n\touterCurrentMockHandler := currentMockHandler\n\tSwitch(extractor.ExtractMethod(), configureFunc)\n\tcurrentMockery.Handle(url, currentMockHandler)\n\tcurrentMockHandler = outerCurrentMockHandler\n}", "func TestEndpointCase0(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"af-south-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.af-south-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func Test_convertEndpointsConfig(t *testing.T) {\n\ttype args struct {\n\t\txdsEndpoint *xdsendpoint.LocalityLbEndpoints\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant []v2.Host\n\t}{\n\t\t{\n\t\t\tname: \"case1\",\n\t\t\targs: args{\n\t\t\t\txdsEndpoint: &xdsendpoint.LocalityLbEndpoints{\n\t\t\t\t\tPriority: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []v2.Host{},\n\t\t},\n\t\t{\n\t\t\tname: \"case2\",\n\t\t\targs: args{\n\t\t\t\txdsEndpoint: &xdsendpoint.LocalityLbEndpoints{\n\t\t\t\t\tLbEndpoints: []*xdsendpoint.LbEndpoint{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tHostIdentifier: &xdsendpoint.LbEndpoint_Endpoint{\n\t\t\t\t\t\t\t\tEndpoint: &xdsendpoint.Endpoint{\n\t\t\t\t\t\t\t\t\tAddress: &core.Address{\n\t\t\t\t\t\t\t\t\t\tAddress: &core.Address_SocketAddress{\n\t\t\t\t\t\t\t\t\t\t\tSocketAddress: &core.SocketAddress{\n\t\t\t\t\t\t\t\t\t\t\t\tAddress: \"192.168.0.1\",\n\t\t\t\t\t\t\t\t\t\t\t\tProtocol: core.SocketAddress_TCP,\n\t\t\t\t\t\t\t\t\t\t\t\tPortSpecifier: &core.SocketAddress_PortValue{PortValue: 8080},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLoadBalancingWeight: &wrappers.UInt32Value{Value: 20},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tHostIdentifier: &xdsendpoint.LbEndpoint_Endpoint{\n\t\t\t\t\t\t\t\tEndpoint: &xdsendpoint.Endpoint{\n\t\t\t\t\t\t\t\t\tAddress: &core.Address{\n\t\t\t\t\t\t\t\t\t\tAddress: &core.Address_SocketAddress{\n\t\t\t\t\t\t\t\t\t\t\tSocketAddress: &core.SocketAddress{\n\t\t\t\t\t\t\t\t\t\t\t\tAddress: \"192.168.0.2\",\n\t\t\t\t\t\t\t\t\t\t\t\tProtocol: core.SocketAddress_TCP,\n\t\t\t\t\t\t\t\t\t\t\t\tPortSpecifier: &core.SocketAddress_PortValue{PortValue: 8080},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLoadBalancingWeight: &wrappers.UInt32Value{Value: 0},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tHostIdentifier: &xdsendpoint.LbEndpoint_Endpoint{\n\t\t\t\t\t\t\t\tEndpoint: &xdsendpoint.Endpoint{\n\t\t\t\t\t\t\t\t\tAddress: &core.Address{\n\t\t\t\t\t\t\t\t\t\tAddress: &core.Address_SocketAddress{\n\t\t\t\t\t\t\t\t\t\t\tSocketAddress: &core.SocketAddress{\n\t\t\t\t\t\t\t\t\t\t\t\tAddress: \"192.168.0.3\",\n\t\t\t\t\t\t\t\t\t\t\t\tProtocol: core.SocketAddress_TCP,\n\t\t\t\t\t\t\t\t\t\t\t\tPortSpecifier: &core.SocketAddress_PortValue{PortValue: 8080},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLoadBalancingWeight: &wrappers.UInt32Value{Value: 200},\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\twant: []v2.Host{\n\t\t\t\t{\n\t\t\t\t\tHostConfig: v2.HostConfig{\n\t\t\t\t\t\tAddress: \"192.168.0.1:8080\",\n\t\t\t\t\t\tWeight: 20,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tHostConfig: v2.HostConfig{\n\t\t\t\t\t\tAddress: \"192.168.0.2:8080\",\n\t\t\t\t\t\tWeight: configmanager.MinHostWeight,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tHostConfig: v2.HostConfig{\n\t\t\t\t\t\tAddress: \"192.168.0.3:8080\",\n\t\t\t\t\t\tWeight: configmanager.MaxHostWeight,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\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 := ConvertEndpointsConfig(tt.args.xdsEndpoint); !reflect.DeepEqual(got, tt.want) {\n\t\t\t\tt.Errorf(\"convertEndpointsConfig() = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "func (r mockEndpointResolver) EndpointFor(service, region string, opts ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) {\n\treturn r.resolvedEndpoint, r.err\n}", "func (c *MockRemoteWriteClient) Endpoint() string { return \"\" }", "func EndpointForCondition(predicate predicate.Predicate, configFunc func()) {\n\touterCurrentMockHandler := currentMockHandler\n\tconfigFunc()\n\tcurrentMockery.HandleForCondition(DefaultPriority, predicate, currentMockHandler)\n\tcurrentMockHandler = outerCurrentMockHandler\n}", "func TestEndpointCase27(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-east-1.api.aws\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (pushBots *PushBots) initializeEndpoints(endpointOverride string) {\n\tendpointBase := productionEndPoint\n\n\tif endpointOverride != \"\" {\n\t\tendpointBase = endpointOverride\n\t}\n\n\tpushBots.endpoints = map[string]pushBotRequest{\n\t\t\"registerdevice\": pushBotRequest{Endpoint: endpointBase + \"deviceToken\", HttpVerb: \"PUT\"},\n\t\t\"unregisterdevice\": pushBotRequest{Endpoint: endpointBase + \"deviceToken/del\", HttpVerb: \"PUT\"},\n\t\t\"alias\": pushBotRequest{Endpoint: endpointBase + \"alias\", HttpVerb: \"PUT\"},\n\t\t\"tagdevice\": pushBotRequest{Endpoint: endpointBase + \"tag\", HttpVerb: \"PUT\"},\n\t\t\"untagdevice\": pushBotRequest{Endpoint: endpointBase + \"tag/del\", HttpVerb: \"PUT\"},\n\t\t\"geos\": pushBotRequest{Endpoint: endpointBase + \"geo\", HttpVerb: \"PUT\"},\n\t\t\"addnotificationtype\": pushBotRequest{Endpoint: endpointBase + \"activate\", HttpVerb: \"PUT\"},\n\t\t\"removenotificationtype\": pushBotRequest{Endpoint: endpointBase + \"deactivate\", HttpVerb: \"PUT\"},\n\t\t\"broadcast\": pushBotRequest{Endpoint: endpointBase + \"push/all\", HttpVerb: \"POST\"},\n\t\t\"pushone\": pushBotRequest{Endpoint: endpointBase + \"push/one\", HttpVerb: \"POST\"},\n\t\t\"batch\": pushBotRequest{Endpoint: endpointBase + \"push/all\", HttpVerb: \"POST\"},\n\t\t\"badge\": pushBotRequest{Endpoint: endpointBase + \"badge\", HttpVerb: \"PUT\"},\n\t\t\"recordanalytics\": pushBotRequest{Endpoint: endpointBase + \"stats\", HttpVerb: \"PUT\"},\n\t}\n}", "func (c *Provider) EndpointConfig() fab.EndpointConfig {\n\treturn c.endpointConfig\n}", "func (m *MockConfiguration) KeysEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"KeysEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}", "func TestValidate1(t *testing.T) {\n\tendpoints := make(map[string]map[string]*Endpoint)\n\tendpoints[\"/test\"] = map[string]*Endpoint{\n\t\t\"get\": {\n\t\t\tParams: &Parameters{\n\t\t\t\tQuery: map[string]*ParamEntry{\"test\": {Type: \"string\", Required: true}},\n\t\t\t\tPath: map[string]*ParamEntry{\"test\": {Type: \"boolean\", Required: true}},\n\t\t\t},\n\t\t\tRecieves: &Recieves{\n\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\tBody: map[string]string{\"example_array.0.foo\": \"string\"},\n\t\t\t},\n\t\t\tResponses: map[int]*Response{\n\t\t\t\t200: {\n\t\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\t\tBody: map[string]interface{}{\"bar\": \"foo\"},\n\t\t\t\t\tWeight: 100,\n\t\t\t\t\tActions: []map[string]interface{}{\n\t\t\t\t\t\t{\"delay\": 10},\n\t\t\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tActions: []map[string]interface{}{\n\t\t\t\t{\"delay\": 10},\n\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t},\n\t\t},\n\t}\n\n\tcfg := &Config{\n\t\tVersion: 1.0,\n\t\tServices: map[string]*Service{\n\t\t\t\"testService\": {Hostname: \"localhost\", Port: 8080},\n\t\t},\n\t\tStartupActions: []map[string]interface{}{\n\t\t\t{\"delay\": 10},\n\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t},\n\t\tRequests: map[string]*Request{\n\t\t\t\"testRequest\": {\n\t\t\t\tURL: \"/test\",\n\t\t\t\tProtocol: \"http\",\n\t\t\t\tMethod: \"get\",\n\t\t\t\tHeaders: map[string]string{\"foo\": \"bar\"},\n\t\t\t\tBody: nil,\n\t\t\t\tExpectedResponse: &Response{\n\t\t\t\t\tStatusCode: 200,\n\t\t\t\t\tBody: map[string]interface{}{\"foo.bar\": \"string\"},\n\t\t\t\t\tHeaders: nil,\n\t\t\t\t\tWeight: 100,\n\t\t\t\t\tActions: []map[string]interface{}{\n\t\t\t\t\t\t{\"delay\": 10},\n\t\t\t\t\t\t{\"request\": map[interface{}]interface{}{\"target\": \"testService\", \"id\": \"testRequest\"}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tEndpoints: endpoints,\n\t}\n\n\tif err := Validate(cfg); err != nil {\n\t\tt.Errorf(\"Validation Failed: %s\", err.Error())\n\t}\n}", "func TestEndpointURL(t *testing.T) {\n\t// these client calls should fail since we'll break the URL paths\n\tsimulator.Test(func(ctx context.Context, vc *vim25.Client) {\n\t\tlsim.BreakLookupServiceURLs()\n\n\t\t{\n\t\t\t_, err := ssoadmin.NewClient(ctx, vc)\n\t\t\tif err == nil {\n\t\t\t\tt.Error(\"expected error\")\n\t\t\t}\n\t\t\tif !strings.Contains(err.Error(), http.StatusText(404)) {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\tc, err := sts.NewClient(ctx, vc)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\treq := sts.TokenRequest{\n\t\t\t\tUserinfo: url.UserPassword(\"[email protected]\", \"password\"),\n\t\t\t}\n\t\t\t_, err = c.Issue(ctx, req)\n\t\t\tif err == nil {\n\t\t\t\tt.Error(\"expected error\")\n\t\t\t}\n\t\t\tif !strings.Contains(err.Error(), http.StatusText(404)) {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t}\n\t})\n\n\t// these client calls should not fail\n\tsimulator.Test(func(ctx context.Context, vc *vim25.Client) {\n\t\t{\n\t\t\t// NewClient calls ServiceInstance methods\n\t\t\t_, err := ssoadmin.NewClient(ctx, vc)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\tc, err := sts.NewClient(ctx, vc)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\treq := sts.TokenRequest{\n\t\t\t\tUserinfo: url.UserPassword(\"[email protected]\", \"password\"),\n\t\t\t}\n\n\t\t\t_, err = c.Issue(ctx, req)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t}\n\t})\n}", "func TestEndpointCase10(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"eu-central-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.eu-central-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestGetConcurrentAPIEndpoints(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tname string\n\t\tddURL, eventsDDURL, apiKey string\n\t\tadditionalEndpoints map[string][]string\n\t\tadditionalEventsEndpoints map[string][]string\n\t\texpectedEndpoints []apicfg.Endpoint\n\t\texpectedEventsEndpoints []apicfg.Endpoint\n\t}{\n\t\t{\n\t\t\tname: \"default\",\n\t\t\tapiKey: \"test\",\n\t\t\texpectedEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEndpoint),\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEventsEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEventsEndpoint),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"set only process endpoint\",\n\t\t\tddURL: \"https://process.datadoghq.eu\",\n\t\t\tapiKey: \"test\",\n\t\t\texpectedEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(\"https://process.datadoghq.eu\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEventsEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEventsEndpoint),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"set only process-events endpoint\",\n\t\t\teventsDDURL: \"https://process-events.datadoghq.eu\",\n\t\t\tapiKey: \"test\",\n\t\t\texpectedEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEndpoint),\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEventsEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t\tEndpoint: mkurl(\"https://process-events.datadoghq.eu\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"multiple eps\",\n\t\t\tapiKey: \"test\",\n\t\t\tadditionalEndpoints: map[string][]string{\n\t\t\t\t\"https://mock.datadoghq.com\": {\n\t\t\t\t\t\"key1\",\n\t\t\t\t\t\"key2\",\n\t\t\t\t},\n\t\t\t\t\"https://mock2.datadoghq.com\": {\n\t\t\t\t\t\"key3\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tadditionalEventsEndpoints: map[string][]string{\n\t\t\t\t\"https://mock-events.datadoghq.com\": {\n\t\t\t\t\t\"key2\",\n\t\t\t\t},\n\t\t\t\t\"https://mock2-events.datadoghq.com\": {\n\t\t\t\t\t\"key3\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEndpoint),\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key1\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key2\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock2.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key3\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedEventsEndpoints: []apicfg.Endpoint{\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(config.DefaultProcessEventsEndpoint),\n\t\t\t\t\tAPIKey: \"test\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock-events.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key2\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tEndpoint: mkurl(\"https://mock2-events.datadoghq.com\"),\n\t\t\t\t\tAPIKey: \"key3\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t} {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tcfg := config.Mock(t)\n\t\t\tcfg.Set(\"api_key\", tc.apiKey)\n\t\t\tif tc.ddURL != \"\" {\n\t\t\t\tcfg.Set(\"process_config.process_dd_url\", tc.ddURL)\n\t\t\t}\n\n\t\t\tif tc.eventsDDURL != \"\" {\n\t\t\t\tcfg.Set(\"process_config.events_dd_url\", tc.eventsDDURL)\n\t\t\t}\n\n\t\t\tif tc.additionalEndpoints != nil {\n\t\t\t\tcfg.Set(\"process_config.additional_endpoints\", tc.additionalEndpoints)\n\t\t\t}\n\n\t\t\tif tc.additionalEventsEndpoints != nil {\n\t\t\t\tcfg.Set(\"process_config.events_additional_endpoints\", tc.additionalEventsEndpoints)\n\t\t\t}\n\n\t\t\teps, err := endpoint.GetAPIEndpoints(cfg)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.ElementsMatch(t, tc.expectedEndpoints, eps)\n\n\t\t\teventsEps, err := endpoint.GetEventsAPIEndpoints(cfg)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.ElementsMatch(t, tc.expectedEventsEndpoints, eventsEps)\n\t\t})\n\t}\n}", "func (m *MockProvider) OnEndpointsAdd(arg0 *v1.Endpoints) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnEndpointsAdd\", arg0)\n}", "func WithEndpoint(endpoint string) {\n\tcfg.endpoint = strings.TrimRight(endpoint, \"/\")\n}", "func TestInvalidConfiguration(t *testing.T) {\n\tt.Parallel()\n\t// Start a test gRPC server.\n\t_ = mock.NewBase64Plugin(t, newEndpoint().path)\n\n\tctx := testContext(t)\n\n\tinvalidConfigs := []struct {\n\t\tname string\n\t\tendpoint string\n\t}{\n\t\t{\"emptyConfiguration\", \"\"},\n\t\t{\"invalidScheme\", \"tcp://localhost:6060\"},\n\t}\n\n\tfor _, testCase := range invalidConfigs {\n\t\tt.Run(testCase.name, func(t *testing.T) {\n\t\t\t_, err := NewGRPCService(ctx, testCase.endpoint, 1*time.Second)\n\t\t\tif err == nil {\n\t\t\t\tt.Fatalf(\"should fail to create envelope service for %s.\", testCase.name)\n\t\t\t}\n\t\t})\n\t}\n}", "func TestEndpointCase4(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"ap-northeast-3\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.ap-northeast-3.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func testMockSourceEndpoints(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\ttitle string\n\t\tgivenAndExpected []endpoint.Endpoint\n\t}{\n\t\t{\n\t\t\t\"no endpoints given return no endpoints\",\n\t\t\t[]endpoint.Endpoint{},\n\t\t},\n\t\t{\n\t\t\t\"single endpoint given returns single endpoint\",\n\t\t\t[]endpoint.Endpoint{\n\t\t\t\t{DNSName: \"foo\", Target: \"8.8.8.8\"},\n\t\t\t},\n\t\t},\n\t} {\n\t\tt.Run(tc.title, func(t *testing.T) {\n\t\t\t// Create our object under test and get the endpoints.\n\t\t\tsource := NewMockSource(tc.givenAndExpected)\n\n\t\t\tendpoints, err := source.Endpoints()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t// Validate returned endpoints against desired endpoints.\n\t\t\tvalidateEndpoints(t, endpoints, tc.givenAndExpected)\n\t\t})\n\t}\n}", "func TestEndpointCase9(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"ca-central-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.ca-central-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase5(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"ap-south-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.ap-south-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase24(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-west-2\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-west-2.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase18(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-east-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func customSetupEndpoints(pprofActive bool, mgr manager.Manager) error {\n\tif pprofActive {\n\t\tif err := debug.RegisterEndpoint(mgr.AddMetricsExtraHandler, nil); err != nil {\n\t\t\tsetupLog.Error(err, \"Unable to register pprof endpoint\")\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func TestEndpointCase29(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"cn-northwest-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.cn-northwest-1.amazonaws.com.cn\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func testEndpoint(t *testing.T, handlerFuncName string, endpoint http.HandlerFunc, vars map[string]string, reqBody io.Reader, expectedStatus int, expectedBody string) {\n\tt.Helper()\n\n\treq, _ := http.NewRequest(\"\", \"\", reqBody)\n\tif req.ContentLength > 0 {\n\t\treq.Header.Add(\"content-type\", \"application/json\")\n\t}\n\trr := httptest.NewRecorder()\n\tif vars != nil {\n\t\treq = mux.SetURLVars(req, vars)\n\t}\n\tendpoint.ServeHTTP(rr, req)\n\n\tif status := rr.Code; status != expectedStatus {\n\t\tt.Errorf(\"%v returned status %v, expected %v\", handlerFuncName, status, expectedStatus)\n\t}\n\n\tif body := rr.Body.String(); body != expectedBody {\n\t\tt.Errorf(\"%v returned body\\n%v\\nexpected\\n%v\", handlerFuncName, body, expectedBody)\n\t}\n\n}", "func TestEndpointCase15(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"eu-west-3\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.eu-west-3.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase86(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"control\"),\n\t\tConsumerARN: ptr.String(\"arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737\"),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://example.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *MockProvider) OnEndpointsSynced() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnEndpointsSynced\")\n}", "func TestEndpointCase25(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-west-2\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.us-west-2.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase22(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-west-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-west-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase88(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"data\"),\n\t\tConsumerARN: ptr.String(\"arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://123.data-kinesis.us-east-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase59(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"control\"),\n\t\tStreamARN: ptr.String(\"arn:aws:kinesis:us-east-1:123:stream/test-stream\"),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://example.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase40(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-iso-west-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-iso-west-1.c2s.ic.gov\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *MockProc) Config() *service.Config {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Config\")\n\tret0, _ := ret[0].(*service.Config)\n\treturn ret0\n}", "func TestEndpointCase16(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"me-south-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.me-south-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase20(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-2\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-east-2.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (swagger *MgwSwagger) getEndpoints(vendorExtensions map[string]interface{}, endpointName string) (*EndpointCluster, error) {\n\n\t// TODO: (VirajSalaka) x-wso2-production-endpoint 's type does not represent http/https, instead it indicates loadbalance and failover\n\tif endpointClusterYaml, found := vendorExtensions[endpointName]; found {\n\t\tif endpointClusterMap, ok := endpointClusterYaml.(map[string]interface{}); ok {\n\t\t\tendpointPrefix := endpointName + \"_\" + constants.XWso2EPClustersConfigNamePrefix\n\t\t\tif strings.EqualFold(endpointName, constants.XWso2ProdEndpoints) {\n\t\t\t\tendpointPrefix = constants.ProdClustersConfigNamePrefix\n\t\t\t} else if strings.EqualFold(endpointName, constants.XWso2SandbxEndpoints) {\n\t\t\t\tendpointPrefix = constants.SandClustersConfigNamePrefix\n\t\t\t}\n\t\t\tendpointCluster := EndpointCluster{\n\t\t\t\tEndpointPrefix: endpointPrefix,\n\t\t\t}\n\t\t\t// Set URLs\n\t\t\tif urlsProperty, found := endpointClusterMap[constants.Urls]; found {\n\t\t\t\tif urlsArray, ok := urlsProperty.([]interface{}); ok {\n\t\t\t\t\tendpoints, err := processEndpointUrls(urlsArray)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tendpointCluster.Endpoints = endpoints\n\t\t\t\t\tendpointCluster.EndpointType = constants.LoadBalance\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, errors.New(\"Error while parsing array of urls in \" + endpointName)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// TODO: (VirajSalaka) Throw an error and catch from an upper layer where the API name is visible.\n\t\t\t\terrMsg := \"urls property is not provided with the \" + endpointName + \" extension\"\n\t\t\t\tlogger.LoggerOasparser.Error(errMsg)\n\t\t\t\treturn nil, errors.New(errMsg)\n\t\t\t}\n\n\t\t\t// Update Endpoint Cluster type\n\t\t\tif epType, found := endpointClusterMap[constants.Type]; found {\n\t\t\t\tif endpointType, ok := epType.(string); ok {\n\t\t\t\t\tendpointCluster.EndpointType = endpointType\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Set Endpoint Config\n\t\t\tif advanceEndpointConfig, found := endpointClusterMap[constants.AdvanceEndpointConfig]; found {\n\t\t\t\tif configMap, ok := advanceEndpointConfig.(map[string]interface{}); ok {\n\t\t\t\t\tvar endpointConfig EndpointConfig\n\t\t\t\t\terr := parser.Decode(configMap, &endpointConfig)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, errors.New(\"Invalid schema for advanceEndpointConfig in \" + endpointName)\n\t\t\t\t\t}\n\t\t\t\t\tendpointCluster.Config = &endpointConfig\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, errors.New(\"Invalid structure for advanceEndpointConfig in \" + endpointName)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Set Endpoint Config\n\t\t\tif securityConfig, found := endpointClusterMap[constants.SecurityConfig]; found {\n\t\t\t\tif configMap, ok := securityConfig.(map[string]interface{}); ok {\n\t\t\t\t\tvar epSecurity EndpointSecurity\n\t\t\t\t\terr := parser.Decode(configMap, &epSecurity)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, errors.New(\"Invalid schema for securityConfig in API \" + swagger.title +\n\t\t\t\t\t\t\t\" : \" + swagger.version + \"for \" + endpointName)\n\t\t\t\t\t}\n\t\t\t\t\tif !strings.EqualFold(\"BASIC\", epSecurity.Type) {\n\t\t\t\t\t\treturn nil, errors.New(\"endpoint security type : \" + epSecurity.Type +\n\t\t\t\t\t\t\t\" is not currently supported with WSO2 Choreo Connect\")\n\t\t\t\t\t}\n\t\t\t\t\tepSecurity.Enabled = true\n\t\t\t\t\tendpointCluster.SecurityConfig = epSecurity\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn &endpointCluster, nil\n\t\t} else if endpointRef, ok := endpointClusterYaml.(string); ok &&\n\t\t\t(strings.EqualFold(endpointName, constants.XWso2ProdEndpoints) || strings.EqualFold(endpointName, constants.XWso2SandbxEndpoints)) {\n\t\t\trefPrefix := \"#/\" + constants.XWso2endpoints + \"/\"\n\t\t\tif strings.HasPrefix(endpointRef, refPrefix) {\n\t\t\t\tepName := strings.TrimPrefix(endpointRef, refPrefix)\n\t\t\t\tif _, found := swagger.xWso2Endpoints[epName]; found {\n\t\t\t\t\treturn swagger.xWso2Endpoints[epName], nil\n\t\t\t\t}\n\t\t\t\treturn nil, errors.New(\"Invalid endpoint reference \" + endpointRef)\n\t\t\t}\n\n\t\t}\n\t\tlogger.LoggerOasparser.Errorf(\"%v OpenAPI extension does not adhere with the schema\", endpointName)\n\t\treturn nil, errors.New(\"invalid map structure detected\")\n\t}\n\treturn nil, nil // the vendor extension for prod or sandbox just isn't present\n}", "func TestCfg(url string) *Cfg {\n\tif url == \"\" {\n\t\turl = \"http://127.0.0.1/\"\n\t} else if !strings.HasSuffix(url, \"/\") {\n\t\turl += \"/\"\n\t}\n\treturn &Cfg{\n\t\tSrc: \"test\",\n\t\tEnvironment: azure.Environment{\n\t\t\tName: azure.PublicCloud.Name,\n\t\t\tManagementPortalURL: url,\n\t\t\tPublishSettingsURL: url + \"publishsettings/index\",\n\t\t\tServiceManagementEndpoint: url,\n\t\t\tResourceManagerEndpoint: url,\n\t\t\tActiveDirectoryEndpoint: url,\n\t\t\tGalleryEndpoint: url,\n\t\t\tKeyVaultEndpoint: url,\n\t\t\tGraphEndpoint: url,\n\t\t\tServiceBusEndpoint: url,\n\t\t\tBatchManagementEndpoint: url,\n\t\t\tTokenAudience: url,\n\t\t},\n\t\tTenantID: NilGUID,\n\t\tSubscriptionID: NilGUID,\n\t\tLocation: \"eastus\",\n\t\tnewAuthz: func(string) autorest.Authorizer {\n\t\t\treturn autorest.NullAuthorizer{}\n\t\t},\n\t}\n}", "func TestEndpoint(t *testing.T) {\n\t// {\"service\":\"Service\",\"service_id\":\"ServiceId\",\"frontend\":\"Frontend\",\"deploy_path\":\"DeployPath\",\"hostname\":\"Hostname\",\"start_time\":\"StartTime\"}\n\n\t// 1. 正常的Marshal & Unmarshal\n\tendpoint := &ServiceEndpoint{\n\t\tService: \"Service\",\n\t\tServiceId: \"ServiceId\",\n\t\tFrontend: \"Frontend\",\n\t\tDeployPath: \"DeployPath\",\n\t\tHostname: \"Hostname\",\n\t\tStartTime: \"StartTime\",\n\t}\n\n\tdata, _ := json.Marshal(endpoint)\n\tfmt.Println(\"Endpoint: \", string(data))\n\n\tassert.True(t, true)\n\n\t// 2. 缺少字段时的Unmarshal(缺少的字段为空)\n\tdata21 := []byte(`{\"service\":\"Service\",\"service_id\":\"ServiceId\",\"frontend\":\"Frontend\"}`)\n\n\tendpoint2 := &ServiceEndpoint{}\n\terr2 := json.Unmarshal(data21, endpoint2)\n\tassert.True(t, err2 == nil)\n\n\tfmt.Println(\"Error2: \", err2)\n\tdata22, _ := json.Marshal(endpoint2)\n\tfmt.Println(\"Endpoint2: \", string(data22))\n\n\t// 3. 字段多的情况下的Unmarshal(多余的字段直接忽略)\n\tdata31 := []byte(`{\"service\":\"Service\", \"serviceA\":\"AService\",\"service_id\":\"ServiceId\",\"frontend\":\"Frontend\"}`)\n\tendpoint3 := &ServiceEndpoint{}\n\terr3 := json.Unmarshal(data31, endpoint3)\n\tassert.True(t, err3 == nil)\n\tfmt.Println(\"Error3: \", err3)\n\tdata32, _ := json.Marshal(endpoint3)\n\tfmt.Println(\"Endpoint3: \", string(data32))\n\n}", "func TestEndpointCase34(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-gov-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-gov-east-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase3(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"ap-northeast-2\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.ap-northeast-2.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase28(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"cn-north-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.cn-north-1.amazonaws.com.cn\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase14(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"eu-west-2\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.eu-west-2.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *SDMock) Endpoint() string {\n\treturn m.Server.URL + \"/\"\n}", "func (policy *PolicySvc) augmentEndpoint(endpoint *common.Endpoint) error {\n\ttenantSvcUrl, err := policy.client.GetServiceUrl(\"tenant\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif endpoint.Peer == common.Wildcard {\n\t\t// If a wildcard is specfied, there is nothing to augment\n\t\treturn nil\n\t}\n\tlog.Printf(\"Policy: Augmenting %#v\", endpoint)\n\n\t// Code below tries to resolve tenant name into tenant_network_id if possible.\n\t//\n\t// TODO this will have to be changed once we implement\n\t// https://paninetworks.kanbanize.com/ctrl_board/3/cards/319/details\n\tten := &tenant.Tenant{}\n\tif endpoint.TenantNetworkID == nil {\n\t\tif endpoint.TenantID != 0 {\n\t\t\ttenantIDToUse := strconv.FormatUint(endpoint.TenantID, 10)\n\t\t\ttenantsUrl := fmt.Sprintf(\"%s/tenants/%s\", tenantSvcUrl, tenantIDToUse)\n\t\t\tlog.Printf(\"Policy: Looking tenant up at %s\", tenantsUrl)\n\t\t\terr = policy.client.Get(tenantsUrl, ten)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tendpoint.TenantNetworkID = &ten.NetworkID\n\n\t\t} else if endpoint.TenantExternalID != \"\" || endpoint.TenantName != \"\" {\n\t\t\tif endpoint.TenantExternalID != \"\" {\n\t\t\t\tten.ExternalID = endpoint.TenantExternalID\n\t\t\t}\n\t\t\tif endpoint.TenantName != \"\" {\n\t\t\t\tten.Name = endpoint.TenantName\n\t\t\t}\n\t\t\terr = policy.client.Find(ten, common.FindLast)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tendpoint.TenantNetworkID = &ten.NetworkID\n\t\t}\n\t}\n\n\tif endpoint.SegmentNetworkID == nil {\n\t\tif ten == nil && (endpoint.SegmentID != 0 || endpoint.SegmentExternalID != \"\" || endpoint.SegmentName != \"\") {\n\t\t\treturn common.NewError400(\"No tenant information specified, cannot look up segment.\")\n\t\t}\n\t\tsegment := &tenant.Segment{}\n\t\tif endpoint.SegmentID != 0 {\n\t\t\tsegmentIDToUse := strconv.FormatUint(endpoint.SegmentID, 10)\n\t\t\tsegmentsUrl := fmt.Sprintf(\"%s/tenants/%d/segments/%s\", tenantSvcUrl, ten.ID, segmentIDToUse)\n\t\t\tlog.Printf(\"Policy: Looking segment up at %s for %#v\", segmentsUrl, endpoint)\n\t\t\terr = policy.client.Get(segmentsUrl, &segment)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tendpoint.SegmentNetworkID = &segment.NetworkID\n\t\t} else if endpoint.SegmentExternalID != \"\" || endpoint.SegmentName != \"\" {\n\t\t\tsegmentsUrl := fmt.Sprintf(\"%s/findLast/segments?tenant_id=%d&\", tenantSvcUrl, ten.ID)\n\t\t\tif endpoint.SegmentExternalID != \"\" {\n\t\t\t\tsegmentsUrl += \"external_id=\" + endpoint.TenantExternalID + \"&\"\n\t\t\t}\n\t\t\tif endpoint.SegmentName != \"\" {\n\t\t\t\tsegmentsUrl += \"name=\" + endpoint.SegmentName\n\t\t\t}\n\t\t\tlog.Printf(\"Policy: Finding segments at %s for %#v (Tenant %#v %t)\", segmentsUrl, endpoint, ten, ten == nil)\n\t\t\terr = policy.client.Get(segmentsUrl, &segment)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tendpoint.SegmentNetworkID = &segment.NetworkID\n\t\t}\n\t}\n\treturn nil\n}", "func TestEndpointCase26(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.us-east-1.api.aws\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func mockConfig(num int) *KConf {\n\tconfig := clientcmdapi.NewConfig()\n\tfor i := 0; i < num; i++ {\n\t\tvar name string\n\t\tif i == 0 {\n\t\t\tname = \"test\"\n\t\t} else {\n\t\t\tname = fmt.Sprintf(\"test-%d\", i)\n\t\t}\n\t\tconfig.Clusters[name] = &clientcmdapi.Cluster{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tServer: fmt.Sprintf(\"https://example-%s.com:6443\", name),\n\t\t\tInsecureSkipTLSVerify: true,\n\t\t\tCertificateAuthority: \"bbbbbbbbbbbb\",\n\t\t\tCertificateAuthorityData: []byte(\"bbbbbbbbbbbb\"),\n\t\t}\n\t\tconfig.AuthInfos[name] = &clientcmdapi.AuthInfo{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tToken: fmt.Sprintf(\"bbbbbbbbbbbb-%s\", name),\n\t\t}\n\t\tconfig.Contexts[name] = &clientcmdapi.Context{\n\t\t\tLocationOfOrigin: \"/home/user/.kube/config\",\n\t\t\tCluster: name,\n\t\t\tAuthInfo: name,\n\t\t\tNamespace: \"default\",\n\t\t}\n\t}\n\treturn &KConf{Config: *config}\n}", "func EndpointFactory(args *endpoint.Arg, stats *stats.Stats, workerCount uint) (endpoint.EndPoint, error) {\n\tif FailSetup {\n\t\treturn nil, errors.New(\"Forced Error\")\n\t}\n\treturn &fakeEndpoint{}, nil\n}", "func TestEndpointCase12(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"eu-south-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.eu-south-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *InspectorMock) Endpoint() string {\n\tif m == nil {\n\t\treturn \"https://inspector.test/v1/\"\n\t}\n\treturn m.MockServer.Endpoint()\n}", "func (n *mockAgent) configure(h hypervisor, id, sharePath string, config interface{}) error {\n\treturn nil\n}", "func TestAPIClientConfig(t *testing.T) {\n\ttestCases := []struct {\n\t\tname string\n\t\tsetup func()\n\t\tassertions func(\n\t\t\taddress string,\n\t\t\ttoken string,\n\t\t\topts restmachinery.APIClientOptions,\n\t\t\terr error,\n\t\t)\n\t}{\n\t\t{\n\t\t\tname: \"API_ADDRESS not set\",\n\t\t\tsetup: func() {},\n\t\t\tassertions: func(\n\t\t\t\t_ string,\n\t\t\t\t_ string,\n\t\t\t\t_ restmachinery.APIClientOptions,\n\t\t\t\terr error,\n\t\t\t) {\n\t\t\t\trequire.Error(t, err)\n\t\t\t\trequire.Contains(t, err.Error(), \"value not found for\")\n\t\t\t\trequire.Contains(t, err.Error(), \"API_ADDRESS\")\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"API_TOKEN not set\",\n\t\t\tsetup: func() {\n\t\t\t\tt.Setenv(\"API_ADDRESS\", \"foo\")\n\t\t\t},\n\t\t\tassertions: func(\n\t\t\t\t_ string,\n\t\t\t\t_ string,\n\t\t\t\t_ restmachinery.APIClientOptions,\n\t\t\t\terr error,\n\t\t\t) {\n\t\t\t\trequire.Error(t, err)\n\t\t\t\trequire.Contains(t, err.Error(), \"value not found for\")\n\t\t\t\trequire.Contains(t, err.Error(), \"API_TOKEN\")\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"SUCCESS not set\",\n\t\t\tsetup: func() {\n\t\t\t\tt.Setenv(\"API_TOKEN\", \"bar\")\n\t\t\t\tt.Setenv(\"API_IGNORE_CERT_WARNINGS\", \"true\")\n\t\t\t},\n\t\t\tassertions: func(\n\t\t\t\taddress string,\n\t\t\t\ttoken string,\n\t\t\t\topts restmachinery.APIClientOptions,\n\t\t\t\terr error,\n\t\t\t) {\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\trequire.Equal(t, \"foo\", address)\n\t\t\t\trequire.Equal(t, \"bar\", token)\n\t\t\t\trequire.True(t, opts.AllowInsecureConnections)\n\t\t\t},\n\t\t},\n\t}\n\tfor _, testCase := range testCases {\n\t\tt.Run(testCase.name, func(t *testing.T) {\n\t\t\ttestCase.setup()\n\t\t\taddress, token, opts, err := apiClientConfig()\n\t\t\ttestCase.assertions(address, token, opts, err)\n\t\t})\n\t}\n}", "func TestEndpointCase35(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-gov-west-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-gov-west-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase94(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"data\"),\n\t\tConsumerARN: ptr.String(\"arn:aws:kinesis:us-west-1:123:stream/testStream/consumer/test-consumer:1525898737\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://123.data-kinesis.us-east-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase87(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"control\"),\n\t\tConsumerARN: ptr.String(\"arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://123.control-kinesis.us-east-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (h Handler) TestEndpoint() error {\n\tr, err := http.Get(h.url)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif r.StatusCode != 200 {\n\t\treturn errors.New(\"Endpoint not replying typical 200 answer on ping\")\n\t}\n\n\treturn nil\n}", "func TestCustomAnchoreConfigProvider_GetConfiguration(t *testing.T) {\n\tintegratedServiceRepository := integratedservices.NewInMemoryIntegratedServiceRepository(map[uint][]integratedservices.IntegratedService{\n\t\t1: {\n\t\t\t{\n\t\t\t\tName: \"securityscan\",\n\t\t\t\tSpec: map[string]interface{}{\n\t\t\t\t\t\"customAnchore\": map[string]interface{}{\n\t\t\t\t\t\t\"enabled\": true,\n\t\t\t\t\t\t\"url\": \"https://anchore.example.com\",\n\t\t\t\t\t\t\"secretId\": \"secretId\",\n\t\t\t\t\t\t\"insecure\": true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tOutput: nil,\n\t\t\t\tStatus: integratedservices.IntegratedServiceStatusActive,\n\t\t\t},\n\t\t},\n\t})\n\n\tsecretStore := new(SecretStore)\n\tsecretStore.On(\"GetSecretValues\", mock.Anything, \"secretId\").Return(\n\t\tmap[string]string{\n\t\t\t\"username\": \"user\",\n\t\t\t\"password\": \"password\",\n\t\t},\n\t\tnil,\n\t)\n\n\tconfigProvider := NewCustomAnchoreConfigProvider(integratedServiceRepository, secretStore, services.NoopLogger{})\n\n\tconfig, err := configProvider.GetConfiguration(context.Background(), 1)\n\trequire.NoError(t, err)\n\n\tassert.Equal(\n\t\tt,\n\t\tanchore.Config{\n\t\t\tEndpoint: \"https://anchore.example.com\",\n\t\t\tUser: \"user\",\n\t\t\tPassword: \"password\",\n\t\t\tInsecure: true,\n\t\t},\n\t\tconfig,\n\t)\n\n\tsecretStore.AssertExpectations(t)\n}", "func TestEndpointCase46(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Invalid Configuration: FIPS and custom endpoint are not supported\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}", "func TestEndpointCase6(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"ap-southeast-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.ap-southeast-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase47(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tEndpoint: ptr.String(\"https://example.com\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err == nil {\n\t\tt.Fatalf(\"expect error, got none\")\n\t}\n\tif e, a := \"Invalid Configuration: Dualstack and custom endpoint are not supported\", err.Error(); !strings.Contains(a, e) {\n\t\tt.Errorf(\"expect %v error in %v\", e, a)\n\t}\n}", "func TestEndpointCase66(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-west-1\"),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"control\"),\n\t\tStreamARN: ptr.String(\"arn:aws:kinesis:us-west-1:123:stream/test-stream\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://123.control-kinesis.us-west-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *MockAPI) SupportsJobsEndpoint() (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SupportsJobsEndpoint\")\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestGetAPIEndpointsSite(t *testing.T) {\n\tfor _, tc := range []struct {\n\t\tname string\n\t\tsite string\n\t\tddURL, eventsDDURL string\n\t\texpectedHostname, expectedEventsHostname string\n\t}{\n\t\t{\n\t\t\tname: \"site only\",\n\t\t\tsite: \"datadoghq.io\",\n\t\t\texpectedHostname: \"process.datadoghq.io\",\n\t\t\texpectedEventsHostname: \"process-events.datadoghq.io\",\n\t\t},\n\t\t{\n\t\t\tname: \"dd_url only\",\n\t\t\tddURL: \"https://process.datadoghq.eu\",\n\t\t\texpectedHostname: \"process.datadoghq.eu\",\n\t\t\texpectedEventsHostname: \"process-events.datadoghq.com\",\n\t\t},\n\t\t{\n\t\t\tname: \"events_dd_url only\",\n\t\t\teventsDDURL: \"https://process-events.datadoghq.eu\",\n\t\t\texpectedHostname: \"process.datadoghq.com\",\n\t\t\texpectedEventsHostname: \"process-events.datadoghq.eu\",\n\t\t},\n\t\t{\n\t\t\tname: \"both site and dd_url\",\n\t\t\tsite: \"datacathq.eu\",\n\t\t\tddURL: \"https://burrito.com\",\n\t\t\teventsDDURL: \"https://burrito-events.com\",\n\t\t\texpectedHostname: \"burrito.com\",\n\t\t\texpectedEventsHostname: \"burrito-events.com\",\n\t\t},\n\t} {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tcfg := config.Mock(t)\n\t\t\tif tc.site != \"\" {\n\t\t\t\tcfg.Set(\"site\", tc.site)\n\t\t\t}\n\t\t\tif tc.ddURL != \"\" {\n\t\t\t\tcfg.Set(\"process_config.process_dd_url\", tc.ddURL)\n\t\t\t}\n\t\t\tif tc.eventsDDURL != \"\" {\n\t\t\t\tcfg.Set(\"process_config.events_dd_url\", tc.eventsDDURL)\n\t\t\t}\n\n\t\t\teps, err := endpoint.GetAPIEndpoints(cfg)\n\t\t\tassert.NoError(t, err)\n\n\t\t\tmainEndpoint := eps[0]\n\t\t\tassert.Equal(t, tc.expectedHostname, mainEndpoint.Endpoint.Hostname())\n\n\t\t\teventsEps, err := endpoint.GetEventsAPIEndpoints(cfg)\n\t\t\tassert.NoError(t, err)\n\n\t\t\tmainEventEndpoint := eventsEps[0]\n\t\t\tassert.Equal(t, tc.expectedEventsHostname, mainEventEndpoint.Endpoint.Hostname())\n\t\t})\n\t}\n}", "func TestConfiguration(t *testing.T) { TestingT(t) }", "func TestGetConnectorConfig(t *testing.T) {\n\tbaseURL := \"https://fake.api\"\n\tc := NewClient(WithHost(baseURL))\n\n\thttpmock.ActivateNonDefault(c.client.GetClient())\n\tdefer httpmock.DeactivateAndReset()\n\n\thttpmock.RegisterResponder(\"GET\", baseURL+\"/connectors/datagen-product/config\", newJsonStringResponder(http.StatusOK, `{\"connector.class\":\"io.confluent.kafka.connect.datagen.DatagenConnector\",\"quickstart\":\"product\",\"tasks.max\":\"1\",\"value.converter.schemas.enable\":\"false\",\"name\":\"datagen-product\",\"kafka.topic\":\"product\",\"max.interval\":\"1000\",\"iterations\":\"10000000\"}`))\n\tinfo, err := c.GetConnectorConfig(context.Background(), \"datagen-product\")\n\tassert.NoError(t, err)\n\tassert.Equal(t, \"io.confluent.kafka.connect.datagen.DatagenConnector\", info[\"connector.class\"])\n\tassert.Equal(t, \"1000\", info[\"max.interval\"])\n}", "func (m *MockLogic) Config() *config.AppConfig {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Config\")\n\tret0, _ := ret[0].(*config.AppConfig)\n\treturn ret0\n}", "func TestEndpointCase42(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-isob-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-isob-east-1.sc2s.sgov.gov\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase60(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-1\"),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"control\"),\n\t\tStreamARN: ptr.String(\"arn:aws:kinesis:us-east-1:123:stream/test-stream\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://123.control-kinesis.us-east-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *MockProc) OnSvcConfigUpdate(arg0 *service.Config) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"OnSvcConfigUpdate\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func TestEndpointCase36(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-gov-west-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-gov-west-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase23(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-west-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.us-west-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *MockConfiguration) EndSessionEndpoint() op.Endpoint {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"EndSessionEndpoint\")\n\tret0, _ := ret[0].(op.Endpoint)\n\treturn ret0\n}", "func (_m *Knapsack) OsqueryTlsConfigEndpoint() string {\n\tret := _m.Called()\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func() string); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\treturn r0\n}", "func TestConfiguration(t *testing.T) {\n\tconst (\n\t\tbbbCmdScript string = \"/path/to/cmd-script.sh\"\n\t\tbbbConfigScript string = \"/path/to/config-script.sh\"\n\t\tbbbSystemctlScript string = \"/path/to/systemctl-script.sh\"\n\t\telectrsRPCPort string = \"18442\"\n\t\timageUpdateInfoURL string = \"https://shiftcrypto.ch/updates/base.json\"\n\t\tmiddlewarePort string = \"8085\"\n\t\tmiddlewareVersion string = \"0.0.1\"\n\t\tnetwork string = \"testnet\"\n\t\tnotificationNamedPipePath string = \"/tmp/middleware-notification.pipe\"\n\t\tprometheusURL string = \"http://localhost:9090\"\n\t\tredisMock bool = false\n\t\tredisPort string = \"6379\"\n\t)\n\n\tconfig := configuration.NewConfiguration(\n\t\tconfiguration.Args{\n\t\t\tBBBCmdScript: bbbCmdScript,\n\t\t\tBBBConfigScript: bbbConfigScript,\n\t\t\tBBBSystemctlScript: bbbSystemctlScript,\n\t\t\tElectrsRPCPort: electrsRPCPort,\n\t\t\tImageUpdateInfoURL: imageUpdateInfoURL,\n\t\t\tMiddlewarePort: middlewarePort,\n\t\t\tMiddlewareVersion: middlewareVersion,\n\t\t\tNetwork: network,\n\t\t\tNotificationNamedPipePath: notificationNamedPipePath,\n\t\t\tPrometheusURL: prometheusURL,\n\t\t\tRedisMock: redisMock,\n\t\t\tRedisPort: redisPort,\n\t\t},\n\t)\n\n\trequire.Equal(t, bbbCmdScript, config.GetBBBCmdScript())\n\trequire.Equal(t, bbbConfigScript, config.GetBBBConfigScript())\n\trequire.Equal(t, bbbSystemctlScript, config.GetBBBSystemctlScript())\n\trequire.Equal(t, electrsRPCPort, config.GetElectrsRPCPort())\n\trequire.Equal(t, imageUpdateInfoURL, config.GetImageUpdateInfoURL())\n\trequire.Equal(t, middlewarePort, config.GetMiddlewarePort())\n\trequire.Equal(t, middlewareVersion, config.GetMiddlewareVersion())\n\trequire.Equal(t, network, config.GetNetwork())\n\trequire.Equal(t, notificationNamedPipePath, config.GetNotificationNamedPipePath())\n\trequire.Equal(t, prometheusURL, config.GetPrometheusURL())\n\trequire.Equal(t, redisPort, config.GetRedisPort())\n}", "func TestEndpointCase31(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"cn-north-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.cn-north-1.amazonaws.com.cn\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestFailedEndpoint1(t *testing.T) {\n\tisTesting = true\n\tvar request = Request{\n\t\tPath: \"/api/device\",\n\t\tHTTPMethod: \"GET\",\n\t}\n\tvar response, _ = Handler(request)\n\tif response.StatusCode != 404 {\n\t\tt.Errorf(\"response status code has to be 404 but is %d\", response.StatusCode)\n\t}\n\tif response.Body != `{\"message\":\"requested endpoint not found\"}` {\n\t\tt.Errorf(\"body is: %s\", response.Body)\n\t}\n}", "func TestEndpointCase21(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-east-2\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.us-east-2.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestConfigure(t *testing.T) {\n\tprops := map[string]interface{}{\n\t\t\"interval\": 500,\n\t\t\"path\": \"test\",\n\t}\n\tm := File().(*fileSink)\n\terr := m.Configure(props)\n\tif err != nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr nil\", err)\n\t}\n\tif m.c.Path != \"test\" {\n\t\tt.Errorf(\"Configure() Path = %v, want test\", m.c.Path)\n\t}\n\terr = m.Configure(map[string]interface{}{\"interval\": 500, \"path\": \"\"})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"fileType\": \"csv2\"})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\n\t\t\"interval\": 500,\n\t\t\"path\": \"test\",\n\t\t\"fileType\": \"csv\",\n\t})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"interval\": 60, \"path\": \"test\", \"checkInterval\": -1})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"rollingInterval\": -1})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"rollingCount\": -1})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"rollingCount\": 0, \"rollingInterval\": 0})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"RollingNamePattern\": \"test\"})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\terr = m.Configure(map[string]interface{}{\"RollingNamePattern\": 0})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n\n\tfor k := range compressionTypes {\n\t\terr = m.Configure(map[string]interface{}{\n\t\t\t\"interval\": 500,\n\t\t\t\"path\": \"test\",\n\t\t\t\"compression\": k,\n\t\t\t\"rollingNamePattern\": \"suffix\",\n\t\t})\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Configure() error = %v, wantErr nil\", err)\n\t\t}\n\t\tif m.c.Compression != k {\n\t\t\tt.Errorf(\"Configure() Compression = %v, want %v\", m.c.Compression, k)\n\t\t}\n\t}\n\n\terr = m.Configure(map[string]interface{}{\n\t\t\"interval\": 500,\n\t\t\"path\": \"test\",\n\t\t\"compression\": \"\",\n\t\t\"rollingNamePattern\": \"suffix\",\n\t})\n\tif err != nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr nil\", err)\n\t}\n\tif m.c.Compression != \"\" {\n\t\tt.Errorf(\"Configure() Compression = %v, want %v\", m.c.Compression, \"\")\n\t}\n\n\terr = m.Configure(map[string]interface{}{\n\t\t\"interval\": 500,\n\t\t\"path\": \"test\",\n\t\t\"compression\": \"not_exist_algorithm\",\n\t})\n\tif err == nil {\n\t\tt.Errorf(\"Configure() error = %v, wantErr not nil\", err)\n\t}\n}", "func TestEndpointCase72(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-isob-east-1\"),\n\t\tUseFIPS: ptr.Bool(false),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"data\"),\n\t\tStreamARN: ptr.String(\"arn:aws-iso-b:kinesis:us-isob-east-1:123:stream/test-stream\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.us-isob-east-1.sc2s.sgov.gov\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase13(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"eu-west-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.eu-west-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase101(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-isob-east-1\"),\n\t\tUseFIPS: ptr.Bool(true),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"data\"),\n\t\tConsumerARN: ptr.String(\"arn:aws-iso-b:kinesis:us-isob-east-1:123:stream/test-stream/consumer/test-consumer:1525898737\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.us-isob-east-1.sc2s.sgov.gov\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (m *MockProvider) OnEndpointsUpdate(arg0, arg1 *v1.Endpoints) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnEndpointsUpdate\", arg0, arg1)\n}", "func TestEndpointCase17(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"sa-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.sa-east-1.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase30(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"cn-north-1\"),\n\t\tUseDualStack: ptr.Bool(true),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.cn-north-1.api.amazonwebservices.com.cn\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase43(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-isob-east-1\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(true),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.us-isob-east-1.sc2s.sgov.gov\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func (c *ServerConfig) getConfigEndpoint() string {\n\tnurl := *c.ParsedEndpoint\n\tnurl.Path = path.Join(nurl.Path, c.APIPaths.Config)\n\treturn nurl.String()\n}", "func TestEndpointCase8(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"ap-southeast-3\"),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tUseFIPS: ptr.Bool(false),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis.ap-southeast-3.amazonaws.com\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}", "func TestEndpointCase74(t *testing.T) {\n\tvar params = EndpointParameters{\n\t\tRegion: ptr.String(\"us-isob-east-1\"),\n\t\tUseFIPS: ptr.Bool(true),\n\t\tUseDualStack: ptr.Bool(false),\n\t\tOperationType: ptr.String(\"data\"),\n\t\tStreamARN: ptr.String(\"arn:aws-iso-b:kinesis:us-isob-east-1:123:stream/test-stream\"),\n\t}\n\n\tresolver := NewDefaultEndpointResolverV2()\n\tresult, err := resolver.ResolveEndpoint(context.Background(), params)\n\t_, _ = result, err\n\n\tif err != nil {\n\t\tt.Fatalf(\"expect no error, got %v\", err)\n\t}\n\n\turi, _ := url.Parse(\"https://kinesis-fips.us-isob-east-1.sc2s.sgov.gov\")\n\n\texpectEndpoint := smithyendpoints.Endpoint{\n\t\tURI: *uri,\n\t\tHeaders: http.Header{},\n\t\tProperties: smithy.Properties{},\n\t}\n\n\tif e, a := expectEndpoint.URI, result.URI; e != a {\n\t\tt.Errorf(\"expect %v URI, got %v\", e, a)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != \"\" {\n\t\tt.Errorf(\"expect headers to match\\n%s\", diff)\n\t}\n\n\tif diff := cmp.Diff(expectEndpoint.Properties, result.Properties,\n\t\tcmp.AllowUnexported(smithy.Properties{}),\n\t); diff != \"\" {\n\t\tt.Errorf(\"expect properties to match\\n%s\", diff)\n\t}\n}" ]
[ "0.7284712", "0.62881446", "0.6148093", "0.607511", "0.60254085", "0.59867734", "0.59809434", "0.5971515", "0.5964234", "0.5937066", "0.5932493", "0.5927245", "0.58994836", "0.5884062", "0.58370537", "0.5783843", "0.5769066", "0.5700508", "0.5699805", "0.56984586", "0.5690053", "0.56697416", "0.5666805", "0.5644141", "0.56359106", "0.5632857", "0.5620694", "0.56165326", "0.5609913", "0.5601592", "0.560002", "0.5598766", "0.55978227", "0.55954623", "0.55734885", "0.5563423", "0.55619204", "0.55592895", "0.5546083", "0.5543883", "0.5530128", "0.5526328", "0.55163777", "0.5507484", "0.550522", "0.5504497", "0.5502939", "0.5487244", "0.5482437", "0.54715306", "0.5469288", "0.545897", "0.54550785", "0.54540384", "0.5449529", "0.54442734", "0.5442012", "0.54413307", "0.5437899", "0.5433939", "0.5428798", "0.5427225", "0.54257876", "0.5423628", "0.5423548", "0.5418274", "0.5412066", "0.54106", "0.540735", "0.5399175", "0.53984535", "0.53755426", "0.5349576", "0.5344264", "0.53426164", "0.53404826", "0.53365374", "0.5334806", "0.53331846", "0.5327109", "0.5327019", "0.53194255", "0.5313424", "0.5313043", "0.5312203", "0.5311596", "0.5303168", "0.5302402", "0.5301216", "0.5297687", "0.5295873", "0.529197", "0.52880824", "0.5279044", "0.52784693", "0.5278219", "0.5277614", "0.5269868", "0.52644575", "0.5264322" ]
0.7244226
1